- 环境准备
- 部署seafile节点IP
- 对象存储访问IP
- 数据库IP以及用户密码
- 安装和配置
1.上传文件到控制节点
把seafile-pro-server-7.1.22-dev.tar.gz上传到控制节点的/root
2.创建seafile目录
用root用户登录到控制节点。
# mkdir /opt/seafile # chown root:root /opt/seafile |
3.拷贝文件到/opt/seafile
# cp /rootseafile-pro-server-7.1.22-dev.tar.gz /opt/seafile |
4.解压安装包
# cd /opt/seafile # tar zxf seafile-pro-server-7.1.22-dev.tar.gz |
5.安装依赖包
# yum install python3 python3-setuptools python3-pip -y |
6.执行安装命令
# cd /opt/seafile/seafile-pro-server-7.1.22 # bash setup-seafile-mysql.sh auto -n `hostname` -i 192.168.100.100 -p 8082 -d /opt/seafile/seafile-data/ -o 192.168.100.101 -t 3306 -u seafile -w seafile -r Abc12345 -q '%' -c ccnet-db -s seafile-db -b seahub-db |
192.168.100.100:是seafile安装所在的节点IP,192.168.100.101:数据库的IP。分别替换为实际的IP。
命令执行成功输出信息如下
...... creating seafile-server-latest symbolic link ... done ----------------------------------------------------------------- Your seafile server configuration has been finished successfully. ----------------------------------------------------------------- ...... |
7.创建s3用户
# radosgw-admin user create --uid=seafile --display-name=seafile --email=seafile@test.com--access-key=aaaaaaaaaaaaaaaaaa--secret-key=bbbbbbbbbbbbbbbbbbbbbbbbbbb --system |
执行成功信息格式如下:
{ "user_id": "seafile1", "display_name": "seafile1", "email": "seafile1@test.com", "suspended": 0, "max_buckets": 1000, "auid": 0, "subusers": [], "keys": [ { "user": "seafile1", "access_key": "cccccccccccccccccc", "secret_key": "bbbbbbbbbbbbbbbbbbbbbbbbbbb" } ], ...... } |
8.创建bucket
#cd /opt/seafile/seafile-pro-server-7.1.22 #python create-bucket.py |
成功执行输出信息如下
seafile-blocks seafile-commits seafile-fs |
9.配置对接s3
在/opt/seafile/conf/seafile.conf 文件追加如下配置:
[commit_object_backend] name = s3 bucket = seafile-commits key_id = cccccccccccccccccc key = bbbbbbbbbbbbbbbbbbbbbbbbbbb host = 192.168.100.101:7480 path_style_request = true [fs_object_backend] name = s3 bucket = seafile-fs key_id = cccccccccccccccccc key = bbbbbbbbbbbbbbbbbbbbbbbbbbb host = 192.168.100.101:7480 path_style_request = true [block_backend] name = s3 bucket = seafile-blocks key_id = cccccccccccccccccc key = bbbbbbbbbbbbbbbbbbbbbbbbbbb host = 192.168.100.101:7480 path_style_request = true |
192.168.100.101是对象网关的IP,一般是云平台的VIP,用实际IP替换。
10.配置seafile服务端口
修改seahub监听地址
# vim /opt/seafile/conf/gunicorn.conf.py import os ...... # default localhost:8000 bind = "192.168.100.100:8800" ...... |
192.168.100.100替换成本机地址。
11.启动seafile服务
# cd /opt/seafile/seafile-server-latest # ./seafile.sh start ...... Seafile server started Done. # ./seahub.sh start Starting seahub at port 8000 ... ---------------------------------------- It's the first time you start the seafile server. Now let's create the admin account ---------------------------------------- What is the email for the admin account? [ admin email ] admin@test.com ------->输入邮箱 What is the password for the admin account? [ admin password ] **** ------->输入密码 Enter the password again: [ admin password again ] **** ------->再次输入确认密码 ---------------------------------------- Successfully created seafile admin ---------------------------------------- Seahub is started Done. |
测试访问seafile页面,在浏览器中输入:http://本机地址:8800
12.增加HTTPS接口
需要修改3个配置文件
/etc/httpd/conf.d/seafile.conf
/opt/seafile/conf/ccnet.conf
/opt/seafile/conf/seahub_settings.py
- 创建seafile的http配置文件seafile.conf
#sudo vim /etc/httpd/conf.d/seafile.conf Listen 8443 <VirtualHost *:8443> ServerName 192.168.100.100 DocumentRoot /var/www SSLEngine On SSLCertificateFile /opt/cluster_config/ssl/server.crt SSLCertificateKeyFile /opt/cluster_config/ssl/server.key Alias /media /opt/seafile/seahub/media <Location /media> Require all granted </Location> RewriteEngine On ProxyPass /seafhttp http://192.168.100.100:8082 ProxyPassReverse /seafhttp http://192.168.100.100:8082 RewriteRule ^/seafhttp - [QSA,L] SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=#1 ProxyPreserveHost On ProxyPass / http://192.168.100.100:8800/ ProxyPassReverse / http:192.168.100.100:8800/ </VirtualHost> |
替换192.168.100.100为实际环境本机地址。
- 修改ccnet.conf中SERVICE_URL配置
# vim /opt/seafile/conf/ccnet.conf [General] SERVICE_URL = https://192.168.100.100:8443 |
替换192.168.100.100为实际环境本机地址
- 在seahub_settings.py,添加FILE_SERVER_ROOT配置项
# vim /opt/seafile/conf/seahub_settings.py FILE_SERVER_ROOT = 'https://192.168.100.100:8443/seafhttp' |
替换192.168.100.100为实际环境本机地址。
- 重启服务httpd
# systemctl restart httpd |
- 重启seafile服务
#cd /opt/seafile/seafile-pro-server-7.1.22 #./seafile.sh restart #./seahub.sh restart |
- 验证https访问页面
访问地址https://替换为本机地址:8443