Try Amazone Prime for free before Christmas:
A RaspberryPi (for example, the “Starter Kit“)* is available, the operating system “Raspian” is installed and of course connected to the network. You know the IP address of the RaspberryPI. You can find them in your router or enter them in the console ifonfi
g. SSH access is enabled. I always put an empty file named “ssh” in the boot partition. Then we install Seafile.
Log in to the Raspi by SSH – ssh pi@raspberrypi (password: raspberry)
At the first start, I recommend running the sudo raspi-config command and changing both the host name and password.
Create a new user “Seafile”, switch to this user and enter the main directory:
sudo useradd -m -p seafile -s /bin/bash seafile sudo su seafile Cd
Back in the browser go to https://www.seafile.com/en/download/ and click on the link “Latest version” in the “Server” section of Server for Raspberry Pi, then copy the link to the file seafile-server_7.0.3_stable_pi.tar.gz (as of 25.07.2019)
Download, unzip and move the file to the “installed” folder and leave Seafile users:
wget https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz tar xfz seafile-server_7.0.5_stable_pi.tar.gz mkdir installed mv seafile-server_7.0.5_stable_pi.tar.gz installed/ exit
Install required programs:
sudo apt update sudo apt install python2.7 libpython2.7 python-setuptools python-ldap python-mysqldb python-memcache python-urllib3 python-pil python-certifi python-idna python-requests mariadb-server-10.0 sqlite3
MySQL Root Password Set:
sudo mysql -u root update mysql.user set password=password('secret') where user='root'; update mysql.user set plugin='' where user='root'; flush privileges; Quit
Go back to the Seafile user, switch to folders, and run Setup:
sudo su seafile cd seafile-server-7.0.5 ./setup-seafile-mysql.sh
You will now be asked for some information, which are self-explan
atory: Server name: Name of the Seafile server (fre
e to assign) Server IP: IP address of the Raspberry (which you should know or look in
your router) Seafile data dir: Path to location (can we also La
ter change) Fileserver port: Port of the server (co
firm with Enter) If you are asked how to create the databases, you select “1” to generate new databases. During the setup, you will also be asked for the root password, which you have previously set. In addition, the new user “seafile” is created. You also need to set a password for this one. The rest can be confidently confirmed with Enter.
You can start and stop seafile now (if you are as a user seafile in the folder /seafile-server-latest/):
./seafile.sh start/ stop / restart ./seahub.sh start/ stop / restart
A first start should be done as you are asked for admin credentials and Seafile is fully set up.
If you are expecting the data to be stored on an external hard drive*, as it probably has significantly more storage capacity than the SD card, please click the following link: Prepare external hard drive for Seafile.
Set up autostart
We leave user Seafile with “exit” and now create the autostarts, so that Seafile starts automatically every time the Raspberry starts. To do this, we will create two files below and activate them according to the official instructions of Seafile (manual.seafile.com):
sudo nano /etc/systemd/system/seafile.service
Insert and save the following with Ctrl + O and close with Ctrl + X:
[Unit] Description=Seafile add mysql.service or postgresql.service depending on your database to the line below After=network.target [Service] Type=forking ExecStart=/home/seafile/seafile-server-latest/seafile.sh start ExecStop=/home/seafile/seafile-server-latest/seafile.sh stop User=seafile Group=seafile [Install] WantedBy=multi-user.target
This was Seafile, now comes Seahub (web interface):
sudo nano /etc/systemd/system/seahub.service
Insert and save the following with Ctrl + O and close with Ctrl + X:
[Unit] Description=Seafile hub After=network.target seafile.service [Service] Type=forking change start to start-fastcgi if you want to run fastcgi ExecStart=/home/seafile/seafile-server-latest/seahub.sh start ExecStop=/home/seafile/seafile-server-latest/seahub.sh stop User=seafile Group=seafile [Install] WantedBy=multi-user.target
Now activate the two create files:
sudo systemctl enable seafile seahub
You can now control seafile as pi-user with:
sudo systemctl start/stop/restart seafile seahub
To control as pi-user you would first have to stop seafile and seahub as user seafile:
sudo su seafile Cd cd seafile-server-latest ./seafile.sh stop ./seahub.sh stop exit
Now you have installed a functional cloud server. This is currently only accessible locally. Below we install nginx as a web server and set up an SSL certificate.
Installing and setting up NginX
First, we install web server nginx and adapt it to seafile:
sudo apt install nginx sudo nano /etc/nginx/sites-available/seafile.conf
Enter the following configuration and save it with Ctrl + O and close it with Ctrl + X:
server list 80; server_name _; proxy_set_header X-Forwarded-For $remote_addr; 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; Used for view/edit office file via Office Online Server client_max_body_size 0; access_log /var/log/nginx/seahub.access.log; error_log /var/log/nginx/seahub.error.log; } If you are using ([FastCGI]http://en.wikipedia.org/wiki/FastCGI), Which is not recommended, you should use the following config for location '/'. # • location / • fastcgi_pass 127.0.0.1:8000; • fastcgi_param SCRIPT_FILENAME $document_root-fastcgi_script_name; • fastcgi_param PATH_INFO $fastcgi_script_name; # fastcgi_param SERVER_PROTOCOL $server_protocol; • fastcgi_param QUERY_STRING $query_string; • fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; • fastcgi_param CONTENT_LENGTH $content_length; • fastcgi_param SERVER_ADDR $server_addr; • fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; • fastcgi_param REMOTE_ADDR $remote_addr; • fastcgi_read_timeout 36000; # • client_max_body_size 0; # access_log /var/log/nginx/seahub.access.log; • error_log /var/log/nginx/seahub.error.log; # } location /seafhttp rewrite s/seafhttp(.*)- 1 break; proxy_pass http://127.0.0.1:8082; client_max_body_size 0; 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 /home/seafile/seafile-server-latest/seahub; } }
Then we delete the two “default” files and create a link to our created configuration:
sudo rm /etc/nginx/sites-enabled/default sudo rm /etc/nginx/sites-available/default sudo ln -s /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf
We test the configuration (should play successful), reload nginx and adjust the Seafile configuration:
sudo nginx -t sudo nginx -s reload sudo su seafile cd conf nano ccnet.conf
After “SERVICE_URL” remove the colon 8000. The only example is (or your IP address of the RaspberryPi):
SERVICE_URL = http://192.168.2.115
Ctrl O + Ctrl + X for save and close. Then insert a line in seahub_settings (also here please adjust your IP):
nano seahub_settings.py FILE_SERVER_ROOT = 'http://192.168.2.115/seafhttp'
Seafile users leave and restart Seafile:
exit sudo systemctl restart seafile seahub