天翼雲主機安裝seafile7.0.3

關閉天翼雲主機的防火牆和selinux,操作系統是centos 7.6 ,天翼雲主機默認不開放80,443端口,需要開放必須去做備案,故下面教程使用其它的端口,如開放了80,443的,請修改配置文件的對應端口即可

1.安裝epel源和wget和上傳下傳插件
命令:
yum -y install epel-release wget lrzsz
天翼雲主機安裝seafile7.0.3

2.安裝nux
命令:
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
天翼雲主機安裝seafile7.0.3

3.安裝python-pip
命令:
yum -y install python-pip
天翼雲主機安裝seafile7.0.3

4.更新pip setuptools工具
命令:
pip install --upgrade setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple
天翼雲主機安裝seafile7.0.3

5.更新pip
命令:
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
天翼雲主機安裝seafile7.0.3

6.安裝 docker-compose
命令:
pip install docker-compose --ignore-installed requests -i https://pypi.tuna.tsinghua.edu.cn/simple
天翼雲主機安裝seafile7.0.3

7.安裝依賴包和nginx
命令:
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel nginx
天翼雲主機安裝seafile7.0.3

8.安裝pillow moviepy
命令:pip install pillow moviepy
天翼雲主機安裝seafile7.0.3

9.編輯Mariadb數據庫yum源
命令:
vi /etc/yum.repos.d/mariadb.repo 並輸入如下內容
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.4/centos7-amd64
gpgkey = https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
天翼雲主機安裝seafile7.0.3

10.安裝mariadb數據庫
命令:
yum -y install MariaDB-server MariaDB-client
天翼雲主機安裝seafile7.0.3

11.啓動數據庫
命令:
systemctl start mariadb
天翼雲主機安裝seafile7.0.3

12.對數據庫進行密碼設置(數據庫root用戶的密碼)
命令:mysql_secure_installation
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3

13.登錄數據庫
命令:
mysql -uroot -pa123456
天翼雲主機安裝seafile7.0.3

14.創建seafile需要的數據庫及用戶,並對此些數據庫進行授權
命令:
create database ccnet_db character set = 'utf8';
create database seafile_db character set = 'utf8';
create database seahub_db character set = 'utf8';
create user seafile@'192.168.80.%' identified by 'b123456';
grant all privileges on ccnet_db. to seafile@'192.168.80.%' identified by 'b123456';
grant all privileges on seafile_db.
to seafile@'192.168.80.%' identified by 'b123456';
grant all privileges on seahub_db.* to seafile@'192.168.80.%' identified by 'b123456';
flush privileges;
exit
天翼雲主機安裝seafile7.0.3
說明:天翼雲主機給我分配的內網地址如下(故使用192.168.1.X網段,如果不是此網段請修改)
天翼雲主機安裝seafile7.0.3

15.新建目錄並把seafile安裝文件上傳至此目錄
命令:
mkdir -pv /usr/local/seafile
cd /usr/local/seafile
天翼雲主機安裝seafile7.0.3

16.解壓seafile安裝文件並改名(改名是爲了方便好記)
命令:
tar xf seafile-server_7.0.3_x86-64.tar.gz
天翼雲主機安裝seafile7.0.3

17.安裝seafile
命令:
cd /usr/local/seafile/seafile-server
./setup-seafile-mysql.sh
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3

18.啓動seafile服務,如果新建並是第一次啓動seahub,會讓你輸入用戶名和密碼(此用戶名和密碼是用於登錄web的管理員)
命令:
./seafile.sh start
./seahub.sh start
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3

19.修改seafile的conf目錄中的gunicorn.conf配置文件(seafile從6.3版本開始,默認不允許直接使用IP:8001訪問)
命令:
vi /usr/local/seafile/conf/gunicorn.conf
修改裏面的內容,
把bind = "127.0.0.1:8000"修改爲bind = "0.0.0.0:8001"
天翼雲主機安裝seafile7.0.3

20.重新啓動seafile.sh和seahub.sh
命令:
cd /usr/local/seafile/seafile-server
./seafile.sh restart
./seahub.sh restart
天翼雲主機安裝seafile7.0.3

21.在瀏覽器訪問測試是否能正常訪問和登錄
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3

22.如果需要使用80端口直接訪問,需要把配置文件gunicorn.con修改回來,並安裝nginx和啓用編輯nginx
命令:
vi /usr/local/seafile/conf/gunicorn.conf
修改裏面的內容,
把bind = "0.0.0.0:8001"修改爲bind = "127.0.0.1:8000"
天翼雲主機安裝seafile7.0.3

23.前面已經安裝了nginx,現修改nginx編輯文件(爲了默認的配置文件上修改,故可以在默認配置文件上的包含的conf路徑下創建一個seafile.conf文件,以方便管理
命令:
vi /etc/nginx/conf.d/seafile.com
添加如下內容:圖片的截圖是包含有fastcgi的,在此#被加粗了,故刪除,如需要,可以參考官網
server {
listen 888;
server_name cloud.jvtc.com.cn;
proxy_set_header X-Forwarded-For $remote_addr;

location / {
     proxy_pass         http://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      /var/log/nginx/seahub.access.log;
     error_log       /var/log/nginx/seahub.error.log;
}   

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass http://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 /media {
    root /usr/local/seafile/seafile-server-latest/seahub;   
}

}
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3
天翼雲主機安裝seafile7.0.3

24.在seafile的配置目錄中編輯seahub_settings.py文件
命令:
vi /usr/local/seafile/conf/seahub_settings.py
在文件中添加如下一行
FILE_SERVER_ROOT = 'http://域名或IP/seafhttp'
天翼雲主機安裝seafile7.0.3

25.重啓啓動nginx,seafile和seahub
命令:
nginx -t 檢查nginx配置文件有沒有語法錯誤,如沒有,執行systemctl restart nginx重啓nginx
systemctl restart nginx
cd /usr/loca/seafile/seafile-server
./seafile.sh restart
./seahub.sh restart
天翼雲主機安裝seafile7.0.3

26.瀏覽器訪問是否正常
天翼雲主機安裝seafile7.0.3

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章