ウェブサイト検索

CentOS 8 に Seafile ストレージをインストールして構成する |


CentOS 8 に Seafile をインストールして設定するにはどうすればよいですか? Seafile サーバーは、パフォーマンスと高い信頼性を実現するために構築された、オープンソースのエンタープライズ型自己ホスト型ファイル ホスティング プラットフォームです。 Seafile を使用すると、ファイルを独自のサーバーに配置し、さまざまなデバイスがファイルを同期してアクセスできるようになります。すべてのファイルに仮想ディスクとしてアクセスすることもできます。このブログでは、CentOS 8 に Seafile ファイル共有サーバーをインストールして構成する方法を見ていきます。

以下は、信頼性の高いファイル共有プラットフォームを実現する Seafile の重要な機能の一部です。

  • ファイルの暗号化
  • ファイルのロック
  • オンライン編集と共同編集
  • ファイルのバージョン管理とスナップショット
  • モバイル ファイル アクセス
  • クライアントのインストールと使用が簡単
  • ファイル共有と権限制御

CentOS 8 に Seafile ストレージ サーバーをインストールする

以下は、CentOS 8 システムに Seafile Storage Server をインストールして構成する手順です。

ステップ 1: システムを更新し、ホスト名を設定する

まず、SELinux を Permissive モードにして、これから実行するインストールが妨げられないようにします。

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
cat /etc/selinux/config | grep SELINUX=

Selinux を無効にした後、CentOS 8 でアップデートを実行します。

sudo dnf -y update

次に、hosts ファイルを構成し、サーバーのホスト名を設定します。

sudo hostnamectl set-hostname seafile.example.com

/etc/hosts ファイルに設定されている IP とホスト名を更新します

$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 6a:42:06:78:a3:6a brd ff:ff:ff:ff:ff:ff
    inet 10.116.0.2/20 brd 10.116.15.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::6842:6ff:fe78:a36a/64 scope link
       valid_lft forever preferred_lft forever

$ sudo vi /etc/hosts
10.116.0.2 seafile.example.com #example

システムを再起動します

sudo reboot

ステップ 2: EPEL リポジトリを追加し、依存関係をインストールする

まず、Seafile の依存関係と必要なパッケージをインストールしましょう

sudo dnf -y install vim epel-release
sudo dnf -y install python3 python3-devel python3-imaging MySQL-python3 python3-simplejson python3-setuptools mariadb mariadb-server nginx gcc mysql-devel

Pip3 モジュールのインストール:

sudo pip3 install --upgrade pip
sudo python3 -m pip install --upgrade Pillow
sudo pip3 install pylibmc captcha jinja2 django-pylibmc django-simple-captcha python3-ldap mysqlclient
sudo pip3 install future sqlalchemy==1.4.3

ステップ 3: MariaDB データベースサーバーを構成する

依存関係をインストールするときに、すでに MariaDB がインストールされています。設定を進めてみましょう。 MariaDB を起動し、システム起動時に起動できるようにします。

sudo systemctl start mariadb
sudo systemctl enable mariadb

mariadb を安全にインストールし、root パスワードを設定します。

$ sudo mysql_secure_installation
Enter current password for root (enter for none):  Press Enter
Set root password? [Y/n] y
New password:  Enter New Password
Re-enter new password:  Repeat New Password 
Remove anonymous users? [Y/n] Y 
Disallow root login remotely? [Y/n] Y 
Remove test database and access to it? [Y/n] Y 
Reload privilege tables now? [Y/n] Y 
... Success! 
Cleaning up... 
All done!  If you've completed all of the above steps, your MariaDB

ステップ 4: Seafile データベースを作成する

MariaDB を構成したら、Seafile ユーザーとデータベースの作成に進みます。以下のコマンドを使用して MySQL に接続し、上で設定したパスワードを入力します。

mysql -u root -p 

Seafile と次の 3 つのデータベースのユーザーを作成します。

  • ccnet_db
  • シーファイル_データベース
  • シーハブ_db

MySQL に接続したら、次のコマンドを実行して必要なデータベースを作成します。

