-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.sh
256 lines (212 loc) · 4.65 KB
/
main.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#!/bin/bash
###########################################################
#System Required: Centos 6+
#Description: Install the java tomcat mysql and tools
#Version: 2.0
#
# by---wang2017.7
###########################################################
workdir=$(cd $(dirname $0); pwd)
. ${workdir}/scripts/public.sh
for i in ${workdir}/scripts/*/*.sh; do
if [ -r "$i" ]; then
. "$i"
fi
done
chmod -R +x ${workdir}/bin
export PATH=${workdir}/bin:$PATH
mysql_tool(){
output_option 'MySQL常用脚本' '添加MySQL备份脚本 找回MySQLroot密码 ' 'other_tool'
case "$other_tool" in
1)multi_function_backup_script_set
;;
2)reset_mysql_passwd
;;
esac
}
basic_environment(){
output_option '请选择要安装的环境' 'JDK PHP Ruby Nodejs Go Erlang' 'basic'
for number in ${basic[@]}; do
case "$number" in
1)java_install_ctl
;;
2)php_install_ctl
;;
3)ruby_install_ctl
;;
4)node_install_ctl
;;
5)go_install_ctl
;;
6)erlang_install_ctl
;;
esac
done
}
web_services(){
output_option '请选择要安装的软件' 'Nginx Openresty Tomcat' 'web'
for number in ${web[@]}; do
case "$number" in
1)nginx_install_ctl
;;
2)openresty_install_ctl
;;
3)tomcat_install_ctl
;;
esac
done
}
database_services(){
output_option '请选择要安装的软件' 'MySQL Mongodb Redis Memcached Greenplum' 'database'
for number in ${database[@]}; do
case "$number" in
1)mysql_install_ctl
;;
2)mongodb_inistall_ctl
;;
3)redis_install_ctl
;;
4)memcached_inistall_ctl
;;
5)greenplum_install_ctl
;;
esac
done
}
middleware_services(){
output_option '请选择要安装的软件' 'ActiveMQ RocketMQ Zookeeper Kafka RabbitMQ Nacos' 'middleware'
for number in ${middleware[@]}; do
case "$number" in
1)activemq_install_ctl
;;
2)rocketmq_install_ctl
;;
3)zookeeper_install_ctl
;;
4)kafka_install_ctl
;;
5)rabbitmq_install_ctl
;;
6)nacos_install_ctl
;;
esac
done
}
storage_service(){
output_option '请选择要安装的软件' 'FTP SFTP 对象存储服务(OSS/minio) FastDFS NFS' 'storage'
for number in ${storage[@]}; do
case "$number" in
1)ftp_install_ctl
;;
2)sftp_install_ctl
;;
3)minio_install_ctl
;;
4)fastdfs_install_ctl
;;
5)nfs_install_ctl
;;
esac
done
}
operation_platform(){
output_option '请选择要安装的平台' 'ELK日志平台 Zabbix监控 LDAP统一认证 红帽服务器集群(RHCS) VPN隧道' 'operation'
for number in ${operation[@]}; do
case "$number" in
1)elk_install_ctl
;;
2)zabbix_install_ctl
;;
3)openldap_install_ctl
;;
4)rhcs_install_ctl
;;
5)vpn_install_ctl
;;
esac
done
}
virtualization_platform(){
output_option '请选择要安装的平台' 'Docker K8S系统 Rancher平台(k8s集群管理)' 'virtualization'
for number in ${virtualization[@]}; do
case "$number" in
1)docker_install_ctl
;;
2)k8s_install_ctl
;;
3)rancher_install_ctl
;;
esac
done
}
ha_load_balance_platform(){
output_option '请选择要安装的平台' 'keepalived haproxy lvs' 'balance'
for number in ${balance[@]}; do
case "$number" in
1)keepalived_install_ctl
;;
2)haproxy_install_ctl
;;
3)lvs_install_ctl
;;
esac
done
}
tools(){
output_option '请选择进行的操作' '优化系统配置 系统安全加固 查看系统详情 升级内核版本 安装WireGuard-VPN 多功能备份脚本 批量主机ssh互信 升级openssh' 'tools'
for number in ${tools[@]}; do
case "$number" in
1)system_optimize_set
;;
2)system_security_set
;;
3)sys_info_detail
;;
4)update_kernel
;;
5)wireguard_install_ctl
;;
6)multi_function_backup_script_set
;;
7)auto_ssh_keygen_tool
;;
8)updata_openssh_ctl
;;
esac
done
}
main(){
output_option '请选择需要安装的服务' '基础环境 WEB服务 数据库服务 中间件服务 存储服务 运维平台 虚拟化 集群负载 其他工具' 'mian'
for number in ${mian[@]}; do
case "$number" in
1)basic_environment
;;
2)web_services
;;
3)database_services
;;
4)middleware_services
;;
5)storage_service
;;
6)operation_platform
;;
7)virtualization_platform
;;
8)ha_load_balance_platform
;;
9)tools
;;
esac
done
}
clear
[[ $EUID -ne 0 ]] && echo -e "${error} Need to use root account to run this script!" && exit 1
echo -e "+ + + + + + + + + + + + + + + + + + + + + + + + + +"
echo -e "+ Description: Multi-function one-click script +"
echo -e "+ +"
echo -e "+ Version: 2.1 +"
echo -e "+ by---wang2017.7 +"
echo -e "+ + + + + + + + + + + + + + + + + + + + + + + + + +"
sys_info
main