Centos_Seafile搭建
Posted RedHat服务
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos_Seafile搭建相关的知识,希望对你有一定的参考价值。
Seafile搭建
安装 wget
yum install wget -y
创建lnmp文件 用于安装lnmp
mkdir /lnmp
cd /lnmp
安装lnmp
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp
选择安装mysql 5.6
输入数据库密码
开启indb 一定要开启 否则无法运行seafile
安装php 7.0
默认就行
安装完成
创建 seaflie文件夹
mkdir /opt/seafile/
cd /opt/seafile/
下载seafile安装包
//seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_7.0.5_x86-64.tar.gz :
解压seafile安装包
tar -zxvf seafile-server_7.0.5_x86-64.tar.gz
mv seafile-server-7.0.5 seafile-server 改个名字
cd seafile-server 进入安装包文件夹
安装必要依赖
yum install python python-setuptools MySQL-python python-urllib3 python-ldap -y
安装seafle程序
./setup-seafile-mysql.sh
按下回车 提示输入 名称 随便输入
输入 刚刚创建的数据库密码 这里不会显示 输入完直接回车
等待安装完成
安装完成
开启相关端口
开启防火墙
systemctl start firewalld
开启防火墙开机自启
systemctl enable firewalld
开放端口
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8889/tcp --permanent
firewall-cmd --zone=public --add-port=10001/tcp --permanent
firewall-cmd --zone=public --add-port=12001/tcp --permanent
让端口生效
firewall-cmd --reload
启动seafile
./seafile.sh start
./seahub.sh start
创建管理员邮箱和密码
设置开机自启seafile
新建seafile.service文件
vi /etc/systemd/system/seafile.service
输入以下内容(注意修改${seafile_dir}为你的seafile目录)
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
# 如果没有使用memcached则去掉memcached.service
After=network.target mariadb.service memcached.service
[Service]
Type=oneshot
ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start
# 如果seahub使用了nginx反代,请修改为 ExecStart=
/opt/seafile/seafile-server-latest/seahub.sh start-fastcgi
ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh restart
ExecStop=/opt/seafile/seafile-server-latest/seahub.sh restart
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop
ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop
RemainAfterExit=yes
# User 和 Group 如果未建立seafile用户和用户组,则修改为root,否则无法启动.
User=root
Group=root
[Install]
WantedBy=multi-user.target
运行systemctl daemon-reload使配置生效
systemctl daemon-reload
命令
systemctl start seafile #启动seafile
systemctl stop seafile #停止seafile
systemctl enable seafile #设置seafile随系统启动
systemctl is-enabled seafile #检查seafile是否已经设置为自启动
systemctl disable seafile #关闭seafile随系统启动
设置上传下载限制
vi /opt/seafile/conf/seafile.conf
# 上传文件最大为20000M.
max_upload_size=20000
# 最大下载目录限制为20000M.
max_download_dir_size=20000
添加一个端口网站 具体如下
lnmp vhost add
创建日志文件存放
touch /opt/seafile/logs/seahub.access.log
touch /opt/seafile/logs/seahub.error.log
定位到nginx下的配置文件
cd /usr/local/nginx/conf/vhost/
map $http_x_forwarded_proto $the_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
map $http_x_forwarded_host $the_host {
default $http_x_forwarded_host;
"" $host;
}
map $http_upgrade $proxy_connection {
default upgrade;
"" close;
}
server
{
listen 80;
server_name 10.25.2.220;
index index.html index.htm index.php default.html default.htm default.php;
server_name seafile.example.com;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
//127.0.0.1:8000; :
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /opt/seafile/logs/seahub.access.log;
error_log /opt/seafile/logs/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
//127.0.0.1:8082; :
client_max_body_size 0;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
location /onlyofficeds/ {
//10.10.1.23:8889/; :
proxy_http_version 1.1;
client_max_body_size 100M; # Limit Document size to 100MB
proxy_read_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
设置默认的 端口80
cd /usr/local/nginx/conf
vi nginx.conf
重启nginx
service nginx restart
安装 wget 方便下载
yum -y install wget
下载yum源
cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
刷新
yum repolist
安装docker-ce
yum -y install docker-ce
安装完成后启动 docker
systemctl start docker
systemctl enable docker
vi /etc/docker/daemon.json
添加
{
"registry-mirrors":["https://6w4lyiz2.mirror.aliyuncs.com"]
}
按下ESC 在输入 :wq 保存退出
docker运行下载onlyoffice,此处设置onlyoffice监听端口为8889
docker run -i -t -d --restart=always -p 8889:80 onlyoffice/documentserver
#--restart=always表示每次开机,只要当docker被设置为开机启动,此onlyoffice就会自动运行 等待会有点久,如果等待6分钟-10分钟还没下载完成就 ctrl+c结束 重新运行
安装完成
查看docker镜像
docker ps
测试安装情况
访问:打开浏览器访问
http://x.x.x.x:8889/welcome x.x.x.x替换成自己的服务器IP
编辑seahub_settings.py 程序
vi /opt/seafile/conf/seahub_settings.py
# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http://10.25.2.220:8889/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx','ppt','xls','doc')
设置邮箱系统 修改对于的邮件和密码
vi /opt//opt/seafile/conf/seahub_settings.py
EMAIL_USE_SSL = True
EMAIL_HOST = 'smtp.exmail.qq.com'
EMAIL_HOST_USER = 'centosm@qq.com邮箱'
EMAIL_HOST_PASSWORD = 'hQsyPfCWVYi密码'
EMAIL_PORT = '465'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER
修改端口设置(不修改的话无法在线编辑)把这里的8000端口删除
重启seafile程序
/opt/seafile/seafile-server/seafile.sh restart
/opt/seafile/seafile-server/seahub.sh restart
登入账号密码
点击公共----点击添加资料库----点击新建资料库----新建一个文件夹 test
进入test,上传一个 word excel ppt pdf 检查是能够在线编辑
以上是关于Centos_Seafile搭建的主要内容,如果未能解决你的问题,请参考以下文章