How to Install Seafile in Ubuntu

To Install Seafile in Ubuntu

Seafile client is file hosting software, synchronises the files that are stored on a central server. It allows the users to create their own private cloud in a secure way. The seafile functions are similar to the popular cloud storage like Dropbox and Google drive.


Installation of Seafile

Install the dependency packages that are required for installing seafile.

root@linuxhelp1:~# apt-get install openjdk-8-jre poppler-utils libreoffice libreoffice-script-provider-python libpython2.7 python-pip mysql-server python-setuptools python-imaging python-mysqldb python-memcache ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy python-pip apache2 -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libpython2.7 is already the newest version (2.7.12-1~16.04).
libpython2.7 set to manually installed.
The following packages were automatically installed and are no longer required:
  libpango1.0-0 libpangox-1.0-0
Use ' sudo apt autoremove'  to remove them.
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils ca-certificates-java fonts-dejavu fonts-dejavu-extra fonts-sil-gentium
  fonts-sil-gentium-basic fonts-wqy-microhei fonts-wqy-zenhei java-common libaio1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap libbonobo2-0 libbonobo2-common libevent-core-2.0-5 libexpat1-dev libgif7 libgnome-2-0 libgnome2-common
  libgnomevfs2-0 libgnomevfs2-common libhsqldb1.8.0-java libhtml-template-perl liblua5.1-0 libmysqlclient20 liborbit-2-0
  libpython-all-dev libpython-dev libpython2.7-dev libreoffice-base libreoffice-base-drivers libreoffice-java-common
  libreoffice-report-builder-bin libreoffice-sdbc-firebird libreoffice-sdbc-hsqldb libservlet3.1-java mysql-client-5.7
  mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 openjdk-8-jre-headless python-all python-all-dev
  python-dev python-pil python-pip-whl python-pkg-resources python-six python-wheel python2.7-dev
.
.
.
Adding debian:China_Internet_Network_Information_Center_EV_Certificates_Root.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:StartCom_Certification_Authority_G2.pem
Adding debian:Swisscom_Root_EV_CA_2.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
done.
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for ca-certificates (20160104ubuntu1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed  done.
Running hooks in /etc/ca-certificates/update.d...
done.
done.

Also, install the boto package with the following command.

root@linuxhelp1:~# pip install boto
The directory ' /home/user1/.cache/pip/http'  or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo' s -H flag.
The directory ' /home/user1/.cache/pip'  or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo' s -H flag.
Collecting boto
  Downloading boto-2.42.0-py2.py3-none-any.whl (1.3MB)
    100% |????????????????????????????????| 1.4MB 340kB/s
Installing collected packages: boto
Successfully installed boto-2.42.0
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the ' pip install --upgrade pip'  command.

Once the dependency packages get installed, then create a new seafile user for the seafile installation.

root@linuxhelp1:~# useradd -m -s /bin/bash seafile
root@linuxhelp1:~# passwd seafile
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Now its time to download the seafile package. Then extract the downloaded package and rename it as seafile-server.

root@linuxhelp1:~# su &ndash  seafile
seafile@linuxhelp1:~$ wget https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_6.0.4_x86-64.tar.gz
--2016-09-30 13:34:53--  https://akamai.bintray.com/cb/cb43ecd546d4f0365ea851b3f8cbb25776da6e735436c848c805c631118a69ff?__gda__=exp=1475223413~hmac=ff399cbcf01faf0af7ca69dec2405baf7a5ef3d5cd993ac2d3b7f35825d3d683& response-content-disposition=attachment%3Bfilename%3D%22seafile-server_6.0.4_x86-64.tar.gz%22& response-content-type=application%2Foctet-stream& requestInfo=U2FsdGVkX18TxOZWNdaf8lxNeEyIHCH5PAfMvJjapHKwbrrlflhutzJf0tyDxFFbntBrwpnzdJvpH5rdlJFzAEOMRpHKj8xUO9SWpeUfTj92VrGMU_aQ9oTeAthd55OGYEVuBIOKj8yL6n8bszSr9Q
Resolving akamai.bintray.com (akamai.bintray.com)... 23.57.224.80
Connecting to akamai.bintray.com (akamai.bintray.com)|23.57.224.80|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22600169 (22M) [application/octet-stream]
Saving to: ‘ seafile-server_6.0.4_x86-64.tar.gz’ 
seafile-server_6.0.4_x86-64.tar.g 100%[==========================================================> ]  21.55M   553KB/s    in 42s

2016-09-30 13:35:35 (524 KB/s) - ‘ seafile-server_6.0.4_x86-64.tar.gz’  saved [22600169/22600169]
seafile@linuxhelp1:~$ tar -xzf seafile-server_6.0.4_x86-64.tar.gz
seafile@linuxhelp1:~$ ls
examples.desktop  seafile-server-6.0.4  seafile-server_6.0.4_x86-64.tar.gz
seafile@linuxhelp1:~$ mv seafile-server-6.0.4/ seafile-server/

Then you need to create the 3 database for the seafile.

seafile@linuxhelp1:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with   or g.
Your MySQL connection id is 4
Server version: 5.7.15-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.

mysql>  create database ccnet_db character set = ' utf8'  
Query OK, 1 row affected (0.18 sec)

mysql>  create database seafile_db character set = ' utf8'  
Query OK, 1 row affected (0.00 sec)

mysql>  create database seahub_db character set = ' utf8'  
Query OK, 1 row affected (0.00 sec)

Again, create the user and grant permission to access the three database.

mysql>  create user user1@localhost identified by ' linuxc'  
Query OK, 0 rows affected (0.23 sec)

mysql>  grant all privileges on ccnet_db.* to user1@localhost identified by ' linuxc'  
Query OK, 0 rows affected, 1 warning (0.03 sec)

mysql>  grant all privileges on seafile_db.* to user1@localhost identified by ' linuxc'  
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>  grant all privileges on seahub_db.* to user1@localhost identified by ' linuxc'  
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>  flush privileges 
Query OK, 0 rows affected (0.09 sec)

mysql>  exit
Bye

Now move and setup the seafile user into the seafile-server directory to complete the installation process.

Set the server name, domain name , seafile data directory, server port and enter the database details.

seafile@linuxhelp1:~$ cd seafile-server/
seafile@linuxhelp1:~/seafile-server$ ./setup-seafile-mysql.sh
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
-----------------------------------------------------------------

What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] linuxhelp1

