How To Install Seafile on Rocky Linux 9
In this tutorial, we will show you how to install Seafile on Rocky Linux 9. Are you looking for a secure and reliable cloud storage solution? Seafile might be just what you need. With the ability to store and share files across devices, as well as providing backup and syncing features, Seafile is a popular choice for businesses and individuals alike. One of the benefits of using Seafile on Rocky Linux 9 is the added security that comes with the operating system. Rocky Linux 9 is a community-driven enterprise-level Linux distribution that emphasizes stability and security. By hosting Seafile on Rocky Linux 9, you can enjoy peace of mind knowing that your files are stored on a secure platform.
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 the Seafile on Rocky Linux. 9.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- 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 Rocky Linux 9
Step 1. First, update the system packages by running the following command:
sudo dnf update sudo dnf install epel-release
Step 2. Installing Seafile Dependencies.
Seafile is written in the Python Django framework, you need to install its dependencies and Python packages to make it work. Run the following command to install Python tools, Pip package manager, SQL libraries, and Memcached:
sudo dnf install python3 python3-devel python3-imaging MySQL-python3 python3-simplejson python3-setuptools mariadb mariadb-server nginx gcc mysql-devel
Next, Install Python-required modules using 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
Step 3. Installing MariaDB Database on Rocky Linux 9.
By default, MariaDB is available on Rocky Linux 9 base repository. Now run the following command below to install the latest stable version of MariaDB to your system:
sudo dnf install mariadb-server mariadb
Once the installation is complete, start the MariaDB service and enable it to automatically start on boot by running the following command below:
sudo systemctl enable mariadb --now sudo systemctl start mariadb sudo systemctl status mariadb
To check the version of MariaDB installed, run the command below:
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
Next, create databases for Seafile major components i.e ccnet
, seafile
and seahub
:
CREATE DATABASE ccnet_server; CREATE DATABASE seahub_server; CREATE DATABASE seafile_server;
Then create a database user and grant him privileges to the databases:
CREATE USER 'seafile'@'localhost' IDENTIFIED BY 'your-strong-passwd';
Next, grant him all privileges to the databases:
GRANT ALL PRIVILEGES ON ccnet_server.* TO 'seafile'@'localhost'; GRANT ALL PRIVILEGES ON seahub_server.* TO 'seafile'@'localhost'; GRANT ALL PRIVILEGES ON seafile_server.* TO 'seafile'@'localhost';
Step 3. Installing Seafile on Rocky Linux 9.
Now go to the Seafile download page and grab the download link for Seafile latest version:
wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_10.0.1_x86-64.tar.gz
Next, extract your tar file to /srv
directory:
sudo tar -xvf seafile-server_10.0.1_x86-64.tar.gz -C /srv sudo mv /srv/seafile-server_10.0.1 /srv/seafile
Run the installation script. No installation is needed, just extract and run the setup script:
cd /srv/seafile sudo ./setup-seafile-mysql.sh
Follow the prompts to set up your Seafile server using MariaDB.
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 -----------------------------------------------------------------
Next, configure your Seafile server by providing a name for your server, a domain name:
What is the name of the server? It will be displayed on the client. 3 - 15 letters or digits [ server name ] idroot What is the ip or domain of the server? For example: www.idroot.us, 192.168.1.101 [ This server's ip or domain ] seafile.idroot.us Which port do you want to use for the seafile fileserver? [ default "8082" ]
Next, you will be asked to choose a way to initialize Seafile databases:
------------------------------------------------------- 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
Next, you will be asked to enter the database details for Seafile:
What is the host of mysql server? [ default "localhost" ] What is the port of mysql server? [ default "3306" ] Which mysql user to use for seafile? [ mysql user for seafile ] seafile What is the password for mysql user "seafile"? [ password for seafile ] verifying password of user seafile ... done Enter the existing database name for ccnet: [ ccnet database ] ccnet_server verifying user "seafile" access to database ccnet_db ... done Enter the existing database name for seafile: [ seafile database ] seafile_server verifying user "seafile" access to database seafile_db ... done Enter the existing database name for seahub: [ seahub database ] seahub_server verifying user "seafile" access to database seahub_db ... done
You will be shown your Seafile configurations. Press the ENTER key to continue the installation:
--------------------------------- This is your configuration --------------------------------- server name: idroot server ip/domain: seafile.idroot.us seafile data dir: /opt/seafile/seafile-data fileserver port: 8082 database: use existing ccnet database: ccnet_server seafile database: seafile_server seahub database: seahub_server database user: seafile --------------------------------- Press ENTER to continue, or Ctrl-C to abort ---------------------------------
You will see the following screen if the installation was successful:
Generating ccnet configuration ... Generating seafile configuration ... 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.
Finally, start Seafile Server services to help us with file uploads, file downloads, and file synchronization:
cd /srv/seafile/ sudo ./seafile.sh start
Now start the Seahub web UI services:
cd /srv/seafile/ sudo ./seahub.sh start
Output:
---------------------------------------- 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 ] ngadimin@idroot.us 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.
Step 4. Create Seafile Systemd Service.
Now we set up the Seafile and Seahub as a systemd
service:
sudo tee /etc/systemd/system/seafile.service<<EOF [Unit] Description=Seafile After= mysql.service After=network.target [Service] Type=forking ExecStart=/srv/seafile-server-latest/seafile.sh start ExecStop=/srv/seafile-server-latest/seafile.sh stop [Install] WantedBy=multi-user.target EOF
Create a systemd unit file for Seahub web UI:
sudo tee /etc/systemd/system/seahub.service<<EOF [Unit] Description=Seafile After= mysql.service After=network.target [Service] Type=forking ExecStart=/srv/seafile-server-latest/seahub.sh start ExecStop=/srv/seafile-server-latest/seahub.sh stop [Install] WantedBy=multi-user.target EOF
Step 5. Configure Firewall.
By default, the firewall is enabled on Rocky Linux. The default port for Seafile is port number 8082
while the default port for Seahub is port 8000
. To allow the ports through the firewall, issue the command below:
sudo firewall-cmd --zone=public --add-port=8000/tcp --permanent sudo firewall-cmd --zone=public --add-port=8082/tcp --permanent sudo firewall-cmd --reload
Step 6. Accessing Seafile Web Interface.
Once successfully installed, open your web browser and access the Seafile web interface using the URL http://seafile.idroot.us:8000
. You should see the following page:
Congratulations! You have successfully installed Seafile. Thanks for using this tutorial for installing Seafile on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Seafile website.