====== Seafile Server Migration von Ubuntu 14.04 LTS -> Debian 8 Jessie ====== ===== Quellen ===== - https://manual.seafile.com/maintain/backup_recovery.html - https://unwahrscheinlichkeitsdrive.de/2015/02/07/seafile-migration/ === Auf dem "alten" Server === <> mysqldump -h localhost -u root -p seafile_ccnet-db > ccnet-db.sql mysqldump -h localhost -u root -p seafile_seafile-db > seafile-db.sql mysqldump -h localhost -u root -p seafile_seahub-db > seahub-db.sql scp -r -P 22 /root/seafile_db/ccnet-db.sql root@192.168.1.2:/root scp -r -P 22 /root/seafile_db/seafile-db.sql root@192.168.1.2:/root scp -r -P 22 /root/seafile_db/seahub-db.sql root@192.168.1.2:/root cd /home/seafile/seafile-server tar -czvf - * | ssh -p 22 root@192.168.1.2 'tar -xhzvf - -C /opt/seafile/' === Auf dem "neuen" Server === apt install python2.7 libpython2.7 python-setuptools python-imaging \ python-ldap python-mysqldb python-memcache python-urllib3 \ memcached python-memcache sudo -y adduser --disabled-login --home /opt/seafile --shell /bin/false --gecos "Seafile" seafile chown seafile:root /opt/seafile -R mysql -u root -p CREATE USER 'seafile'@'localhost' IDENTIFIED BY 'PASSW0RD1'; CREATE DATABASE `seafile_ccnet-db`; CREATE DATABASE `seafile_seafile-db`; CREATE DATABASE `seafile_seahub-db`; GRANT ALL privileges ON `seafile_ccnet-db`.* TO 'seafile'@'localhost'; GRANT ALL privileges ON `seafile_seafile-db`.* TO 'seafile'@'localhost'; GRANT ALL privileges ON `seafile_seahub-db`.* TO 'seafile'@'localhost'; flush privileges; mysql -u root -p seafile_ccnet-db < /root/ccnet-db.sql mysql -u root -p seafile_seafile-db < /root/seafile-db.sql mysql -u root -p seafile_seahub-db < /root/seahub-db.sql nano /opt/seafile/conf/ccnet.conf nano /opt/seafile/conf/seafile.conf nano /opt/seafile/conf/seahub_settings.py nano /opt/seafile/ccnet/seafile.ini su seafile cd /opt/seafile/seafile-server-latest/ ./seaf-fsck.sh ./seafile.sh start ./seahub.sh start-fastcgi exit mkdir /var/www/html/meinekleinefarm.net/seafile nano /etc/apache2/sites-available/files.meinekleinefarm.net.conf ServerName files.meinekleinefarm.net Redirect permanent / https://files.meinekleinefarm.net/ ServerAdmin webmaster@meinekleinefarm.net ServerName files.meinekleinefarm.net ServerAlias files.meinekleinefarm.net DocumentRoot /var/www/html/meinekleinefarm.net/seafile SSLEngine on SSLCertificateFile /etc/letsencrypt/live/meinekleinefarm.net/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/meinekleinefarm.net/privkey.pem Alias /media /opt/seafile/seafile-server-latest/seahub/media ProxyPass ! Require all granted RewriteEngine On # seafile fileserver ProxyPass /seafhttp http://127.0.0.1:8082 ProxyPassReverse /seafhttp http://127.0.0.1:8082 RewriteRule ^/seafhttp - [QSA,L] # seahub SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 ProxyPass / fcgi://127.0.0.1:8000/ a2ensite files.meinekleinefarm.net.conf service apache2 reload ===== Seafile Server Init Script ===== nano /etc/init.d/seafile-server #!/bin/sh ### BEGIN INIT INFO # Provides: seafile-server # Required-Start: $local_fs $remote_fs $network mysql # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts Seafile Server # Description: starts Seafile Server ### END INIT INFO # Change the value of "user" to linux user name who runs seafile user=seafile # Change the value of "seafile_dir" to your path of seafile installation # usually the home directory of $user seafile_dir=/opt/seafile script_path=${seafile_dir}/seafile-server-latest seafile_init_log=${seafile_dir}/logs/seafile.init.log seahub_init_log=${seafile_dir}/logs/seahub.init.log # Change the value of fastcgi to true if fastcgi is to be used fastcgi=true # Set the port of fastcgi, default is 8000. Change it if you need different. fastcgi_port=8000 # # Write a polite log message with date and time # echo -e "\n \n About to perform $1 for seafile at `date -Iseconds` \n " >> ${seafile_init_log} echo -e "\n \n About to perform $1 for seahub at `date -Iseconds` \n " >> ${seahub_init_log} case "$1" in start) sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log} if [ $fastcgi = true ]; then sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log} else sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log} fi ;; restart) sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log} if [ $fastcgi = true ]; then sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log} else sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log} fi ;; stop) sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log} sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log} ;; *) echo "Usage: /etc/init.d/seafile-server {start|stop|restart}" exit 1 ;; esac mkdir -p /opt/seafile/logs/ chmod +x /etc/init.d/seafile-server update-rc.d seafile-server defaults ===== Garbage Collecting Unused Blocks on Seafile Server ===== nano /opt/seafile/sfs_gc.sh