Transferring Seafile file storage with all data to another server
A series of articles on setting up file storage Seafile
- Installing Seafile 7.1.0 + Nginx + Percona on Centos 7
- Installing Seafile file storage on Centos 7
- Transferring Seafile file storage with all data to another server
- Clearing File History in Seafile
To transfer seafile with all users and data to another server, you need:
- On the old server, make a backup of the mysql database and the directory where the seafile is located
- Install and configure mysql-server and web-server on the new server
- Transfer backup from old server to new
- Deploy the backup on a new server
Backing up Seafile on the old server
[[email protected]]# mysqldump -u seafile -ppassword ccnet_db | gzip > /home/backup/ccnet_db_$(date +%y%m%d).sql.gz
[[email protected]]# mysqldump -u seafile -ppassword seafile_db | gzip > /home/backup/seafile_db_$(date +%y%m%d).sql.gz
[[email protected]]# mysqldump -u seafile -ppassword seahub_db | gzip > /home/backup/seahub_db_$(date +%y%m%d).sql.gz
[[email protected]]# tar -zcf /home/backup/backup_$(date +%y%m%d).tar.gz /home/seafile
Deploying a backup on a new server
[[email protected]]# gzip -d /home/backup/ccnet_db_$(date +%y%m%d).sql.gz
[[email protected]]# gzip -d /home/backup/seafile_db_$(date +%y%m%d).sql.gz
[[email protected]]# gzip -d /home/backup/seahub_db_$(date +%y%m%d).sql.gz
We connect to MySQL, create new databases and create a user
[[email protected]]# mysql -u root -p
mysql> CREATE DATABASE ccnet_db;
mysql> CREATE DATABASE seafile_db;
mysql> CREATE DATABASE seahub_db;
mysql> create user 'seafile'@'localhost' identified by 'password';
Assign and update privileges and exit
mysql> GRANT ALL PRIVILEGES ON ccnet_db.* TO 'seafile'@'localhost';
mysql> GRANT ALL PRIVILEGES ON seafile_db.* TO 'seafile'@'localhost';
mysql> GRANT ALL PRIVILEGES ON seahub_db.* TO 'seafile'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit;
Restoring the base from the dump
[[email protected]]# mysql -u seafile -ppassword ccnet_db < /home/backup/ccnet_db_$(date +%y%m%d).sql
[[email protected]]# mysql -u seafile -ppassword seafile_db < /home/backup/seafile_db_$(date +%y%m%d).sql
[[email protected]]# mysql -u seafile -ppassword seahub_db < /home/backup/seahub_db_$(date +%y%m%d).sql
Unpack the archive with data
[[email protected]]# tar -xvzf /home/backup/backup_$(date +%y%m%d).tar.gz
We transfer the unpacked archive to a working directory, for example / home / seafile
Further steps are described in the article on installing Seafile