How To Install Seafile on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install Seafile on Ubuntu 22.04 LTS. If you’re looking for an easy and secure way to sync and share files on your Ubuntu system, Seafile Ubuntu is a solution worth exploring. Seafile is a self-hosted file syncing and collaboration platform that operates similarly to Dropbox or Google Drive, except that users have complete control over their data and the potential to save money by eliminating third-party subscription fees.
Seafile Ubuntu offers a range of features that ensure data privacy and security, such as end-to-end encryption, two-factor authentication, and the ability to self-host on your own server. Plus, the platform is highly scalable, meaning it can accommodate large teams and come in handy for a plethora of applications, from small startups to global enterprises. With Seafile, you can effortlessly sync and share files across multiple devices and collaborate with other team members, regardless of their locations.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Seafile on Ubuntu 22.04. You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Seafile.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Seafile on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing Required Dependencies.
Seafile requires a few dependencies to be installed on your system. To install them, run the following command in the terminal:
sudo apt install python3 python3-setuptools python3-pip python3-mysqldb python3-dev python3-ldaplib python3-urllib3 python3-requests
Step 3. Installing MariaDB.
By default, the MariaDB is available on Ubuntu 22.04 base repository. Now run the following command below to install the latest version of MariaDB to your Ubuntu system:
sudo apt install mariadb-server mariadb-client
After successful installation, enable MariaDB (to start automatically upon system boot), start, and verify the status using the commands below:
sudo systemctl enable mariadb sudo systemctl start mariadb sudo systemctl status mariadb
Confirm the installation and check the installed build version of MariaDB:
mariadb --version
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Set root password? [Y/n] y - 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
Now log in to the MariaDB console and create a database for the Seafile. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. We will create a database for each of these server components.
MariaDB [(none)]> CREATE DATABASE seafile_server; MariaDB [(none)]> CREATE DATABASE ccnet_server; MariaDB [(none)]> CREATE DATABASE seahub_server;
Then, create a database user and grant privileges for created databases:
MariaDB [(none)]> CREATE USER 'seafile'@'localhost' IDENTIFIED BY 'Your-Strong-Password'; MariaDB [(none)]> GRANT ALL ON seafile_server.* TO 'seafile'@'localhost'; MariaDB [(none)]> GRANT ALL ON ccnet_server.* TO 'seafile'@'localhost'; MariaDB [(none)]> GRANT ALL ON seahub_server.* TO 'seafile'@'localhost'; MariaDB [(none)]> QUIT;
For additional resources on installing MariaDB, read the post below:
Step 4. Installing Seafile on Ubuntu 22.04.
By default, Seafile is not available on Ubuntu 22.04 base repository. Now run the following command below to download the latest stable version of Seafile to your Ubuntu system:
wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_10.0.1_x86-64.tar.gz
Next, extract the package by executing the following command:
tar -xzf seafile-server_10.0.1_x86-64.tar.gz
Move into the extracted directory:
cd seafile-server-10.0.1/
Run the installation script:
./setup-seafile-mysql.sh
Follow the prompts to configure Seafile with your preferred settings.
Once done, now switch to the /opt/seafile/seafile-server-latest
directory:
cd /opt/seafile/seafile-server-latest
Run the following command to start the Seaf-server:
./seafile.sh start
Also, run the following command to start Seahub:
./seahub.sh start
Step 5. Create Seafile Systemd Service.
Now we create and open the /etc/systemd/system/seafile.service
file for editing:
nano /etc/systemd/system/seafile.service
Add the following file:
[Unit] Description=Seafile # add mysql.service or postgresql.service depending on your database to the line below After=network.target mysql.service [Service] Type=forking ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop LimitNOFILE=infinity User=seafile Group=seafile [Install] WantedBy=multi-user.target
Save and close the file, then create and open the /etc/systemd/system/seahub.service
file for editing:
nano /etc/systemd/system/seahub.service
Add the following file:
[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
Save and close the file, then reload the systemd
manager so that the changes take place:
sudo systemctl daemon-reload sudo systemctl enable --now seafile sudo systemctl enable --now seahub
Step 6. Installing Nginx.
By default, the Nginx is available on Ubuntu 22.04 base repository. Now run the following command below to install the latest version of Nginx to your Ubuntu system:
sudo apt install nginx
After successful installation, enable Nginx (to start automatically upon system boot), start, and verify the status using the commands below:
sudo systemctl enable nginx sudo systemctl start nginx sudo systemctl status nginx
Confirm the installation and check the installed build version of Nginx:
nginx -v
Now we create a new configuration file under /etc/nginx/conf.d/seafile.conf
with the following commands:
server {
listen 80;
listen [::]:80;
server_name seafile.your-domain.com;
autoindex off;
client_max_body_size 100M;
access_log /var/log/nginx/seafile.com.access.log;
error_log /var/log/nginx/seafile.com.error.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
location /media {
root /srv/seafile-server-latest/seahub;
}
}
Save and close the file, then restart the Nginx web server so that the changes take place:
nginx -t sudo systemctl restart nginx
Step 7. Configure Firewall.
Ubuntu 22.04 has ufw
a firewall running by default. Enable connection through ports 80
HTTP and 443
HTTPS:
sudo ufw allow 'Nginx FULL' sudo ufw enable sudo ufw status
Step 8. Accessing Seafile Web Interface.
Once successfully installed, you can access the Seafile web interface using your preferred web browser. Open the browser and enter the following address:
http://seafile.your-domain.com
You should see the following page:
Congratulations! You have successfully installed Seafile. Thanks for using this tutorial for installing the Seafile on the Ubuntu system. For additional help or useful information, we recommend you check the official Seafile website.