First step connect to SSH,
ssh -i .pem ubuntu@<PUBLIC-DNS / IP>
Once you're in console you can start by following steps to setup lamp
sudo apt update
sudo apt install -y apache2
(optional) sudo apt install -y curl
(optional) sudo apt install -y composer
sudo apt install -y mysql-server
sudo apt update
sudo apt-get install php -y
sudo apt install -y libapache2-mod-php php-mysql php-xml php-zip
sudo apt install -y phpmyadmin php-mbstring php-gettext
sudo phpenmod mbstring
sudo mysql
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SomePassWord';
- FLUSH PRIVILEGES;
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Change bind-address to 0.0.0.0
bind-address = 0.0.0.0
Restart apache
sudo service apache2 restart
mysql -u root -p
enter root password if any, if this does not work, just entersudo mysql
CREATE USER 'aws_dba'@'localhost' IDENTIFIED BY 'SomePassword';
CREATE USER 'aws_dba'@'%' IDENTIFIED BY 'SomePassword';
GRANT ALL ON *.* TO 'aws_dba'@'localhost';
GRANT ALL ON *.* TO 'aws_dba'@'%';
FLUSH PRIVILEGES;
EXIT;
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo nano /etc/apache2/sites-available/000-default.conf
Inside that file, you will find a <VirtualHost *:80> block starting on the first line. Inside of that block, add the following new block so your configuration file looks like the following:
<VirtualHost :80>
...
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
...
</VirtualHost>
Finally restart apache
sudo systemctl restart apache2