1. Install and download the necessary packages
First, install some packages that Seafile needs from the console:
sudo apt-get install -y python3 python3-setuptools python3-pip libmariadb-dev libmariadb-dev-compat && sudo apt-get install -y memcached libmemcached-dev
We install other required packages with:
sudo pip3 install --timeout=3600 django==3.2. future==0.18. mysqlclient==2.1. pymysql pillow==9.3. pylibmc captcha==0.4 markupsafe==2.0.1 jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django_simple_captcha==0.5. pycryptodome==3.16. cffi==1.15.1 lxml
Now create the new user seafile:
sudo adduser seafile
Then create a new folder, distribute the rechete and enter it:
mkdir /opt/seafile && cd /opt/seafile && chown -R seafile: /opt/seafile
Now we continue as user seafile:
su seafile
Now look for the current server download. To do this, go to the Seafile page on your PC. If you are using the Raspberry Pi, you will need the download link given there (click on "Latest version" > file under "Assets" or similar > link something like "seafile-server_8.0.5_stable_pi.tar.gz"), otherwise the one for a 64bit Linux for example. Now you need to enter this download link and execute the following command on the Raspberry Pi:
sudo wget [INSERT DOWNLOAD LINK HERE] && sudo tar -xzvf *tar.gz
Now view all the files in this folder:
ls
You should see something like "seafile-server-9.0.10" (or another version at the end) in the following list. You can now automatically navigate to this directory with the following command:
cd seafile-server-*
2. Setting up MySQL for Seafile
We will now let Seafile set up the MySQL database. This requires both the MySQL root password and the MySQL cloud user and password. You have already set up the credentials. Run the appropriate script:
sudo ./setup-seafile-mysql.sh
You will be asked for the following information:
-
server name: Think of a name for your server, for example "my-cloud"
-
ip or domain of the server: Enter your server host here, e. g. yourhost.dyndns.com
-
where to put seafile data: If you don't want to use an external storage medium for your data, press [Enter] again
-
port for the seafile fileserver: [Enter]
-
1 or 2: If this question appears, type 1 and press [Enter] to confirm (rebuild databases)
-
host of mysql server: localhost
-
port of mysql server: 3306
-
password of the mysql root user: as specified earlier
-
mysql user of seafile: Your MySQL username, such as the one you created in our Raspberry Pi tutorial ...
-
passwort for mysql user: ... and the corresponding password.
-
(3x) database name: press [Enter] each time.
When the configuration is displayed again, confirm with [Enter].
This completes the setup of the MySQL databases for Seafile.
3. Enable SSL support
Now open a configuration file:
sudo vi ../conf/seahub_settings.py
Use the arrow keys to navigate to the appropriate line and change "http" to "https":
SERVICE_URL = "https://[YOURHOST.DYNDNS.COM]/"
Save this file with [Esc] and ":wq" and [Enter].
4. Creating a seafile administrator
First, we need to make sure that the seafile user owns all the files we have placed in his home directory:
sudo chown -R seafile: /opt/seafile/
Start Seafile and Seahub (web interface) as seafile user with the following commands:
sudo -u seafile ./seafile.sh start && sudo -u seafile ./seahub.sh start
You will now be asked for an email address and password. Set these as you wish, but be sure to choose a secure password and remember it. You can use this administrator account to manage Seafile later.
We will now stop both services to finish configuring Nginx:
sudo -u seafile ./seafile.sh stop && sudo -u seafile ./seahub.sh stop
5. Nginx configuration
We have also created a configuration file for you to configure Nginx for Seafile. Replace ||HOST|| with your host in the file provided here
https://www.sim-networks.com/user/assets/getnginxconfig_seafile.txt
and use its contents as server settings (the following command opens the contents of the file):
sudo nano /etc/nginx/sites-enabled/default
Important: If you did not follow our Raspberry Pi instructions, make sure the files /var/www/ssl/cloudssl.crt and /var/www/ssl/cloudssl.key and /var/www/ssl/dhparam.pem exist and are certificate files for your SSL certificate.
We will now restart the Nginx web server:
sudo service nginx restart
6. Set up the seafile user and service
Now we want to make sure that the Seafile services are started when the system boots. The following method is only supported by newer operating systems (at least Debian 8 or Ubuntu 15.04).
Download 2 pre-configured files from our server. We will start with the first file with the following command:
sudo wget -q -O /etc/systemd/system/seafile.service - https://eigene-cloud-einrichten.de/getSeafileService
This is followed by the second file, which is backed up with the following command:
sudo wget -q -O /etc/systemd/system/seahub.service - https://eigene-cloud-einrichten.de/getSeahubService
Finally, we need to make sure that the files we have created are run at boot time:
sudo systemctl enable seafile.service && sudo systemctl enable seahub.service
Now we can start Seafile:
sudo -u seafile ./seafile.sh start && sudo -u seafile ./seahub.sh start
You should now be able to login to Seafile via the web interface by entering your host. If you are using a self-signed SSL certificate - as in the Raspberry Pi tutorial - bypass the browser warning by adding a security exception rule. Alternatively, you can set up a free Let'sEncrypt certificate, e. g. by following these instructions.
If you are having problems with Seafile, a reboot may help:
sudo shutdown -r now
7. Sharing another port
To use Seafile correctly on a home server, you need to open another port through your router. Follow this section of the general tutorial and also open up port 8082.
8. Update Seafile (later required)
If you want to update Seafile to the latest version, you can follow the steps below, if the update is not possible via the interface.
In short:
- Change to the correct directory with cd /opt/seafile
- Download and unpack the next higher version of Seafile, e.g. if you are using Seafile 6.0, first download version 6.1, then do the same for 6.2 to upgrade to 6.2 (see Download section).
- Exit Seafile & Seahub (as described above).
- Find the appropriate upgrade file as described here and run it.
- You can then restart Seafile as described above.
9. Troubleshooting
If you encounter any errors, you can currently view any error messages from the /opt/seafile/ folder using the following command:
sudo -u seafile ./seahub.sh start-fastcgi
An error that has been occurring more frequently lately has to do with an incorrect version name. You can find out how to change the configuration file here.