Upgrading to Seafile Pro v10.x on Centos v7 with MariaDB and Nginx

Upgrading an existing Centos v7 system with MariaDB and Nginx was a bit of a nightmare so I thought I’d share the detailed steps I followed. Of course, make sure you’ve got a backup first. Seafile is installed in \data\seafile so change this path as required. Assumes that you’ve used sudo -i to switch to admin/root. The MariaDB upgrade might be optional but I thought what the heck. There are three main gotcha’s with the upgrade:

  1. Python v3.9.* or higher is needed for Pillow 9.3.* - and this has to be installed by compiling the source code
  2. Seahub.sh won’t run until the soft link is made between python2.7 and python3
  3. Seahub.sh won’t start unless djangosaml2 is installed

The last two points are missing from the documentation. #2 is IMO a bug in the install/upgrade process. Pretty sure the upgrade script should do this.

MariaDB v11.x update

# Stop services.
cd /data/seafile/seafile-server-latest
./seahub.sh stop
./seafile.sh stop
systemctl stop nginx mariadb

# Backup databases and remove MariaDB.
cp -a /var/lib/mysql/ /var/lib/mysql.bak
yum -y remove mariadb-server mariadb mariadb-libs mariadb-devel
yum clean all

# Install latest MariaDB
cd /tmp
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
yum -y install mariadb mariadb-server mariadb-devel
systemctl enable mariadb --now
mysql_upgrade -u root -pPASSWORD

Install Python v3.9.16

# Compile/install Python v3.9.16.
yum -y install gcc openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel
cd /usr/src
wget https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tgz
tar -xzvf Python-3.9.16.tgz
cd Python-3.9.16
./configure --enable-optimizations
make altinstall
rm /usr/src/Python-3.9.16.tgz -f
rm -f /usr/bin/python3 && ln -s /usr/local/bin/python3.9 /usr/bin/python3
rm -f /usr/bin/pip3 && ln -s /usr/local/bin/pip3.9 /usr/bin/pip3
/usr/local/bin/python3.9 -m pip install --upgrade pip

Upgrade Seafile v10.x

# Install/upgrade modules needed for Seafile v10.x
pip3 install django==3.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==9.3.* pylibmc captcha==0.4 markupsafe==2.0.1 jinja2 sqlalchemy==1.4.3 psd-tools django-pylibmc django_simple_captcha==0.5.* pycryptodome==3.16.* cffi==1.15.1 lxml djangosaml2 --upgrade

# Upgrade Seafile as usual (see web site). The only thing I’ve not added here is running as a different user. I’m still running as nginx I think. This is only needed for ElasticSearch which client didn’t use.

Installation - Seafile Admin Manual

# Fixup python libraries.
cd /data/seafile/seafile-server-latest/seafile/lib64
ln -s python2.7 python3

# Start Seafile and Seahub ,crossing fingers and everything else.
cd /data/seafile/seafile-server-latest
./seafile.sh start
./seahub.sh start

1 Like
--- a/seahub/seahub/avatar/settings.py.orig     2023-09-07 15:09:20.602374375 +0800
+++ b/seahub/seahub/avatar/settings.py  2023-09-07 15:09:54.182346509 +0800
@@ -22,7 +22,7 @@

 ### Common settings ###
 AVATAR_FILE_STORAGE = getattr(settings, 'AVATAR_FILE_STORAGE', '')
-AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS)
+AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.Resampling.LANCZOS)
 AVATAR_GRAVATAR_BACKUP = getattr(settings, 'AVATAR_GRAVATAR_BACKUP', True)
 AVATAR_GRAVATAR_DEFAULT = getattr(settings, 'AVATAR_GRAVATAR_DEFAULT', None)
 AVATAR_MAX_AVATARS_PER_USER = getattr(settings, 'AVATAR_MAX_AVATARS_PER_USER', 42)

Here is the patch to make it work with pillow 10.
Seafile devs are so slow with support :frowning:

2 Likes

Thanks for that. I’m just pleased I go it to Pillow 9.3.x!! Burnt enough hours on this one so will leave that for maybe Seafile v11.

Damn, this was a lifesaver.
I’ve tried updating from 9.x to 10.0.4 like 10 times but alway failed until I found your guide.
Many thanks!

Glad I could be of assistance.

1 Like