在最小化安裝的CentOS 7下部署 Seafile 服務器(使用 MariaDB)

測試平臺:VM10虛擬機 ,CentOS 7 64位,最小化安裝。

一、最小化安裝的CentOS部署Seafile前的準備工作

1、安裝虛機前將網絡類型設置為橋接方式。

2、安裝時手工配置網卡IP、子網掩碼、網關、DNS,并且打開網絡開關。如果忘記打開,reboot后網卡處于未激活狀態,無法SSH登錄,root 用戶本機登陸,使用 nmtui 命令,激活網卡。編輯網卡配置文件,實現開機激活網卡。

#選擇第二項激活網卡

[root@localhost ~]# nmtui

#最后的數字是激活的網卡號,修改配置文件參數 ?“ONBOOT=yes”

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno1677736

3、安裝完成后添加國內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

#復制下面的文本,替換掉源文件內容:

# 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社區版軟件包

[root@localhost ~]# wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.1.1_x86-64.tar.gz

三、按部署手冊指引建立目錄、解壓文件

[root@localhost ~]# cd /

#在根目錄下創建目錄 haiwen

[root@localhost /]# mkdir haiwen

#把下載的服務端軟件包移到 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服務并設置開機啟動,配置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]??#是否設置root用戶密碼,輸入y并回車或直接回車

New password:??#設置root用戶的密碼

Re-enter new password:??#再輸入一次你設置的密碼

Remove anonymous users? [Y/n]??#是否刪除匿名用戶,生產環境建議刪除,所以直接回車

Disallow root login remotely? [Y/n]??#是否禁止root遠程登錄,根據自己的需求選擇Y/n并回車,建議禁止

Remove test database and access to it? [Y/n]??#是否刪除test數據庫,直接回車

Reload privilege tables now? [Y/n]??#是否重新加載權限表,直接回車

六、安裝Seafile

[root@localhost haiwen]# cd /haiwen/seafile-server-6.1.1/

[root@localhost seafile-server-6.1.1]# ./setup-seafile-mysql.sh

該腳本會依次詢問你一些問題,從而一步步引導你配置 Seafile 的各項參數:

What is the name of the server? It will be displayed on the client.

3 - 15 letters or digits

[ server name ]? seatest

#服務器的名字,目前該配置已經不再使用,這里填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

?#服務器的 IP 地址或者域名,客戶端通過這個 IP 或者地址來訪問你的 Seafile 服務,這里填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" ]??

#數據存放的目錄,默認是 /data/haiwen/seafile-data,這里直接回車

Which port do you want to use for the seafile fileserver?

[ default "8082" ]??

#seafile fileserver 使用的 TCP 端口,該端口用于文件同步,請使用默認的 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??

#要求選擇一種創建 Seafile 數據庫的方式。選1,需要提供MariaDB初始根密碼,程序會創建數據庫和用戶。選2,系統采用已創建的數據庫。這里選1

What is the host of mysql server?

[ default "localhost" ]??

#數據庫主機名稱,默認即可,直接回車

What is the port of mysql server?

[ default "3306" ]??

#數據庫端口,默認即可,直接回車

what is the password of the mysql root user?

[ root password ]??

#數據庫根密碼,填寫MariaDB初始根密碼

verifying password of user root ...??done

Enter the name for mysql user of seafile. It would be created if not exists.

[ default "seafile" ]??

#數據庫用戶名,默認即可,直接回車

Enter the password for mysql user "seafile":

[ password for seafile ]??

#數據庫對應用戶名的密碼,可填寫MariaDB初始根密碼

Enter the database name for ccnet-server:

[ default "ccnet-db" ]??

#ccnet-server數據庫名稱,默認即可,直接回車

Enter the database name for seafile-server:

[ default "seafile-db" ]??

#seafile-server數據庫名稱,默認即可,直接回車

Enter the database name for seahub:

[ default "seahub-db" ]??

#seahub數據庫名稱,默認即可,直接回車

--------------------------------

**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.?

?#到這里安裝基本完成,進一步配置防火墻,啟動Seafile相關服務即可使用

七、配置防火墻,打開需要用的端口

[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服務

[root@localhost seafile-server-6.1.1]#??./seafile.sh start

[root@localhost seafile-server-6.1.1]#??./seahub.sh start

在執行seahub.sh腳本執行過程中,設置seafile管理員帳號(郵箱注冊)、密碼。

腳本執行完成后,可以在瀏覽器地址欄中輸入服務器地址(帶端口號,本例為10.0.0.6:8000),測試基本功能。

九、設置Seafile開機啟動

這里采用seafile論壇neroxps的方法,官方手冊上的第一種方法沒成功。

#建立seafile服務

[root@localhost seafile-server-6.1.1]# vi /etc/systemd/system/seafile.service

輸入以下內容,注意修改“/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

按需要執行命令:

#啟動seafile

[root@localhost seafile-server-6.1.1]# systemctl start seafile

#停止seafile

[root@localhost seafile-server-6.1.1]# systemctl stop seafile

#設置seafile隨系統啟動

[root@localhost seafile-server-6.1.1]# systemctl enable seafile

#檢查seafile是否已經設置為自啟動

[root@localhost seafile-server-6.1.1]# systemctl is-enabled seafile

#關閉seafile隨系統啟動

[root@localhost seafile-server-6.1.1]# systemctl disable seafile

OK,完成。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 228,983評論 6 537
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 98,772評論 3 422
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事?!?“怎么了?”我有些...
    開封第一講書人閱讀 176,947評論 0 381
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,201評論 1 315
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 71,960評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,350評論 1 324
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,406評論 3 444
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,549評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,104評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 40,914評論 3 356
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,089評論 1 371
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,647評論 5 362
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,340評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,753評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,007評論 1 289
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,834評論 3 395
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,106評論 2 375

推薦閱讀更多精彩內容