Last active
May 24, 2023 18:24
-
-
Save ljamel/1dcfc77d20763e1474727546fe59c51f to your computer and use it in GitHub Desktop.
Install and configure LAMP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -e "\n\nUpdating Apt Packages and upgrading latest patches\n" | |
sudo apt-get update -y && sudo apt-get upgrade -y || dnf update -y && sudo yum upgrade -y | |
echo -e "\n\nInstalling Apache2 Web server\n" | |
sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 -y || dnf install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 -y | |
echo -e "\n\nInstalling PHP & Requirements\n" | |
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php7.0-mcrypt php7.0-mysql -y || dnf install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php7.0-mcrypt php7.0-mysql -y | |
echo -e "\n\nInstalling MySQL\n" | |
sudo apt-get install mariadb-server -y || dnf install mariadb-server -y | |
echo -e "\n\nConfigure MYSQL MySQL\n" | |
read -p "Choisi un nom d'utilisateur" user | |
md=$( openssl rand -base64 12); | |
sudo mysql -e "CREATE USER '$user'@'localhost' IDENTIFIED BY '$md'; GRANT ALL PRIVILEGES ON *.* TO '$user'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;" | |
echo -e "\n\nEnabling Modules\n" | |
sudo a2enmod rewrite | |
sudo phpenmod mcrypt | |
echo -e "\n\nRestarting Apache\n" | |
sudo systemctl restart apache2 | |
## Install Latest WordPress | |
rm /var/www/html/index.* | |
wget -c http://wordpress.org/latest.tar.gz | |
tar -xzvf latest.tar.gz | |
mv wordpress/ /var/www/html/ | |
echo -e "\n\nLAMP Installation Completed your password $md" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment