forked from MaximeMichaud/mineweb-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmineweb-install.sh
390 lines (375 loc) · 13.4 KB
/
mineweb-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
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
#!/bin/bash
# Installation automatique pour MineWeb
# https://github.com/fightmaxime/mineweb-install
function isRoot () {
if [ "$EUID" -ne 0 ]; then
return 1
fi
}
function checkOS () {
if [[ -e /etc/debian_version ]]; then
OS="debian"
source /etc/os-release
if [[ "$ID" == "debian" ]]; then
if [[ ! $VERSION_ID =~ (8|9) ]]; then
echo "⚠️ Votre version de Debian n'est pas supportée."
echo ""
echo "Si vous le souhaitez, vous pouvez tout de même continuer."
echo "Gardez à l'esprit que ce n'est supportée !"
echo ""
until [[ $CONTINUE =~ (y|n) ]]; do
read -rp "Continuer? [y/n]: " -e CONTINUE
done
if [[ "$CONTINUE" = "n" ]]; then
exit 1
fi
fi
elif [[ "$ID" == "ubuntu" ]];then
OS="ubuntu"
if [[ ! $VERSION_ID =~ (16.04|18.04) ]]; then
echo "⚠️ Votre version de Ubuntu n'est pas supportée."
echo ""
echo "Si vous le souhaitez, vous pouvez tout de même continuer."
echo "Gardez à l'esprit que ce n'est supportée !"
echo ""
until [[ $CONTINUE =~ (y|n) ]]; do
read -rp "Continuer? [y/n]: " -e CONTINUE
done
if [[ "$CONTINUE" = "n" ]]; then
exit 1
fi
fi
fi
elif [[ -e /etc/fedora-release ]]; then
OS=fedora
elif [[ -e /etc/centos-release ]]; then
if ! grep -qs "^CentOS Linux release 7" /etc/centos-release; then
echo "⚠️ Votre version de CentOS n'est pas supportée."
echo "Gardez à l'esprit que ce n'est supportée !"
echo ""
unset CONTINUE
until [[ $CONTINUE =~ (y|n) ]]; do
read -rp "Continuer? [y/n]: " -e CONTINUE
done
if [[ "$CONTINUE" = "n" ]]; then
exit 1
fi
fi
else
echo "On dirait que vous n'exécutez pas ce script d'installation automatique sur une distribution Debian, Ubuntu, Fedora ou CentOS"
exit 1
fi
}
function installQuestions () {
echo "Bienvenue dans l'installation automatique pour MineWeb !"
echo "https://github.com/fightmaxime/mineweb-install"
echo ""
echo "Je dois vous poser quelques questions avant de commencer la configuration."
echo "Vous pouvez laisser les options par défaut et appuyer simplement sur Entrée si cela vous convient."
echo ""
echo "Quelle version de PHP ?"
echo " 1) PHP 5.6 (non recommandé)"
echo " 2) PHP 7.0 "
echo " 3) PHP 7.1 "
echo " 4) PHP 7.2 (recommandé) "
echo " 5) PHP 7.3 (non recommandé puisque phpMyAdmin ne le supporte pas)"
until [[ "$PHP_VERSION" =~ ^[1-5]$ ]]; do
read -rp "Version [1-5]: " -e -i 4 PHP_VERSION
done
case $PHP_VERSION in
1)
PHP="5.6"
;;
2)
PHP="7.0"
;;
3)
PHP="7.1"
;;
4)
PHP="7.2"
;;
5)
PHP="7.3"
;;
esac
echo "Quelle version de MineWeb ?"
echo " 1) 1.7.0 (recommandé)"
echo " 2) Master (Dernière modifications possible)"
until [[ "$MINEWEB_VERSION" =~ ^[1-5]$ ]]; do
read -rp "Version [1-2]: " -e -i 1 MINEWEB_VERSION
done
case $MINEWEB_VERSION in
1)
UNZIP="v1.7.0.zip"
MOVE="MineWebCMS-1.7.0"
MOVEZIP="v1.7.0.zip"
;;
2)
UNZIP="master"
MOVE="MineWebCMS-master"
MOVEZIP="master.zip"
;;
esac
echo "Nous sommes prêts à commencer l'installation."
APPROVE_INSTALL=${APPROVE_INSTALL:-n}
if [[ $APPROVE_INSTALL =~ n ]]; then
read -n1 -r -p "Appuyez sur n'importe quelle touche pour continuer..."
fi
}
function installMineWeb () {
if [[ $AUTO_INSTALL == "y" ]]; then
#
APPROVE_INSTALL=${APPROVE_INSTALL:-y}
CONTINUE=${CONTINUE:-y}
MINEWEB_VERSION=${MINEWEB_CHOICE:-1}
PHP_VERSION=${PHP_VERSION:-1}
fi
#
installQuestions
if [[ "$OS" =~ (debian|ubuntu) ]]; then
if [[ "$VERSION_ID" = "8" ]]; then
apt update
apt remove apt-listchanges -y
apt upgrade -y
apt install -y ca-certificates apt-transport-https dirmngr zip unzip
wget https://dev.mysql.com/get/mysql-apt-config_0.8.8-1_all.deb
ls mysql-apt-config_0.8.8-1_all.deb
dpkg -i mysql-apt-config_0.8.8-1_all.deb
apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5
apt update
apt install mysql-server mysql-client -y
systemctl enable mysql && systemctl start mysql
apt install -y apache2
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ jessie main" | tee /etc/apt/sources.list.d/php.list
apt update
apt install php$PHP libapache2-mod-php$PHP php$PHP-mysql php$PHP-curl php$PHP-json php$PHP-gd php$PHP-memcached php$PHP-intl php$PHP-sqlite3 php$PHP-gmp php$PHP-geoip php$PHP-mbstring php$PHP-xml php$PHP-zip -y
service apache2 restart
apt install phpmyadmin -y
rm -rf /usr/share/phpmyadmin/
mkdir /usr/share/phpmyadmin/
cd /usr/share/phpmyadmin/
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.tar.gz
tar xzf phpMyAdmin-4.8.5-all-languages.tar.gz
mv phpMyAdmin-4.8.5-all-languages/* /usr/share/phpmyadmin
rm /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages.tar.gz
rm -rf /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages
if ! grep -q "Include /etc/phpmyadmin/apache.conf" /etc/apache2/apache2.conf; then
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
fi
a2enmod rewrite
wget http://mineweb.maximemichaud.me/000-default.conf
mv 000-default.conf /etc/apache2/sites-available/
rm -rf 000-default.conf
service apache2 restart
rm -rf /var/www/html/
wget https://github.com/MineWeb/MineWebCMS/archive/v1.7.0.zip
wget https://github.com/MineWeb/MineWebCMS/archive/master.zip
mv $MOVEZIP /var/www/
cd /var/www/
unzip -q $UNZIP
rm -rf $UNZIP
mv $MOVE /var/www/html
chmod -R 777 /var/www/html
fi
if [[ "$VERSION_ID" = "9" ]]; then
apt update
apt -y install ca-certificates apt-transport-https dirmngr unzip
wget https://dev.mysql.com/get/mysql-apt-config_0.8.8-1_all.deb
ls mysql-apt-config_0.8.8-1_all.deb
dpkg -i mysql-apt-config_0.8.8-1_all.deb
apt install dirmngr -y
apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5
apt update
apt install mysql-server mysql-client -y
systemctl enable mysql && systemctl start mysql
apt install -y apache2
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
apt update
#mem-cached et geoip à check
apt install php$PHP libapache2-mod-php$PHP php$PHP-mysql php$PHP-curl php$PHP-json php$PHP-gd php$PHP-memcached php$PHP-intl php$PHP-sqlite3 php$PHP-gmp php$PHP-geoip php$PHP-mbstring php$PHP-xml php$PHP-zip -y
service apache2 restart
apt install -y phpmyadmin
rm -rf /usr/share/phpmyadmin/
mkdir /usr/share/phpmyadmin/
cd /usr/share/phpmyadmin/
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.tar.gz
tar xzf phpMyAdmin-4.8.5-all-languages.tar.gz
mv phpMyAdmin-4.8.5-all-languages/* /usr/share/phpmyadmin
rm /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages.tar.gz
rm -rf /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages
if ! grep -q "Include /etc/phpmyadmin/apache.conf" /etc/apache2/apache2.conf; then
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
fi
a2enmod rewrite
wget http://mineweb.maximemichaud.me/000-default.conf
mv 000-default.conf /etc/apache2/sites-available/
rm -rf 000-default.conf
service apache2 restart
apt install zip -y
rm -rf /var/www/html/
wget https://github.com/MineWeb/MineWebCMS/archive/v1.7.0.zip
wget https://github.com/MineWeb/MineWebCMS/archive/master.zip
mv $MOVEZIP /var/www/
cd /var/www/
unzip -q $UNZIP
rm -rf $UNZIP
mv $MOVE /var/www/html
chmod -R 777 /var/www/html
fi
if [[ "$VERSION_ID" = "16.04" ]]; then
apt update
apt -y install ca-certificates apt-transport-https dirmngr software-properties-common
wget https://dev.mysql.com/get/mysql-apt-config_0.8.8-1_all.deb
ls mysql-apt-config_0.8.8-1_all.deb
dpkg -i mysql-apt-config_0.8.8-1_all.deb
apt install dirmngr -y
apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5
apt update
apt install mysql-server mysql-client -y
systemctl enable mysql && systemctl start mysql
add-apt-repository -y ppa:ondrej/apache2
apt update
apt install -y apache2
add-apt-repository -y ppa:ondrej/php
apt update
#mem-cached et geoip à check
apt install php$PHP libapache2-mod-php$PHP php$PHP-mysql php$PHP-curl php$PHP-json php$PHP-gd php$PHP-memcached php$PHP-intl php$PHP-sqlite3 php$PHP-gmp php$PHP-geoip php$PHP-mbstring php$PHP-xml php$PHP-zip -y
service apache2 restart
apt install -y phpmyadmin
rm -rf /usr/share/phpmyadmin/
mkdir /usr/share/phpmyadmin/
cd /usr/share/phpmyadmin/
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.tar.gz
tar xzf phpMyAdmin-4.8.5-all-languages.tar.gz
mv phpMyAdmin-4.8.5-all-languages/* /usr/share/phpmyadmin
rm /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages.tar.gz
rm -rf /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages
if ! grep -q "Include /etc/phpmyadmin/apache.conf" /etc/apache2/apache2.conf; then
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
fi
a2enmod rewrite
wget http://mineweb.maximemichaud.me/000-default.conf
mv 000-default.conf /etc/apache2/sites-available/
rm -rf 000-default.conf
service apache2 restart
apt install zip -y
rm -rf /var/www/html/
wget https://github.com/MineWeb/MineWebCMS/archive/v1.7.0.zip
wget https://github.com/MineWeb/MineWebCMS/archive/master.zip
mv $MOVEZIP /var/www/
cd /var/www/
unzip -q $UNZIP
rm -rf $UNZIP
mv $MOVE /var/www/html
chmod -R 777 /var/www/html
fi
if [[ "$VERSION_ID" = "18.04" ]]; then
apt update
apt -y install ca-certificates apt-transport-https dirmngr software-properties-common
wget https://dev.mysql.com/get/mysql-apt-config_0.8.8-1_all.deb
ls mysql-apt-config_0.8.8-1_all.deb
dpkg -i mysql-apt-config_0.8.8-1_all.deb
apt install dirmngr -y
apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5
apt update
apt install mysql-server mysql-client -y
systemctl enable mysql && systemctl start mysql
add-apt-repository -y ppa:ondrej/apache2
apt update
apt install -y apache2
add-apt-repository -y ppa:ondrej/php
apt update
#mem-cached et geoip à check
apt install php$PHP libapache2-mod-php$PHP php$PHP-mysql php$PHP-curl php$PHP-json php$PHP-gd php$PHP-memcached php$PHP-intl php$PHP-sqlite3 php$PHP-gmp php$PHP-geoip php$PHP-mbstring php$PHP-xml php$PHP-zip -y
service apache2 restart
apt install -y phpmyadmin
rm -rf /usr/share/phpmyadmin/
mkdir /usr/share/phpmyadmin/
cd /usr/share/phpmyadmin/
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.tar.gz
tar xzf phpMyAdmin-4.8.5-all-languages.tar.gz
mv phpMyAdmin-4.8.5-all-languages/* /usr/share/phpmyadmin
rm /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages.tar.gz
rm -rf /usr/share/phpmyadmin/phpMyAdmin-4.8.5-all-languages
if ! grep -q "Include /etc/phpmyadmin/apache.conf" /etc/apache2/apache2.conf; then
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
fi
a2enmod rewrite
wget http://mineweb.maximemichaud.me/000-default.conf
mv 000-default.conf /etc/apache2/sites-available/
rm -rf 000-default.conf
service apache2 restart
apt install zip -y
rm -rf /var/www/html/
wget https://github.com/MineWeb/MineWebCMS/archive/v1.7.0.zip
wget https://github.com/MineWeb/MineWebCMS/archive/master.zip
mv $MOVEZIP /var/www/
cd /var/www/
unzip -q $UNZIP
rm -rf $UNZIP
mv $MOVE /var/www/html
chmod -R 777 /var/www/html
fi
elif [[ "$OS" = 'centos' ]]; then
yum install -y epel-release
elif [[ "$OS" = 'fedora' ]]; then
dnf install -y wget ca-certificates curl
fi
}
function initialCheck () {
if ! isRoot; then
echo "Désolé, vous devez l'exécuter en tant que root."
exit 1
fi
checkOS
}
function manageMenu () {
clear
echo "Bienvenue dans l'installation automatique pour MineWeb !"
echo "https://github.com/fightmaxime/mineweb-install"
echo ""
echo "Il me semblerait que MineWeb soit déjà installé."
echo ""
echo "Qu'est-ce que tu veux faire?"
echo " 1) Relancer l'installation"
echo " 2) Mettre à jour phpMyAdmin"
echo " 3) Mettre à jour le script"
echo " 4) Quitter"
until [[ "$MENU_OPTION" =~ ^[1-4]$ ]]; do
read -rp "Sélectionner une option [1-4]: " MENU_OPTION
done
case $MENU_OPTION in
1)
installMineWeb
;;
2)
updatephpMyAdmin
;;
3)
update
;;
4)
exit 0
;;
esac
}
function update () {
wget https://raw.githubusercontent.com/fightmaxime/mineweb-install/development/mineweb-install.sh -O mineweb-install.sh
chmod +x mineweb-install.sh
echo ""
echo "Mise à jour effectuée."
sleep 2
./mineweb-install.sh
exit
}
# ...
initialCheck
# Vérifier si MineWeb est déjà installé
if [[ -e /var/www/html/app/index.php ]]; then
manageMenu
else
installMineWeb
fi