-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02_install_web_server.sh
72 lines (57 loc) · 3.32 KB
/
02_install_web_server.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
#!/bin/bash
# widely inspired (and mostly copied) from :
# https://packages.sury.org/php/README.txt
# 'cause when it comes to IT, the lazier the better !
#
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates curl
${SUDO} wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update
## NGINX + MARIADB
${SUDO} apt-get install -y nginx mariadb-server
# PHP 8.4 : Active support 31 Dec. 2026 / Security support 31 Dec. 2028
${SUDO} apt-get install -y php8.4-cli php8.4-common php8.4-{apcu,bz2,curl,gd,imagick,imap,intl,ldap,mbstring,mysql,opcache,readline,soap,xml,xmlrpc,zip}
${SUDO} apt-get install -y php8.4-fpm
## you can add other php versions, if needed :
## PHP 8.3 : Active support 31 Dec. 2025 / Security support 31 Dec. 2027
# ${SUDO} apt-get install -y php8.3-cli php8.3-common php8.3-{apcu,bz2,curl,gd,imagick,imap,intl,ldap,mbstring,mysql,opcache,readline,soap,xml,xmlrpc,zip}
# ${SUDO} apt-get install -y php8.3-fpm
## PHP 8.2 : Active support 31 Dec. 2024 / Security support 31 Dec. 2026
# ${SUDO} apt-get install -y php8.2-cli php8.2-common php8.2-{apcu,bz2,curl,gd,imagick,imap,intl,ldap,mbstring,mysql,opcache,readline,soap,xml,xmlrpc,zip}
# ${SUDO} apt-get install -y php8.2-fpm
## SECURING MYSQL
# as we installed mariadb-server we assume you'll want to secure it a bit
${SUDO} mysql_secure_installation
## Installing adminer (https://adminer.org)
# Or maybe not ! As adminer seems to have been discontinued for 2 years now.
# AdminerEvo is a fork which started as of July 2023 but let's be honnest, I'd rather use a local BDD client from now on
# (like DBeaver for example). I'm just leaving those lines here to avoid regression. I'll let you choose & uncomment
# which one you really want if ever you want one
#
# cd /var/www/html/
# ${SUDO} wget https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1.php -O admnr.php
# or
# ${SUDO} wget https://github.com/adminerevo/adminerevo/releases/download/v4.8.2/adminer-4.8.2.php -O admnr.php
# then, to configure all that shit, just go to
# https://www.geek17.com/fr/content/debian-11-bullseye-installer-et-configurer-la-derniere-version-de-php-8-fpm-avec-nginx-121
# and follow instructions
## CERTBOT LET'S ENCRYPT
# As we're installing a web server, we also presume that you'll want HTTPS
# comment the following lines if you don't
# source : https://certbot.eff.org/instructions?ws=nginx&os=debiantesting
${SUDO} apt-get install -y snapd
${SUDO} snap install core
${SUDO} snap refresh core
${SUDO} snap install --classic certbot
${SUDO} ln -s /snap/bin/certbot /usr/bin/certbot
${SUDO} snap set certbot trust-plugin-with-root=ok
${SUDO} certbot --nginx
# You might want to edit the following command, replacing <PLUGIN> with the name of your DNS provider, before you uncomment this line
# see https://eff-certbot.readthedocs.io/en/stable/using.html#dns-plugins
# ${SUDO} snap install certbot-dns-<PLUGIN>
# From now on, the following depends on your configuration and needs, so that the rest of the process should be done manually
# go to step 9 on https://certbot.eff.org/instructions?ws=nginx&os=debiantesting for more information.
## That's all, Folks !