千家信息网

Ubuntu18如何搭建Seafile7.0版本

发表于:2025-02-03 作者:千家信息网编辑
千家信息网最后更新 2025年02月03日,本篇内容介绍了"Ubuntu18如何搭建Seafile7.0版本"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够
千家信息网最后更新 2025年02月03日Ubuntu18如何搭建Seafile7.0版本

本篇内容介绍了"Ubuntu18如何搭建Seafile7.0版本"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

环境:Ubuntu18.04、Samba、Apache2.4、MySQL5.7

参考资料:https://cloud.seafile.com/published/seafile-manual-cn/deploy/using_mysql.md

# 更新源sudo apt update && upgrade# 安装必备软件包sudo apt install -y python-dev libpython2.7 python-pip python-setuptools python-pil python-mysqldb python-ldap python-urllib3 python-memcache ffmpeg# 如果提示安装失败,可尝试重新执行# 新建文件夹名字自定义,案例中使用'haiwen'这个名称,用来放置Seafile# 假如放在当前用户下 '/home/demo/haiwen'# 通过samba共享文件夹share,上传安装包到share# 由于pipy下载不稳定,我预先下载了部分组件:pillow、numpy、moviepy-1.0.1# 手动安装离线包sudo -H pip install Pillow-6.2.0-cp27-cp27mu-manylinux1_x86_64.whlsudo -H pip install numpy-1.16.5-cp27-cp27mu-manylinux1_x86_64.whldemo@ubuntu:~/share/moviepy-1.0.1$ sudo python setup.py install# 启用Apache反向代理模块sudo a2enmod rewrite proxy_http# 将Seafile安装包复制到/home/demo/haiwen下# 新建'installed'文件夹,解压seafile安装包,解压完毕后将压缩包移动到'installed'文件夹里。# 进入seafile文件夹# cd ./seafile-server-lastest# 配置过程不需要用root权限# 配置数据库,根据提示填写./setup-seafile-mysql.sh# 启动seafile# ./seafile.sh { start | stop | restart }# 启动seahub,首次启动需要设置管理员# run seahub  server:     ./seahub.sh  { start  | stop | restart  }

启用Apache反向代理

# 启用代理功能sudo a2enmod rewrite proxy_http# 增加防火墙规则sudo ufw allow 8000sudo ufw allow 8082# 修改代理配置cd /etc/apache2/sites-enabledsudo cp 000-default.conf 000-default.conf.baksudo vim 000-default.conf# 修改如下:                # ServerName www.myseafile.com                        ServerAdmin webmaster@localhost                DocumentRoot /var/www/html                Alias /media  /home/demo/haiwen/seafile-server-latest/seahub/media                RewriteEngine On                                        Require all granted                                #                # seafile fileserver                #                ProxyPass /seafhttp http://127.0.0.1:8082                ProxyPassReverse /seafhttp http://127.0.0.1:8082                RewriteRule ^/seafhttp - [QSA,L]                #                # seahub                #                SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1                ProxyPass / http://127.0.0.1:8000/                ProxyPassReverse / http://127.0.0.1:8000/                                ErrorLog ${APACHE_LOG_DIR}/error.log                CustomLog ${APACHE_LOG_DIR}/access.log combined        # 修改完毕后重启apache服务sudo /etc/init.d/apache2 restart# 至此,已经可以用web登陆Seafile。

添加自启动功能

# 新建seafile服务sudo vim /etc/systemd/system/seafile.service# 内容[Unit]Description=Seafile# add mysql.service or postgresql.service depending on your database to the line belowAfter=network.target[Service]Type=oneshotExecStart=/home/demo/haiwen/seafile-server-latest/seafile.sh startExecStop=/home/demo/haiwen/seafile-server-latest/seafile.sh stopRemainAfterExit=yesUser=demoGroup=demo[Install]WantedBy=multi-user.target# 新建seahub服务sudo vim /etc/systemd/system/seahub.service[Unit]Description=Seafile hubAfter=network.target seafile.service[Service]# change start to start-fastcgi if you want to run fastcgiExecStart=/home/demo/haiwen/seafile-server-latest/seahub.sh startExecStop=/home/demo/haiwen/seafile-server-latest/seahub.sh stopUser=demoGroup=demoType=oneshotRemainAfterExit=yes[Install]WantedBy=multi-user.target# 启用服务sudo systemctl enable seafile.servicesudo systemctl enable seahub.servicesudo systemctl daemon-reload

"Ubuntu18如何搭建Seafile7.0版本"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!

0