Skip to content

Instantly share code, notes, and snippets.

@LinuxPreacher
Last active February 3, 2020 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LinuxPreacher/2517ce2e7c871d8e71939fdc421f3556 to your computer and use it in GitHub Desktop.
Save LinuxPreacher/2517ce2e7c871d8e71939fdc421f3556 to your computer and use it in GitHub Desktop.
LAMP Install Ubuntu 18.04 LTS
#!/bin/bash
#LAMP Short of Linux, Apache, MySQL/MariaDB and PHP
#More details make a tour https://youtu.be/IsToyd94e50
#Install Apache
sudo apt update
sudo apt upgrade
sudo apt install apache2
#Allow in firewall
sudo ufw app list
sudo ufw app info "Apache Full"
sudo ufw allow in "Apache Full"
#Check Status
systemctl status apache2
systemctl stop apache2
systemctl start apache2
#Enable & Restart Apache 2
Sudo systemctl enable apache2
Sudo systemctl restart apache2
#Check version
apache2 -v
#check in browser http://localhost or http://your IP address
#Install Mysql
sudo apt update
sudo apt-get install mysql-server
sudo mysql_secure_installation
#Check status
systemctl status mysql
sudo systemctl stop mysql
sudo systemctl start mysql
sudo systemctl restart mysql
#Enable & Restart mysql
sudo systemctl enable mysql
#login to Mysql DB
sudo mysql -p -u root
#Creat DB & User
CREATE DATABASE phpmyadmin DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY 'Admin@4321';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Exit
#Install PHP
sudo apt update
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2
#check version
PHP -v
#Install PHPMyadmin
sudo apt update && upgrade
sudo apt-get install phpmyadmin php-mbstring php-gettext -y
sudo systemctl restart apache2
#check in browser http://localhost/phpmyadmin or http://your IP address/phpmyadmin
#If not working
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
sudo systemctl restart apache2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment