-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoInstallLamp.sh
54 lines (42 loc) · 1.46 KB
/
AutoInstallLamp.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
#!/bin/bash
# Check if the script is being run by the root user
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Update and upgrade Ubuntu
apt update && apt upgrade -y
# Install Apache and harden it
apt install apache2 -y
# Add hardening commands here
# Install MariaDB and harden it
apt install mariadb-server -y
# Add hardening commands here
# Install multiple versions of PHP and PHP-FPM
apt install php7.0 php7.2 php7.4 php8.0 php8.1 -y
apt install php7.0-fpm php7.2-fpm php7.4-fpm php8.0-fpm php8.1-fpm -y
# Install PHPMyAdmin
apt install phpmyadmin -y
# Install all PHP extensions for running WordPress and Laravel
# Add commands here
apt-get install -y php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
# Install Certbot
apt install certbot -y
# Optimize Apache for high traffic and high load
# Add optimization commands here
echo "MaxKeepAliveRequests 500" >> /etc/apache2/apache2.conf
echo "KeepAliveTimeout 5" >> /etc/apache2/apache2.conf
# Create a PHP info page
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
# Install SFTP
apt install openssh-server -y
# Print URLs and credentials
echo "Apache: http://localhost"
echo "PHPMyAdmin: http://localhost/phpmyadmin"
echo "PHP Info: http://localhost/phpinfo.php"
echo "MariaDB username: root"
echo "MariaDB password: [password]"
echo "PHPMyAdmin username: [username]"
echo "PHPMyAdmin password: [password]"
echo "SFTP username: [username]"
echo "SFTP password: [password]"