私人云存储

seafile

一键脚本安装

1
2
3
yum install wget -y
wget https://raw.githubusercontent.com/helloxz/seafile/master/install_seafile.sh
chmod +x install_seafile.sh && ./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 http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.1.1_x86-64.tar.gz
#解压
tar -zxvf seafile-server_6.1.1_x86-64.tar.gz
mkdir installed
mv seafile-server*.tar.gz ./installed
mv seafile-server-6* seafile-server
#安装依赖环境
yum -y install python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3
#进行安装
cd seafile-server && ./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