使用 seafile搭建私有云盤

幻夢空間發表於2018-10-03

一、系統環境

系統:CentOS7-1708
IP地址:192.168.159.33

二、安裝seafile

[root@seafile ~]# yum -y install epel-release
[root@seafile ~]# rpm –import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
[root@seafile ~]# yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
[root@seafile ~]# yum -y install python-pip
[root@seafile ~]# pip install –upgrade pip
[root@seafile ~]# pip install pillow moviepy
[root@seafile ~]# yum install -y mariadb-server ##安裝資料庫
[root@seafile ~]# systemctl enable mariadb ##設定資料庫開機啟動
[root@seafile ~]# systemctl start mariadb ##啟動資料庫
[root@seafile ~]# mysql_secure_installation ##為資料庫設定密碼
[root@seafile ~]# wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.2.3_i386.tar.gz ##下載seafile軟體包
[root@seafile ~]# tar -zxf seafile-server_6.2.3_x86-64.tar.gz ##解壓軟體包
[root@seafile ~]# mkdir -p seafile/installed/ ##建立安裝包存放位置
[root@seafile ~]# mv seafile-server_6.2.3_x86-64.tar.gz seafile/installed/
[root@seafile ~]# mv seafile-server-6.2.3/ seafile/
[root@seafile ~]# cd seafile/
[root@seafile seafile]# cd seafile-server-6.2.3/
[root@seafile seafile-server-6.2.3]# ./setup-seafile-mysql.sh ##會要填很多資訊,按要求填就可以了

三、設定防火牆、selinux

設定SELinux
[root@seafile ~]#vi /etc/selinux/config
將SELINUX=enforcing改為SELINUX=disabled
使selinux立即生效
[root@seafile ~]#setenforce 0
新增防火牆允許通行埠
[root@seafile ~]#firewall-cmd –zone=public –add-port=8000/tcp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=8082/tcp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=3306/tcp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=10001/tcp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=12001/tcp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=8000/udp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=8082/udp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=3306/udp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=10001/udp –permanent
[root@seafile ~]#firewall-cmd –zone=public –add-port=12001/udp –permanent
[root@seafile ~]#firewall-cmd –reload ##載入防火牆規則使其立即生效
[root@seafile ~]#firewall-cmd –zone=public –list-ports ##檢視放行埠

四、啟動seafile

啟動seafile
[root@seafile seafile-server-6.2.3]# ./seafile.sh start # 啟動 Seafile 服務
[root@seafile seafile-server-6.2.3]# ./seahub.sh start # 啟動 Seahub 網站 (預設執行在8000埠上),可指定埠
設定開機啟動(ExecStart ExecStop替換為相應安裝位置)
[root@seafile ~]#vi /usr/lib/systemd/system/seafile.service
[Unit]
Description=Seafile Service
After=network.target
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/seafile/seafile/seafile.sh start
ExecStart=/seafile/seafile/seahub.sh start
#ExecStop=/seafile/seafile/seafile.sh stop
#ExecStop=/seafile/seafile/seahub.sh stop
[Install]
WantedBy=multi-user.target
[root@seafile ~]#systemctl enable seafile
[root@seafile ~]#systemctl start seafile
[root@seafile ~]#systemctl status seafile

相關文章