Install Seafile Server on WD My Cloud Home
August 18, 2021The WD My Cloud Home series comes with an Android operating system customized by WD. However, this has some drawbacks:
Access to the storage is only possible when an Internet connection is active and only via the official apps. There is no possibility to establish a local connection via common network protocols like SMB or FTP. SSH can also no longer be enabled, unlike the predecessor without “Home”.
However, this can be bypassed quite easily. You just have to replace the operating system with a reasonable Linux, in this case Debian with OpenMediaVault. How to do that you can read here.
If you followed the instructions, you now have a WD My Cloud Home with Debian and OpenMediaVault. But on it we can also install other software, in this case “Seafile”.
Seafile is a cloud service that can be hosted on a single board computer. It is similar to Nextcloud, but lighter and easier to install. The speed is sufficient with SQLite if only one or two users access it. It stores all files in a database that can be mounted as a drive with clients.
Smartphone apps allow automatic backup of photos. IPhone photos are automatically converted to Jpeg.
To get started you need to connect to the WD My Cloud Home via SSH.
Install Seafile Server on WD My Cloud Home with Debian
Create a new user named “Seafile” that can log in and run the commands needed to install Seafile.
adduser -home /home/seafile -shell /bin/bash seafile
Since no bashrc was created, copy the one from user buster:
cp /home/buster/.bashrc /home/seafile/.bashrc
chown seafile:seafile /home/seafile/.bashrc
chmod 755 /home/seafile/.bashrc
Create a space on the data partition for your database and files:
mkdir /mnt/data/seafile
chown -R seafile:seafile /mnt/data/seafile
chmod -R 777 /mnt/data/seafile
Create a location to store the log files (this helps to store the seafile log and pids with folder2ram in RAM)
mkdir /var/lib/seafile
mkdir /var/lib/seafile/logs
mkdir /var/lib/seafile/pids
chown -R seafile:seafile /var/lib/seafile
chmod -R 777 /var/lib/seafile
Install both SQLite and Python before installing Seafile.
apt-get install -y sqlite3 python3
Log off from SSH.
Exit
Log in again as user Seafile.
ssh seafile@wdnas
mkdir /home/seafile/haiwen
cd /home/seafile/haiwen
Visit https://github.com/haiwen/seafile-rpi/releases to get the latest version of Seafile Server. Download the server version for Raspberry Pi (Debian Buster and ARM64)
wget https://github.com/haiwen/seafile-rpi/releases/download/v8.0.5/seafile-server-8.0.5-buster-armv7l.tar.gz
tar xzfv seafile-server-8.0.5-buster-armv7l.tar.gz
rm *.gz
Install Seafile using the script.
cd seaf*
bash ./setup-seafile.sh
Before starting Seafile, move the seafile-data directory to the data partition, otherwise it will soon become too large to be stored on the root partition.
mv /home/seafile/haiwen/seafile-data /mnt/data/seafile/
ln -s /mnt/data/seafile/seafile-data /home/seafile/haiwen/seafile-data
mv /home/seafile/haiwen/pids /var/lib/seafile/
ln -s /var/lib/seafile/pids /home/seafile/haiwen/pids
mv /home/seafile/haiwen/logs /var/lib/seafile/
ln -s /var/lib/seafile/logs /home/seafile/haiwen/logs
cd..
Edit the gunicorn.conf file to make the server accessible from other computers.
cd conf
nano gunicorn.conf.py
In gunicorn.conf.py, change the bind line from 127.0.0.1 to 0.0.0.0. Otherwise, the server will not accept requests from outside localhost (it’s silly to use this as the default for a server program).
bind 0.0.0:8000
Save and exit.
cd /home/seafile/haiwen/seafile-server-latest
./seafile.sh start
./seahub.sh start
cd ..
Let Seafile start at boot time:
su
nano /etc/system/system/seafile.service
Contents:
[Unit]
Description=seafile
add mysql.service or postgresql.service depending on your database to the lin$
After=network.target
[Service]
After=seafile.service
Type=forking
ExecStart=/home/seafile/haiwen/seafile-server-latest/seafile.sh start
ExecStop=/home/seafile/haiwen/seafile-server-latest/seafile.sh stop
LimitNOFILE=infinity
User=seafile
Group=seafile
[Install]
WantedBy=multi-user.target
Save and exit
nano /etc/system/system/seahub.service
Contents:
[Unit]
Description=seafile hub
After=seafile.service
[Service]
Type=oneshot
change start to start-fastcgi if you want to run fastcgi
ExecStart=/home/seafile/haiwen/seafile-server-latest/seahub.sh start
ExecStop=/home/seafile/haiwen/seafile-server-latest/seahub.sh stop
User=seafile
Group=seafile
[Install]
WantedBy=multi-user.target
Save and exit.