Seafile is an open source cloud storage system for storing files on the Seafile server and synchronize the files between multiple computers or mobile devices using the Seafile client. Using Seafile you can also create groups with file syncing and start discussions with your team to enable easy collaboration.
In this tutorial, we will show you how to install Seafile on a Debian 9 Linux virtual server with MySQL.
Install dependencies
Log in to your Debian 9 VPS via SSH as user root and make sure that all packages are up-to-date.
ssh root@Server_IP_Address -p Port_Number
apt-get update apt-get upgrade
Install the following dependencies needed by Seafile:
apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 ffmpeg python-pip python-mysqldb python-memcache python-requests pip install pillow moviepy
Install MySQL server
We will use MySQL as a database back-end for Seafile. If you already don’t have MySQL installed on your Debian 9 server you can install it by running the following command:
apt-get install mysql-server
When the MySQL installation is complete, issue the following command to secure your MySQL installation:
sudo mysql_secure_installation
Install Seafile
At the moment of writing this article, the latest stable version of Seafile is version 6.3.4.
Download the Seafile archive from their official website using the following command:
mkdir /opt/seafile cd /opt/seafile wget https://download.seadrive.org/seafile-server_6.3.4_x86-64.tar.gz
Once the download is complete run the following command to unpack the tar archive:
tar -xzf seafile-server_4.0.6_x86-64.tar.gz
Navigate to the seafile directory and run the setup script:
cd seafile-server-* ./setup-seafile-mysql.sh
The script will check your server and prompt you to press ENTER to continue
Checking python on this machine ... Checking python module: setuptools ... Done. Checking python module: python-imaging ... Done. Checking python module: python-mysqldb ... Done. ----------------------------------------------------------------- This script will guide you to setup your seafile server using MySQL. Make sure you have read seafile server manual at https://github.com/haiwen/seafile/wiki Press ENTER to continue -----------------------------------------------------------------
Next, you will be prompted to enter several information needed to configure Seafile, such as server name, IP address, listening port and seafile data directory.
What is the name of the server? It will be displayed on the client. 3 - 15 letters or digits [ server name ] my-server What is the ip or domain of the server? For example: www.mycompany.com, 192.168.1.101 [ This server's ip or domain ] my-seafile.com Where do you want to put your seafile data? Please use a volume with enough free space [ default "/opt/seafile-data" ] Which port do you want to use for the seafile fileserver? [ default "8082" ]
When asked to choose a way to initialize Seafile databases, select 1 .
------------------------------------------------------- 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 ] 1
Enter your MySQL root password when prompted and the script will create the necessary databases.
What is the host of mysql server? [ default "localhost" ] What is the port of mysql server? [ default "3306" ] What is the password of the mysql root user? [ root password ] verifying password of user root ... verifying password of user root ... done Enter the name for mysql user of seafile. It would be created if not exists. [ default "seafile" ] Enter the password for mysql user "seafile": [ password for seafile ] Enter the database name for ccnet-server: [ default "ccnet-db" ] Enter the database name for seafile-server: [ default "seafile-db" ] Enter the database name for seahub: [ default "seahub-db" ] --------------------------------- This is your configuration --------------------------------- server name: seafile server ip/domain: my-seafile.com seafile data dir: /opt/seafile/seafile-data fileserver port: 8082 database: create new ccnet database: ccnet-db seafile database: seafile-db seahub database: seahub-db database user: seafile
Once the installation is completed the script will show the following output:
Generating ccnet configuration ... done Successly create configuration dir /opt/ccnet. Generating seafile configuration ... Done. done Generating seahub configuration ... ---------------------------------------- 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 | stop | restart } ----------------------------------------------------------------- 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://github.com/haiwen/seafile/wiki for information.
You can now start SeaFile and SeaHub scripts and create your new SeaFile admin user:
./seafile.sh start
[10/20/18 14:48:18] ../common/session.c(132): using config file /opt/conf/ccnet.conf Starting seafile server, please wait ... Seafile server started Done.
./seahub.sh start
LANG is not set in ENV, set to en_US.UTF-8 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 protected] What is the password for the admin account? [ admin password ] Enter the password again: [ admin password again ] ---------------------------------------- Successfully created seafile admin ---------------------------------------- Seahub is started Done.
Once the Seahub server is started, you can access Seafile at http://your_domain_or_ip.com:8000 and log in with your admin account.
Create systemd unit
We will create a systemd unit files to be able to start all Seafile services at system boot.
nano /etc/systemd/system/seafile.service
Paste the following lines:
[Unit] Description=Seafile # add mysql.service or postgresql.service depending on your database to the line below After=network.target [Service] Type=forking ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop User=seafile Group=seafile [Install] WantedBy=multi-user.target
nano /etc/systemd/system/seahub.service
[Unit] Description=Seafile hub After=network.target seafile.service [Service] Type=forking # change start to start-fastcgi if you want to run fastcgi ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop User=seafile Group=seafile [Install] WantedBy=multi-user.target
Once the unit files are created enable the services to start on system boot by running the following commands:
sudo systemctl enable seafile.service sudo systemctl enable seahub.service
That is it, SeaFile has been successfully installed on your Debian 9 server.
You don’t need to Install Seafile on Debian 9 if you use one of our Seafile Hosting Services, in which case you can simply ask our expert Linux admins to set up Seafile on your Debian 9 server for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on How To Install Seafile on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
I would add https to the howto 🙂
THX a lot for sharing the solution.
I would also like to see a https solusion.
otherwise great guide! thumbs upp 🙂