Ubuntu20.04部署Seafile
环境:Windows的WSL Ubuntu20.04
seafile版本:8.0.7
主要参考:https://cloud.seafile.com/published/seafile-manual-cn/deploy/using_mysql.md
源码
mkdir /opt/seafile
mv seafile-server_* /opt/seafile
cd /opt/seafile
#将 seafile-server_* 移动到 seafile 目录下后
tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed
依赖安装
sudo apt-get update
sudo apt-get install python3 python3-setuptools python3-pip python3-ldap libmysqlclient-dev -y
sudo apt-get install libmemcached-dev
pip3 install --timeout=3600 django==2.2.* future mysqlclient pymysql Pillow pylibmc captcha jinja2 \
sqlalchemy==1.4.3 psd-tools django-pylibmc django-simple-captcha
mysql的安装
sudo apt-get install mysql-server
mysql在安装过程中没有设置密码,这么做:
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 再文件最后添加skip-grant-tables这句话,wq退出
service mysql restart
mysql -u root -p # 这个时候不需要密码,直接进入
> use mysql;
> update user set authentication_string="password" where user="root";
> flush privileges;
# 最后将mysqld.cnf中的skip-grant-tables删除,再重启
service mysql restart
Seafile的部署
cd seafile-server-*
./setup-seafile-mysql.sh #运行安装脚本并回答预设问题
最终将由如下的界面出现,便为部署成功了。
Seafile的启动
./seafile.sh start # 启动 Seafile 服务
./seahub.sh start # 启动 Seahub 网站 (默认运行在127.0.0.1:8000端口上)
在这里启动seahub的时候将会出现错误:Error happened during creating seafile admin.
mysql -u root -p
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| seafile | 127.0.0.1 |
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
6 rows in set (0.00 sec)
可以看到seafile对应的host为127.0.0.1,我们需要在mysql中输入即可。
> ALTER USER 'seafile'@'127.0.0.1' IDENTIFIED BY 'your_password' PASSWORD EXPIRE NEVER;
> ALTER USER 'seafile'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'your_password';
> FLUSH PRIVILEGES;
> ALTER USER 'seafile'@'127.0.0.1' IDENTIFIED BY 'your_password';
> quit;
随后再次启动seahub即可,./seahub.sh start
,将会得到如下
root@DESKTOP-GNFN7KC:/opt/seafile/seafile-server-latest# ./seahub.sh start
LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
Seahub is started
Done.
到此为止便大功告成了,在浏览器中,我们可以输入127.0.0.1:8000
进行访问,成功登陆后便为如下:
我们还可以从官网下载Windows、Linux等客户端,操作也是十分方便。
https://www.seafile.com/download/
参考
https://cloud.seafile.com/published/seafile-manual-cn/deploy/using_mysql.md