centos7部署seafile


一、准備工作
 1.1 安裝wget、vim

yum install -y wget vim

 

 1.2 關閉防火牆

systemctl stop firewalld
systemctl disable firewalld

 

 1.3 安裝epel、Nux Dextop
 # 安裝epel源

rpm -ivh http://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm

 

 # 安裝Nux Dextop源

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-5.el7.nux.noarch.rpm

  


 二、部署seafile
 2.1 安裝mysql/mariadb
 # 選擇安裝mariadb

yum -y install mariadb mariadb-server

 

 # 啟動、開機啟動

systemctl start mariadb
systemctl enable mariadb

 

 # 安全設置

mysql_secure_installation

 # 根據下面的內容進行設置

復制代碼
# 第一次運行密碼為空,回車。
Enter current password for root (enter for none):
    
# 需要設置root密碼,輸入y后回車。
Set root password? [Y/n] y
接着輸入兩次新密碼。
    
# 是否刪除匿名用戶,回車。
Remove anonymous users? [Y/n]
        
# 是否禁止root遠程登錄,回車。
Disallow root login remotely? [Y/n]
        
# 是否刪除test數據庫,回車。
Remove test database and access to it? [Y/n]
    
# 是否重新加載權限表,回車。
Reload privilege tables now? [Y/n]
復制代碼

 

 # 使用root賬戶登錄mariadb

mysql -uroot -p

 # 能連得進去說明剛才的設置已經生效

 

 # 退出mariadb 

exit

 

PS.如果需要遠程連接,可以用下面的內容設置。 

# 允許任意ip使用root遠程連接
create user 'root'@'%' identified by 'root遠程登錄的密碼';
# 添加權限給該root
grant all privileges on *.* to 'root'@'%' identified by 'root遠程登錄的密碼';
# 配置立即生效
flush privileges;

 

 2.2 安裝依賴項 

復制代碼
yum install -y python-memcached \
  python-ldap \
  python-urllib3 \
  python-imaging \
  MySQL-python \
  python-distribute \
  ffmpeg \
  ffmpeg-devel
復制代碼

 

 2.3 安裝seafile

 # 獲取安裝包 

cd
wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.2.5_x86-64.tar.gz

 

 # 解壓 

tar zxf seafile-server_6.2.5_x86-64.tar.gz

 

 # 運行shell腳本安裝 

cd seafile-server-*
./setup-seafile-mysql.sh

 # 根據下面的內容進行設置 

復制代碼
# 顯示給客戶端的服務名,輸入服務名后回車。
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] OpsBakPE

# 輸入ip或域名,由於內部使用直接ip,輸入ip后回車。
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 192.168.16.203

# 使用默認,將數據文件放在/root/seafile-data下,回車。
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/root/seafile-data" ]

# 使用默認的文件服務端口8082,回車。
Which port do you want to use for the seafile fileserver?
[ default "8082" ]

# 使用新的seahub數據庫,輸入1后回車。
-------------------------------------------------------
Please choose a way to initialize seafile databases:
-------------------------------------------------------

[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases

[ 1 or 2 ] 1

# 由於剛才裝了mariadb,使用默認本地,回車。
What is the host of mysql server?
[ default "localhost" ]

# mariadb的默認端口就是3306,回車。
What is the port of mysql server?
[ default "3306" ]

# 使用默認的seafile作為seafile使用mariadb的用戶,回車。
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]

# 輸入mariadb的用戶seafile的密碼,回車。
Enter the password for mysql user "seafile":
[ password for seafile ]

# 使用默認ccnet-db作為ccnet-server使用的數據庫名,回車。
Enter the database name for ccnet-server:
[ default "ccnet-db" ]

# 使用默認seafile-db作為seafile-server使用的數據庫名,回車。
Enter the database name for seafile-server:
[ default "seafile-db" ]

# 使用默認seahub-db作為seahub使用的數據庫名,回車。
Enter the database name for seahub:
[ default "seahub-db" ]
復制代碼

# 檢查配置項,沒有問題回車安裝。

 

 # 等待片刻,安裝完成。

 

 

 2.4 啟動seafile、seahub

  # 啟動seafile服務 

./seafile.sh start

 

 # 啟動seahub網站(這里加了80端口,不加端口的情況下默認運行在8000端口上) 

./seahub.sh start 80

 PS.第一次啟動 seahub 時,seahub.sh腳本會提示創建seafile管理員帳號(郵箱名)。

 

 2.5 訪問seafile

 瀏覽器訪問http://部署seafile的虛擬機IP,使用剛才創建的管理員賬號登錄。

 

  


 三、設置開機啟動

 3.1 首先停止seafile、seahub服務 

cd /root/seafile-server-*
./seafile.sh stop
./seahub.sh stop

 

 3.2 創建seafile.service 

vim /etc/systemd/system/seafile.service

 # 添加下面的內容,wq保存。 

復制代碼
[Unit]
Description=Seafile
After=mariadb.service

[Service]
Type=oneshot
ExecStart=/root/seafile-server-6.2.5/seafile.sh start
ExecStop=/root/seafile-server-6.2.5/seafile.sh stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
復制代碼

 

 3.3 創建seahub.service 

vim /etc/systemd/system/seahub.service

 # 添加下面的內容,wq保存。

復制代碼
[Unit]
Description=Seafile hub
After=network.target seafile.service

[Service]
ExecStart=/root/seafile-server-6.2.5/seahub.sh start 80
ExecStop=/root/seafile-server-6.2.5/seahub.sh stop
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
復制代碼

 

 3.4 啟動、開機啟動seafile、seahub 

systemctl start seafile
systemctl enable seafile    
systemctl start seahub
systemctl enable seahub


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM