測試平臺:VM10虛擬機 妓笙,CentOS 7 64位若河,最小化安裝能岩。
一寞宫、最小化安裝的CentOS部署Seafile前的準(zhǔn)備工作
1、安裝虛機前將網(wǎng)絡(luò)類型設(shè)置為橋接方式拉鹃。
2辈赋、安裝時手工配置網(wǎng)卡IP、子網(wǎng)掩碼膏燕、網(wǎng)關(guān)钥屈、DNS,并且打開網(wǎng)絡(luò)開關(guān)坝辫。如果忘記打開篷就,reboot后網(wǎng)卡處于未激活狀態(tài),無法SSH登錄近忙,root 用戶本機登陸竭业,使用 nmtui 命令,激活網(wǎng)卡及舍。編輯網(wǎng)卡配置文件未辆,實現(xiàn)開機激活網(wǎng)卡。
#選擇第二項激活網(wǎng)卡
[root@localhost ~]# nmtui
#最后的數(shù)字是激活的網(wǎng)卡號锯玛,修改配置文件參數(shù) ?“ONBOOT=yes”
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno1677736
3咐柜、安裝完成后添加國內(nèi)yum軟件源,我采用的是163的源攘残。
#備份yum源配置文件
[root@localhost ~]# cp?/etc/yum.repos.d/CentOS-Base.repo??/etc/yum.repos.d/CentOS-Base.repo_backup
#編輯源配置文件
[root@localhost ~]#vi /etc/yum.repos.d/CentOS-Base.repo
#復(fù)制下面的文本拙友,替換掉源文件內(nèi)容:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#運行以下命令生成緩存
[root@localhost ~]#?yum clean all
[root@localhost ~]# yum?makecache
4、安裝wget下載程序
[root@localhost ~]# yum install wget
二歼郭、下載seafil社區(qū)版軟件包
[root@localhost ~]# wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.1.1_x86-64.tar.gz
三献宫、按部署手冊指引建立目錄、解壓文件
[root@localhost ~]# cd /
#在根目錄下創(chuàng)建目錄 haiwen
[root@localhost /]# mkdir haiwen
#把下載的服務(wù)端軟件包移到 haiwen目錄下
[root@localhost /]# mv /root/seafile-server_6.1.1_x86-64.tar.gz /haiwen/
[root@localhost /]# cd /haiwen
#解壓軟件包
[root@localhost haiwen]# tar -xzf seafile-server_6.1.1_x86-64.tar.gz
[root@localhost haiwen]# mkdir installed
[root@localhost haiwen]# mv seafile-server_6.1.1_x86-64.tar.gz installed/
四实撒、安裝MariaDB姊途、python2.7
[root@localhost haiwen]# yum install mariadb-server
[root@localhost haiwen]# yum install python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3
五涉瘾、啟動MariaDB服務(wù)并設(shè)置開機啟動,配置MariaDB初始根密碼
[root@localhost haiwen]# systemctl start mariadb.service
[root@localhost haiwen]# systemctl enable mariadb.service
[root@localhost haiwen]# mysql_ secure_installation
Enter current password for root (enter for none):??#初次運行直接回車
Set root password? [Y/n]??#是否設(shè)置root用戶密碼捷兰,輸入y并回車或直接回車
New password:??#設(shè)置root用戶的密碼
Re-enter new password:??#再輸入一次你設(shè)置的密碼
Remove anonymous users? [Y/n]??#是否刪除匿名用戶,生產(chǎn)環(huán)境建議刪除找岖,所以直接回車
Disallow root login remotely? [Y/n]??#是否禁止root遠(yuǎn)程登錄,根據(jù)自己的需求選擇Y/n并回車,建議禁止
Remove test database and access to it? [Y/n]??#是否刪除test數(shù)據(jù)庫,直接回車
Reload privilege tables now? [Y/n]??#是否重新加載權(quán)限表悔捶,直接回車
六、安裝Seafile
[root@localhost haiwen]# cd /haiwen/seafile-server-6.1.1/
[root@localhost seafile-server-6.1.1]# ./setup-seafile-mysql.sh
該腳本會依次詢問你一些問題,從而一步步引導(dǎo)你配置 Seafile 的各項參數(shù):
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ]? seatest
#服務(wù)器的名字垢夹,目前該配置已經(jīng)不再使用,這里填seatest
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 10.0.0.6
?#服務(wù)器的 IP 地址或者域名醉顽,客戶端通過這個 IP 或者地址來訪問你的 Seafile 服務(wù)并齐,這里填10.0.0.6
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/haiwen/seafile-data" ]??
#數(shù)據(jù)存放的目錄,默認(rèn)是 /data/haiwen/seafile-data驹沿,這里直接回車
Which port do you want to use for the seafile fileserver?
[ default "8082" ]??
#seafile fileserver 使用的 TCP 端口艘策,該端口用于文件同步,請使用默認(rèn)的 8082渊季,不能更改
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??
#要求選擇一種創(chuàng)建 Seafile 數(shù)據(jù)庫的方式朋蔫。選1,需要提供MariaDB初始根密碼却汉,程序會創(chuàng)建數(shù)據(jù)庫和用戶驯妄。選2,系統(tǒng)采用已創(chuàng)建的數(shù)據(jù)庫合砂。這里選1
What is the host of mysql server?
[ default "localhost" ]??
#數(shù)據(jù)庫主機名稱青扔,默認(rèn)即可,直接回車
What is the port of mysql server?
[ default "3306" ]??
#數(shù)據(jù)庫端口翩伪,默認(rèn)即可微猖,直接回車
what is the password of the mysql root user?
[ root password ]??
#數(shù)據(jù)庫根密碼,填寫MariaDB初始根密碼
verifying password of user root ...??done
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]??
#數(shù)據(jù)庫用戶名幻工,默認(rèn)即可励两,直接回車
Enter the password for mysql user "seafile":
[ password for seafile ]??
#數(shù)據(jù)庫對應(yīng)用戶名的密碼,可填寫MariaDB初始根密碼
Enter the database name for ccnet-server:
[ default "ccnet-db" ]??
#ccnet-server數(shù)據(jù)庫名稱囊颅,默認(rèn)即可当悔,直接回車
Enter the database name for seafile-server:
[ default "seafile-db" ]??
#seafile-server數(shù)據(jù)庫名稱,默認(rèn)即可踢代,直接回車
Enter the database name for seahub:
[ default "seahub-db" ]??
#seahub數(shù)據(jù)庫名稱盲憎,默認(rèn)即可,直接回車
--------------------------------
**This is your configuration**
server name:seatest
server ip/domain:???10.0.0.6
seafile data dir:???/haiwen/seafile-data
fileserver port:8082
database:???create new
ccnet database: ccnet-db
seafile database:???seafile-db
seahub database:seahub-db
database user:??seafile
---------------------------------
Press ENTER to continue, or Ctrl-C to abort
Generating ccnet configuration ...
done
Successly create configuration dir /haiwen/ccnet.
Generating seafile configuration ...
Done.
done
Generating seahub configuration ...
Now creating seahub database tables ...
creating seafile-server-latest symbolic link ...??done
Your seafile server configuration has been finished successfully.
run seafile server: ./seafile.sh { start | stop | restart }
run seahub??server: ./seahub.sh??{ start | stop | restart }
If you are behind a firewall, remember to allow input/output of these tcp ports:
port of seafile fileserver:???8082
port of seahub:???8000
When problems occur, Refer to
https://github.com/haiwen/seafile/wiki
for information.?
?#到這里安裝基本完成胳挎,進(jìn)一步配置防火墻饼疙,啟動Seafile相關(guān)服務(wù)即可使用
七、配置防火墻慕爬,打開需要用的端口
[root@localhost seafile-server-6.1.1]#??firewall-cmd --zone=public --add-port=8000/tcp --permanent
[root@localhost seafile-server-6.1.1]#??firewall-cmd --zone=public --add-port=8082/tcp --permanent
[root@localhost seafile-server-6.1.1]#??firewall-cmd --reload
八窑眯、啟動Seafile屏积、Seahub服務(wù)
[root@localhost seafile-server-6.1.1]#??./seafile.sh start
[root@localhost seafile-server-6.1.1]#??./seahub.sh start
在執(zhí)行seahub.sh腳本執(zhí)行過程中,設(shè)置seafile管理員帳號(郵箱注冊)磅甩、密碼炊林。
腳本執(zhí)行完成后,可以在瀏覽器地址欄中輸入服務(wù)器地址(帶端口號卷要,本例為10.0.0.6:8000)渣聚,測試基本功能。
九僧叉、設(shè)置Seafile開機啟動
這里采用seafile論壇neroxps的方法奕枝,官方手冊上的第一種方法沒成功。
#建立seafile服務(wù)
[root@localhost seafile-server-6.1.1]# vi /etc/systemd/system/seafile.service
輸入以下內(nèi)容瓶堕,注意修改“/haiwen”為你的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
[Service]
Type=oneshot
ExecStart=/haiwen/seafile-server-latest/seafile.sh start
# 如果seahub使用了nginx反代,請修改為 ExecStart=${seafile_dir}/seafile-server-latest/seahub.sh start-fastcgi
ExecStart=/haiwen/seafile-server-latest/seahub.sh start
ExecStop=/haiwen/seafile-server-latest/seafile.sh stop
ExecStop=/haiwen/seafile-server-latest/seahub.sh stop
RemainAfterExit=yes
# User 和 Group 如果未建立seafile用戶和用戶組,則修改為root,否則無法啟動.
User=root
Group=root
[Install]
WantedBy=multi-user.target
#運行systemctl daemon-reload使配置生效
[root@localhost seafile-server-6.1.1]# systemctl daemon-reload
按需要執(zhí)行命令:
#啟動seafile
[root@localhost seafile-server-6.1.1]# systemctl start seafile
#停止seafile
[root@localhost seafile-server-6.1.1]# systemctl stop seafile
#設(shè)置seafile隨系統(tǒng)啟動
[root@localhost seafile-server-6.1.1]# systemctl enable seafile
#檢查seafile是否已經(jīng)設(shè)置為自啟動
[root@localhost seafile-server-6.1.1]# systemctl is-enabled seafile
#關(guān)閉seafile隨系統(tǒng)啟動
[root@localhost seafile-server-6.1.1]# systemctl disable seafile