create database ccnet_db character set = 'utf8';
create database seafile_db character set = 'utf8';
create database seahub_db character set = 'utf8';
create user seacloud@localhost identified by 'StrongDBPassw0rd';
grant all privileges on ccnet_db.* to seacloud@localhost identified by 'StrongDBPassw0rd';
grant all privileges on seafile_db.* to seacloud@localhost identified by 'StrongDBPassw0rd';
grant all privileges on seahub_db.* to seacloud@localhost identified by 'StrongDBPassw0rd';
flush privileges;
exit

ステップ 5: CentOS 8 に Seafile をインストールする

Seafile を /var/www パスにインストールします。

sudo mkdir -p /var/www/seafile
cd /var/www/seafile

wgetコマンドでSeafileをダウンロードし、ダウンロードしたアーカイブを解凍します。

sudo dnf install -y wget
wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_8.0.7_x86-64.tar.gz

ダウンロードしたファイルを解凍します

sudo tar xvf seafile-server_8.0.7_x86-64.tar.gz

ディレクトリの名前を「seafile-server」に変更し、そのディレクトリに切り替えます。

sudo mv seafile-server-8.0.7/ seafile-server
sudo rm -f seafile-server_8.0.7_x86-64.tar.gz

ステップ 6: CentOS 8 で Seafile を構成する

setup-seafile-mysql.sh」ファイルを実行してデータベースを設定します。

$ cd  seafile-server
$ sudo ./setup-seafile-mysql.sh

Checking python on this machine ... 
----------------------------------------------------------------- 
This script will guide you to setup your seafile server using MySQL. 
Make sure you have read seafile server manual at 

       https://download.seafile.com/published/seafile-manual/home.md 

Press ENTER to continue 
----------------------------------------------------------------- 
What is the name of the server? It will be displayed on the client. 
3 - 15 letters or digits 
[ server name ] seafile 
What is the ip or domain of the server? 
For example: www.mycompany.com, 192.168.1.101 
[ This server's ip or domain ] seafile.example.com

Which port do you want to use for the seafile fileserver? 
[ default "8082" ]  

------------------------------------------------------- 
Please choose a way to initialize seafile databases: 
------------------------------------------------------- 

[1] Create new ccnet/seafile/seahub databases 
[2] Use existing ccnet/seafile/seahub databases 

[ 1 or 2 ] 2 

What is the host of mysql server? 
[ default "localhost" ]  press Enter

What is the port of mysql server? 
[ default "3306" ]  Press Enter

Which mysql user to use for seafile? 
[ mysql user for seafile ] seacloud

What is the password for mysql user "seahub"? 
[ password for seahub ]  StrongDBPassw0rd
                                                                                                                 
verifying password of user seacloud ...  done 

Enter the existing database name for ccnet: 
[ ccnet database ] ccnet_db 

verifying user "seacloud" access to database ccnet_db ...  done 

Enter the existing database name for seafile: 
[ seafile database ] seafile_db 

verifying user "seacloud" access to database seafile_db ...  done 

Enter the existing database name for seahub: 
[ seahub database ] seahub_db 

verifying user "seacloud" access to database seahub_db ...  done 

--------------------------------- 
This is your configuration 
--------------------------------- 

   server name:            seafile 
   server ip/domain:       seafile.example.com 

   seafile data dir:       /var/www/seafile/seafile-data 
   fileserver port:        8082 

   database:               use existing 
   ccnet database:         ccnet_db 
   seafile database:       seafile_db 
   seahub database:        seahub_db 
   database user:          seacloud 
--------------------------------- 
Press ENTER to continue, or Ctrl-C to abort

--------------------------------- 

Generating ccnet configuration ... 

done 
Successly create configuration dir /var/www/seafile/ccnet. 
Generating seafile configuration ... 

Done. 
done 
Generating seahub configuration ... 
---------------------------------------- 
Now creating ccnet database tables ... 

---------------------------------------- 
---------------------------------------- 
Now creating seafile database tables ... 

---------------------------------------- 
---------------------------------------- 
Now creating seahub database tables ... 

---------------------------------------- 

creating seafile-server-latest symbolic link ...  done 

----------------------------------------------------------------- 
Your seafile server configuration has been finished successfully. 
----------------------------------------------------------------- 

run seafile server:     ./seafile.sh { start | stop | restart } 
run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> } 

----------------------------------------------------------------- 
If you are behind a firewall, remember to allow input/output of these tcp ports: 
----------------------------------------------------------------- 

