This document is used to explain how to install and run the Seafile server based on MySQL/MariaDB through the pre-compiled installation package. (MariaDB is a branch of MySQL)
Go to download page to download the latest server installation package.
Download seafile-server_6.2.5_* to your /home/username directory. Suggest a directory structure like this:
mkdir seafile
mv seafile-server_* seafile
cd seafile
# Seafile-server_*After moving to the seafile directory
tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed
Your directory should now look like this:
# tree seafile -L 2
seafile
├── installed
│ └── seafile-server_xxxx.tar.gz
└── seafile-server-xxx
├── reset-admin.sh
├── runtime
├── seafile
├── seafile.sh
├── seahub
├── seahub.sh
├── setup-seafile.sh
└── upgrade
**The advantage of designing the catalog this way is **
Before installing Seafile server, please confirm that the following software has been installed
# on Debian/Ubuntu 14.04 server
apt-get update
apt-get install python2.7 libpython2.7 python-setuptools python-imaging \
python-ldap python-mysqldb python-memcache python-urllib3
# on Ubuntu 16.04 server
# As the default python binary on Ubuntu 16.04 server is python 3, we need to install python(python 2) first.
apt-get update
apt-get install python
apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 ffmpeg python-pip python-mysqldb python-memcache
pip install pillow moviepy
# on CentOS 7
yum -y install epel-release
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
pip install pillow moviepy
cd seafile-server-*./setup-seafile-mysql.sh #Run the installation script and answer preset questions
If one of the above software is not installed in your system, the Seafile initialization script will remind you to install the corresponding software package.
The script will ask you some questions in turn, and guide you step by step to configure the parameters of Seafile:
Parameters | Function | Description |
---|---|---|
seafile server name | The name of the seafile server, currently this configuration is no longer used | 3 ~ 15 characters, you can use English letters, numbers, underscores |
seafile server ip or domain | seafile server IP address or domain name | The client will access your Seafile service through this IP or address |
seafile data dir | seafile data storage directory, using the above example, the default will be /data/haiwen/seafile-data | seafile data will gradually increase with use, please put it in a partition with enough free space On |
seafile fileserver port | TCP port used by seafile fileserver | This port is used for file synchronization. Please use the default 8082 and cannot be changed. |
Here, you will be asked to choose a way to create a Seafile database:
-------------------------------------------------------
Please choose a way to initialize seafile databases:-------------------------------------------------------[1] Create newccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
1
, you need to provide the root password. The script program will create the database and user.2
, the ccnet/seafile/seahub database should have been created by you (or someone else) in advance.If the installation is completed correctly, you will see the following output (the new version may be different)
Your directory structure should now look like this:
# tree seafile -L 2
seafile
├── conf # configuration files
│ ├── ccnet.conf
│ └── seafile.conf
│ └── seahub_settings.py
│ └── seafdav.conf
├── ccnet
│ ├── mykey.peer
│ ├── PeerMgr
│ └── seafile.ini
├── installed
│ └── seafile-server_xxx.tar.gz
├── seafile-data
├── seafile-server-xxx # active version
│ ├── reset-admin.sh
│ ├── runtime
│ ├── seafile
│ ├── seafile.sh
│ ├── seahub
│ ├── seahub.sh
│ ├── setup-seafile.sh
│ └── upgrade
├── seafile-server-latest # symbolic link to seafile-server-xxx
├── seahub-data
│ └── avatars
The seafile-server-latest
folder is a symbolic link to the current Seafile server folder. After you upgrade to a new version in the future, the upgrade script will automatically update to always point to the latest Seafile server folder.
In the seafile-server-xxx directory, run the following command
. /seafile.sh start #Start Seafile service
. /seahub.sh start <port> #Launch the Seahub website (runs on port 8000 by default)
**Tips: ** When you start seahub for the first time, the seahub.sh
script will prompt you to create a seafile administrator account.
After the service starts, open the browser and enter the following address
http://192.168.1.111:8000/
You will be redirected to the login page. Just enter the administrator username and password.
Congratulations! Now you have successfully installed Seafile server.
If you don't want to run Seahub on the default port 8000, but want to run on a custom port (such as 8001), please follow the steps below:
. /seahub.sh stop #Stop the Seafile process
. /seafile.sh stop #Stop Seahub
SERVICE_URL
in the haiwen/conf/ccnet.conf
file (assuming your ip or domain name is 192.168.0.190
), as follows (starting from version 5.0, you can set it directly in the administrator interface. Note, If this value is set in both the web interface and the configuration file, the configuration of the web interface shall prevail.):SERVICE_URL = http://192.168.0.190:8001
. /seafile.sh start #Start Seafile service
. /seahub.sh start 8001 #Start the Seahub website (running on port 8001)
. /seahub.sh stop #Stop Seahub
. /seafile.sh stop #Stop the Seafile process
. /seafile.sh restart #Stop the current Seafile process, then restart Seafile
. /seahub.sh restart #Stop the current Seahub process and restart Seahub on port 8000
In most cases the seafile.sh seahub.sh script can work normally. If you encounter problems:
pgrep -f seafile-controller #View Seafile process
pgrep -f "seahub" #View Seahub process
pkill -f seafile-controller #End the Seafile process
pkill -f "seahub" #End the Seafile process
Use crontab's @reboot to set the boot-up auto-start, crontab -e
enter the edit page and add:
@ reboot /home/username/seafile/seafile-server-latest/seafile.sh start &&/home/username/seafile/seafile-server-latest/seahub.sh start 8001
The backup script is located in the /home/username/seafile/backup
folder with the following content:
#! /bin/bash
user={database username}
pass={password}
datetime=`date +"%Y-%m-%d-%H-%M-%S"`
mysqldump -u $user -p$pass --opt ccnet-db >/home/username/seafile/backup/databases/ccnet/ccnet-db.sql.$datetime
mysqldump -u $user -p$pass --opt seafile-db >/home/username/seafile/backup/databases/seafile/seafile-db.sql.$datetime
mysqldump -u $user -p$pass --opt seahub-db >/home/username/seafile/backup/databases/seahub/seahub-db.sql.$datetime
Set a scheduled task in crontab to automatically back up the database every day:
01*** bash /home/username/seafile/backup/databases/seafile_backup.sh 2>&1&
In the /home/username/seafile/backup/databases
folder, there are three folders ccnet
, seafile
, and seahub
to store the backup data of different libraries, and three database data need to be restored in sequence:
mysql -u[username]-p[password] ccnet-db < ccnet-db.sql.2013-10-19-16-00-05
mysql -u[username]-p[password] seafile-db < seafile-db.sql.2013-10-19-16-00-20
mysql -u[username]-p[password] seahub-db < seahub-db.sql.2013-10-19-16-01-05
First, you need to have a server with a public IP, and then use OpenV** to build a V** network, and assign an IP: 10.8.0.190
to the intranet machines. Detailed method reference: [Ubuntu sets up OpenV** to achieve intranet penetration] (http://woodenrobot.me/2018/08/11/Ubuntu-%E6%9E%B6%E8%AE%BE-OpenV**-%E5%AE%9E%E7%8E%B0%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/)
server {
listen 80;
server_name 192.168.0.19010.8.0.190 seafile.xxx.xxx;
location /{
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://192.168.0.190:8001;
proxy_redirect default;}}
server {
listen 80;
server_name seafile.xxxx.xxx;
location /{
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.8.0.190;}}
server {
listen 8082;
server_name seafile.xxx.xxx;
location /{
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.8.0.190:8082;
proxy_redirect default;}}
Internal Network (LAN)-DHCP Server
;Ad Blocking Function-Adbyby
, enable Adbyby function and enable redirection DNS, the redirection address is set to 192.168.0.1
:Fix the bug of changing avatar. The interface of changing avatar reported an error and the homepage could not be opened. Repair method: First install libjpeg8-dev,
$ sudo apt install libjpeg8-dev
Then update the python Pillow library to the latest version
sudo pip install Pillow
Recommended Posts