What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server' s ip or domain ] 192.158.5.154

Where do you want to put your seafile data?
Please use a volume with enough free space
[ default " /home/seafile/seafile-data"  ]

Which port do you want to use for the seafile fileserver?
[ default " 8082"  ]

-------------------------------------------------------
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

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 ...  done

Enter the name for mysql user of seafile. It would be created if not exists.
[ default " seafile"  ] user1

Enter the password for mysql user " user1" :
[ password for user1 ]

verifying password of user user1 ...  done

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:            linuxhelp1
    server ip/domain:       192.158.5.154

    seafile data dir:       /home/seafile/seafile-data
    fileserver port:        8082

    database:               create new
    ccnet database:         ccnet-db
    seafile database:       seafile-db
    seahub database:        seahub-db
    database user:          user1

---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------

Generating ccnet configuration ...

done
Successly create configuration dir /home/seafile/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.

Now its time to start the seafile service by using the following command.

seafile@linuxhelp1:~/seafile-server$ ./seafile.sh start

[09/30/16 13:47:26] ../common/session.c(132): using config file /home/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
Seafile server started
Done.

Then start the seahub service and enter the admin account details.

seafile@linuxhelp1:~/seafile-server$ ./seahub.sh start

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 ] linuxhelpserver@gmail.com

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 seafile gets installed, open the web browser and enter http://IP address/:8000/

Enter the following user credentials and click on Login button.

Now you can access the Seafile sharing.

FAQ
Q
Why it shows Failed to upload/download the file online?
A
Make sure your firewall for Seafile fileserver is opened.
Make sure SERVICE_URL in ccnet.conf and FILE_SERVER_ROOT in seahub_settings.py are set correctly. Furthermore, check that you haven't overwritten them using the settings in the Seahub Admin section.
Q
Why i am getting Seafile started correctly, but when visiting the web interface, it shows "Internal Server Error"?
A
It is most likely some required Python packages of Seahub is not installed correctly. You can check the detailed error messages in /var/log/nginx/seahub.error.log if you use Nginx.
Q
What is the purpose of using the Seafile?
A
Seafile client is file hosting software, synchronises the files that are stored on a central server. It allows the users to create their own private cloud in a secure way. The seafile functio
Q
How to restrict Seafile access to certain accounts in AD?
A
You can use FILTER field in LDAP configuration in ccnet.conf. For example, the following filter restricts the access to Seafile to members of a group.
FILTER = memberOf=cn=group,cn=users,DC=x
Q
How to migrate libraries and groups from one account to another in Seafile?
A
Since version 4.4.2, system admins can migrate libraries and groups from one account to another existing account using RESTful web api.