# Install Seafile Server on Linux

## What is Seafile?

> Seafile is an open source file sync&share solution designed for high reliability, performance and productivity. Sync, share and collaborate across devices and teams. Build your team's knowledge base with Seafile's built-in Wiki feature. - https://seafile.com/

## Installing Seafile

1. Log into the Linux device
2. Run the following commands in terminal:
   # update software repositories
   sudo apt update
   # install available software updates
   sudo apt upgrade
   # install prerequisites
   sudo apt install python3 python3-setuptools python3-pip default-libmysqlclient-dev libmemcached-dev zlib1g-dev -y
   # install MariaDB/MySQL
   sudo apt install mariadb-server mariadb-client -y
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type N and press Enter to switch to unix_socket authentication
5. Type Y and press Enter to set a root password, type the password twice to confirm
6. Type Y and press Enter to remove anonymous users
7. Type Y and press Enter to disallow root login remotely
8. Type Y and press Enter to remove the test database
9. Type Y and press Enter to reload privilege tables
10. Continue with the following commands:
    # exit mysql prompt
    exit
    # install python prerequisites
    sudo pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient
    # create installation directory
    sudo mkdir /opt/seafile
    # change to installation directory
    cd /opt/seafile
    # create seafile user
    sudo adduser seafile
    # set seafile as owner of the installation directory
    sudo chown -R seafile: /opt/seafile
    # change to the seafile user
    sudo su seafile
    # download seafile
    wget -O seafile.tar.gz https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_9.0.0_x86-64.tar.gz
    # extract the downloaded archive
    tar xf seafile.tar.gz
    # change directory into the extracted folder
    cd seafile-server-9.0.0
    # run the seafile installation script
    ./setup-seafile-mysql.sh
11. When prompted, enter the server name, IP address and port 8082
12. When prompted, complete the MySQL configuration as follows:

    mysql server host: localhost
    mysql server port: 3306
    mysql root password: <%root password set earlier%>
    mysql user for Seafile: seafile_rw
    mysql password for Seafile: $eafiL3!!
    database name: ccnet-db
    seafile database name: seafile-db
    seahub database name: seahub-db

13. Continue with the following command:
    # edit gunicorn.conf.py
    nano /opt/seafile/conf/gunicorn.conf.py
14. Press CTRL + W and search for bind =
15. Change the value to 0.0.0.0:8000
16. Press CTRL+O, Enter, CTRL+X to write the changes
17. Continue with the following commands:
    # start seaf-server
    ./seafile.sh start
    # start seahub
    ./seahub.sh start
18. When prompted, enter an administrator email and password
19. Open a web browser and navigate to http://DNSorIP:8000
20. Login with the email and password setup earlier
21. Welcome to Seafile

Source: https://manual.seafile.com/deploy/using_mysql/