-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_seafile.sh
89 lines (83 loc) · 2.62 KB
/
install_seafile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
################ 一键安装Seafile脚本 ##################
#Author:xiaoz.me
#Update:2017-12-06
#update by ben:208-02-23--->update version to 6.2.5,change floder name to bencloud
####################### END #######################
#防火墙放行端口
function chk_firewall() {
if [ -e "/etc/sysconfig/iptables" ]
then
iptables -I INPUT -p tcp --dport 8000 -j ACCEPT
iptables -I INPUT -p tcp --dport 8082 -j ACCEPT
service iptables save
service iptables restart
else
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --reload
fi
}
#安装seafile函数
function install_sea() {
cd /home/bencloud
#下载安装包6.2.5 64bit
wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.2.5_x86-64.tar.gz
#解压
tar -zxvf seafile-server_6.2.5_x86-64.tar.gz
mkdir installed
mv seafile-server*.tar.gz ./installed
mv seafile-server-6* seafile-server-6.2.5
#安装依赖环境
yum -y install python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3
#进行安装
cd seafile-server-6.2.5 && ./setup-seafile.sh
#启动服务
./seafile.sh start && ./seahub.sh start
#防火墙放行端口
chk_firewall
#开机启动
echo "/home/bencloud/seafile-server-6.2.5/seafile.sh start" >> /etc/rc.d/rc.local
echo "/home/bencloud/seafile-server-6.2.5/seahub.sh start" >> /etc/rc.d/rc.local
chmod u+x /etc/rc.d/rc.local
#获取IP
osip=$(curl http://https.tn/ip/myip.php?type=onlyip)
echo "------------------------------------------------------"
echo "恭喜,安装完成。请访问:http://${osip}:8000"
echo "帮助文档请访问:https://www.xiaoz.me/archives/8480"
echo "阿里云用户请注意放行端口(8000/8082):https://www.xiaoz.me/archives/9310"
echo "------------------------------------------------------"
}
echo "########## 欢迎使用Seafile一键安装脚本^_^ ##########"
echo "1.安装Seafile"
echo "2.卸载Seafile"
echo "3.退出"
declare -i stype
read -p "请输入选项:(1.2.3):" stype
if [ "$stype" == 1 ]
then
#检查目录是否存在
if [ -e "/home/bencloud" ]
then
echo "目录存在,请检查是否已经安装。"
exit
else
echo "目录不存在,创建目录..."
mkdir -p /home/bencloud
#执行安装函数
install_sea
fi
elif [ "$stype" == 2 ]
then
/home/bencloud/seafile-server-6.2.5/seafile.sh stop
/home/bencloud/seafile-server-6.2.5/seahub.sh stop
rm -rf /home/bencloud
rm -rf /tmp/seahub_cache/*
echo '卸载完成.'
exit
elif [ "$stype" == 3 ]
then
exit
else
echo "参数错误!"
fi