port of seafile fileserver:   8082 
port of seahub:               8000 

When problems occur, Refer to 

       https://download.seafile.com/published/seafile-manual/home.md 

for information. 

これで、seafile サービスと seahub サービスを開始できるようになりました。以下のコマンドで seafile を起動します。

$ sudo ./seafile.sh start
[08/17/20 11:16:33] ../common/session.c(148): using config file /var/www/seafile/conf/ccnet.conf 
Starting seafile server, please wait ... 
** Message: seafile-controller.c(563): No seafevents. 

Seafile server started 

Done.

Seahubサービスを開始する

$ sudo ./seahub.sh start
LC_ALL is not set in ENV, set to en_US.UTF-8 
Starting seahub at port 8000 ... 

---------------------------------------- 
It's the first time you start the seafile server. Now let's create the admin account 
---------------------------------------- 

What is the email for the admin account? 
[ admin email ] [email  

What is the password for the admin account? 
[ admin password ]  Enter Admin password

Enter the password again: 
[ admin password again ]  Repeat Admin password
----------------------------------------
Successfully created seafile admin
----------------------------------------

Seahub is started

Done.

ステップ 7: ファイアウォールを構成する

ファイルウォールがアクティブな場合は、必ずファイアウォールを介して Seafile ポートを開いてください。

sudo firewall-cmd --permanent --add-port=8000/tcp
sudo firewall-cmd --permanent --add-port=8082/tcp
sudo firewall-cmd --reload

ステップ 8: ブラウザで Seafile にアクセスする

ポート 8000 のホスト名/IP アドレスを使用して、ブラウザから seafile にアクセスします: http://:8000。 seafile がブラウザに読み込まれていないことがわかった場合は、seafile gunicorn の設定を確認してください。以下に示すように、ローカル IP アドレスにバインドされていないことを確認してください。

$ sudo vim /var/www/seafile/conf/gunicorn.conf.py
# default localhost:8000 
#bind = 127.0.0.1:8000
bind = "0.0.0.0:8000"

その後、seahubサービスを再起動します

$ sudo ./seahub.sh restart
Stopping seahub ...
Starting seahub at port 8000 ...

Seahub is started

Done.

ファイルを保存すると、ブラウザ上で seafile を起動できるようになります。以下のようなページが表示されるはずです。

前に構成した管理者の資格情報を使用してログインすると、次のようなページが表示されるはずです。

新しいフォルダー/ファイルの追加を開始するには、[新しいライブラリ] をクリックし、新しいフォルダーの名前を指定して、[送信] をクリックします。

新しいライブラリを選択し、フォルダー/ファイルを作成またはアップロードできるはずです。

ステップ 9: Seafile クライアントを構成する

Ubuntu 20.04 クライアント マシンを使用して、Seafile サーバーへの接続をテストします。

Ubuntu 20.04 で Seafile に接続するには、まず以下のコマンドを実行して Ubuntu 20.04 に Seafile クライアントをインストールします。

sudo wget https://linux-clients.seafile.com/seafile.asc -O /usr/share/keyrings/seafile-keyring.asc
sudo bash -c "echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/focal/ stable main' > /etc/apt/sources.list.d/seafile.list"
sudo apt update
sudo apt install -y seafile-gui

cli でのみ使用する場合は、次のコマンドを実行します。

sudo apt-get install seafile-cli

インストールしたら、アプリケーションで seafile client を検索すると表示されるはずです。

ダブルクリックしてライブラリのフォルダーを開き、選択して「次へ」をクリックします

次に、接続する Seafile サーバーの詳細を指定します。

[ログイン] をクリックすると、次のように Seafile サーバーに接続されるはずです。

それでおしまい。 Seafile インストールをお楽しみください。ブログがお役に立てば幸いです。以下のさらに興味深いガイドをチェックしてください。

  • Nextcloud VS owncloud VS Seafile VS Syncthing
  • Centos 8 に Pydio Cells ファイル共有をインストールする
  • Ubuntu 20.04 に Pydio Cells ファイル共有をインストールする
  • CentOS 8/CentOS 7 での Syncthing のインストールと構成
  • Debian 10 (Buster) に Nextcloud 19 をインストールして構成する
  • Let’s Encrypt を使用して Nextcloud を CentOS 7 にインストールする

関連記事: