Getting Started With Seafile On Ubuntu

What is Seafile

In my view, Seafile is a replacement to dropbox with the following advantages:

  • Free - (the software, you'll pay for the VPS)
  • Storage only limited by your servers disk capacity.
  • You know where the data is stored and how it is stored (redundancy level, encryption, user access etc)
  • Seafile provides end-to-end encryption.
  • Similar sharing capabilities/accounts as dropbox, except they have to be registered on the same server.

You don't lose these features that dropbox has either:

  • Same drag-and-drop folder behaviour with auto synchronization.
  • Client is available on Windows, Linux, Mac, IOS, and Android.

Setup Instructions

    Prepare the Server

    Login to your server with SSH
    Install relevant packages. For this tutorial we will be setting up on a new MySQL server.
    sudo apt-get update
    sudo apt-get install \
    mysql-server \
    python-imaging \
    python-mysqldb \
    python-setuptools \
    python-simplejson \
    -y
    
    secure the mysql database
    sudo mysql_install_db
    sudo mysql_secure_installation
    
    Create a seafile subuser with the home directory at /home/seafile
    Login as that user and navigate to your home directory:
    cd $HOME

    Install Seafile

    Download the Seafile Server Installation.
    wget https://bitbucket.org/haiwen/seafile/downloads/seafile-server_3.1.2_x86-64.tar.gz
    It's a good idea to check Seafile's download page as this tutorial may not be fully up-to-date
    Extract the download.
    tar --extract --gzip --file seafile-server*
    rm seafile-server*.tar.gz
    Run the installation and answer all the questions.
    cd seafile-server-*
    ./setup-seafile-mysql.sh
    Start the seafile services
    ./seafile.sh start
    ./seahub.sh start
    

    Optional - Create Startup Script

    If your server reboots, you will need to manually run the previous step to get seafile running again. Alternatively, if you run the following script then seafile will automatically start on reboot.
    # Create the startup script
    echo "sleep 5
    /bin/bash $HOME/seafile-server-3.1.2/seafile.sh start
    /bin/bash $HOME/seafile-server-3.1.2/seahub.sh start" | tee startup.sh
    
    # Add the startup script to cron
    crontab -l | tee /tmp/cronfile.txt
    echo "@reboot /bin/bash $HOME/startup.sh 2> startup.errors.log > startup.log" >> /tmp/cronfile.txt
    crontab /tmp/cronfile.txt
    
    If seafile fails to start, you should be able to look at the logs in startup.log and startup.errors.log which will contain information about the last startup.

Firewall

If you need to open up your firewall to allow seafile to work, then the list of TCP ports is below

Seahub 8000
HttpServer 8082
Ccnet Daemon 10001
Seafile Daemon 12001

iptables Rules

iptables -A INPUT -p tcp --dport 8000 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 8082 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 10001 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 12001 -m state --state NEW,ESTABLISHED -j ACCEPT

Client Setup

    Go to the seafile download page and download the appropriate client
    Start the seafile client
    Enter the IP/domain name, admin email address from the server setup, and the relevant password. Make sure to add the http:// in the address, otherwise it will not work!

Libraries

Seafile data is organized into libraries. Libraries allow you to organize your data into different categories. E.g. some data you will access to at work, and some data should only be accessible at home. Some data needs to be encrypted, whereas other data needs to be easily shareable without passwords. You might have a library for a team project that five of your colleagues have access to, and another library project that is accessible by everyone in the company. Libraries also allow you to not waste space on your computers downloading everything. Only download/sync what you need.

    Add a Library

    To add a library (a top level directory that can be chosen to be synced or not to a client), click the address in the client application in order to launch a browser to your seafile server.
    Click the "New Library" button.
    Fill in the appropriate details. The main choice here is whether to keep it encrypted or not. If it is encrypted, then the files will be kept encrypted on the server and a password will be asked for whenever the library is synced down for the first time with the client, or accessed through the web browser.
    Now you should be able to sync that library into your local seafile directory by right clicking on it in the client and selecting "sync now".

References

No comments:

Post a Comment