-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathinstall.sh
executable file
·229 lines (188 loc) · 5.3 KB
/
install.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
#!/usr/bin/env bash
# Copyright:: Copyright (c) 2016 Been Kyung-yoon (http://www.php79.com/)
# License:: The MIT License (MIT)
STACK_ROOT=$( cd "$( dirname "$0" )" && pwd )
source "${STACK_ROOT}/includes/function.inc.sh"
cd ${STACK_ROOT}
### PHP base version check
PHP_BASE_INSTALL=PHP$PHP_BASE
if [ "${!PHP_BASE_INSTALL}" = "0" ]; then
abort "PHP_BASE=${PHP_BASE} 설정을 위해서는 PHP ${PHP_BASE} 을 설치해야 합니다. (PHP${PHP_BASE}=1)";
fi
### Welcome
welcome
### Main
outputComment "Install options:\n"
options
echo
if [ "$INTERACTIVE" = "1" ]; then
outputQuestion "Do you want to install? (위 패키지들을 설치하시겠습니까?) [n/Y]"
read -p " " -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
abort
fi
fi
### Init
cmd_once "scripts/init.sh"
### Disable SELinux
cmd_once "scripts/selinux-disable.sh"
### Time zone
cmd_once "scripts/timezone.sh ${TIMEZONE}"
### Nginx
if [ $NGINX = "1" ]; then
cmd_once "scripts/nginx-install.sh"
fi
### Let's Encrypt 자동화툴
if [ $LETSENCRYPT = "1" ]; then
cmd_once "scripts/letsencrypt-install.sh"
fi
### PHP
PHP_INSTALLED=
if [ "$OS" != "rocky8" ]; then
if [ $PHP53 = "1" ]; then
if [ $OS = "centos7" ]; then
#cmd_once "scripts/mariadb-repo-install.sh"
cmd_once "scripts/centos7-php53-install.sh"
else
cmd_once "scripts/centos6-php53-install.sh"
fi
PHP_INSTALLED=53
fi
if [ $PHP54 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php5-remi-install.sh 54"
PHP_INSTALLED=54
fi
if [ $PHP55 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php5-remi-install.sh 55"
PHP_INSTALLED=55
fi
fi
if [ $PHP56 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php5-remi-install.sh 56"
PHP_INSTALLED=56
fi
if [ $PHP70 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php7-remi-install.sh 70"
PHP_INSTALLED=70
fi
if [ $PHP71 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php7-remi-install.sh 71"
PHP_INSTALLED=71
fi
if [ $PHP72 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php7-remi-install.sh 72"
PHP_INSTALLED=72
fi
if [ $PHP73 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php7-remi-install.sh 73"
PHP_INSTALLED=73
fi
if [ $PHP74 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php7-remi-install.sh 74"
PHP_INSTALLED=74
fi
if [ $PHP80 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php8-remi-install.sh 80"
PHP_INSTALLED=80
fi
if [ $PHP81 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php8-remi-install.sh 81"
PHP_INSTALLED=81
fi
if [ $PHP82 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php8-remi-install.sh 82"
PHP_INSTALLED=82
fi
if [ $PHP83 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php8-remi-install.sh 83"
PHP_INSTALLED=83
fi
if [ "$OS" = "rocky8" ]; then
if [ $PHP84 = "1" ]; then
cmd_once "scripts/remi-repo-install.sh"
cmd_once "scripts/php8-remi-install.sh 84"
PHP_INSTALLED=84
fi
fi
### /usr/bin/php link
if [ ! $PHP_INSTALLED = "" ]; then
if [ $OS = "centos7" ]; then
cmd "scripts/php-cli-version-set.sh ${PHP_BASE}"
else
if [ ! ${PHP_BASE} = "53" ]; then
cmd "scripts/php-cli-version-set.sh ${PHP_BASE}"
fi
fi
fi
### PHP composer
if [ ! $PHP_INSTALLED = "" ]; then
cmd_once "scripts/php-composer-install.sh"
fi
### Physical Server
if [ $SMARTD = "1" ]; then
cmd_once "scripts/smartd-install.sh"
fi
if [ $SENSORS = "1" ]; then
cmd_once "scripts/lm-sensors-install.sh"
fi
### Development Tools
if [ $DEV_TOOLS = "1" ]; then
cmd_once "scripts/dev-tools-install.sh"
fi
### MariaDB
if [ $MARIADB = "1" ]; then
cmd_once "scripts/mariadb-repo-install.sh"
cmd_once "scripts/mariadb-install.sh ${MARIADB_RAM}"
# MariaDB root password
if [ ! -f "locks/mariadb_set_root_password" ]; then
title "MariaDB root 비밀번호를 자동 생성합니다."
#if [ "$INTERACTIVE" = "1" ]; then
# mariadb_set_root_password
#else
MARIADB_ROOT_PASSWORD=$(scripts/password-generate.sh)
/usr/bin/mysqladmin password "${MARIADB_ROOT_PASSWORD}"
if [ "${?}" != "0" ]; then
echo
outputError "MariaDB root 비밀번호 설정이 실패하였습니다."
echo
fi
echo "[client]
password=${MARIADB_ROOT_PASSWORD}" > /root/.my.cnf
chmod -v o-rwx /root/.my.cnf
notice "Your MariaDB root password saved \"/root/.my.cnf\"\n (자동 생성된 MariaDB root 비밀번호는 \"/root/.my.cnf\" 파일에도 저장되었습니다.)"
echo " Password : ${MARIADB_ROOT_PASSWORD}"
echo " Change Password) mysqladmin -p'${MARIADB_ROOT_PASSWORD}' password"
echo
#fi
touch "locks/mariadb_set_root_password"
fi
fi
### End
echo
outputInfo "Thanks for php79 stack installing. (설치가 완료되었습니다.)"
echo
if [ $NGINX = "1" ]; then
outputInfo "Visit http://127.0.0.1 or http://ServerIP"
echo
fi
### Result
if [ "$INTERACTIVE" = "1" ]; then
echo
outputQuestion "Check the installation status? (설치 상태를 확인하시겠습니까?) [Y/n]"
read -p " " -r
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
cmd "${STACK_ROOT}/status.sh"
fi
fi