forked from helloxz/seafile
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_seafile.sh
80 lines (74 loc) · 2.18 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
#!/bin/bash
################ 一键安装Seafile脚本 ##################
#Author:xiaoz.me
####################### 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/MyCloud
#下载安装包6.0.9 64bit
wget "https://download.seafile.com/d/6e5297246c/files/?p=/pro/seafile-pro-server_6.1.4_x86-64.tar.gz&dl=1" -O seafile-pro-server_6.1.4_x86-64.tar.gz
#解压
tar -zxvf seafile-pro-server_6.1.4_x86-64.tar.gz
mkdir installed
mv seafile-pro-server_6.1.4_x86-64.tar.gz ./installed
mv seafile-pro-server_6.1.4_x86-64.tar.gz seafile-server
#安装依赖环境
yum -y install python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3 jre
#进行安装
cd seafile-pro-server-6.1.4 && ./setup-seafile.sh
#启动服务
./seafile.sh start && ./seahub.sh start
#防火墙放行端口
chk_firewall
#获取IP
osip=$(curl http://https.tn/ip/myip.php?type=onlyip)
echo "恭喜,安装完成。请访问:http://${osip}:8000"
echo "帮助文档请访问:https://www.xiaoz.me/archives/8480"
}
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/MyCloud" ]
then
echo "目录存在,请检查是否已经安装。"
exit
else
echo "目录不存在,创建目录..."
mkdir -p /home/MyCloud
#执行安装函数
install_sea
fi
elif [ "$stype" == 2 ]
then
/home/MyCloud/seafile-server/seafile.sh stop
/home/MyCloud/seafile-server/seahub.sh stop
rm -rf /home/MyCloud
rm -rf /tmp/seahub_cache/*
echo '卸载完成.'
exit
elif [ "$stype" == 3 ]
then
exit
else
echo "参数错误!"
fi