Step-by-Step Guide
Connect to Your EC2 Instance via SSH
Replace /path/to/your-key.pem with the path to your SSH key, and your-ec2-instance-public-dns with the public DNS of your EC2 instance.
ssh -i /path/to/your-key.pem ubuntu@your-ec2-instance-public-dns
Update Package Index
Update the package index to ensure you have the latest information about available packages.
sudo apt-get update
Install PHP and Required Extensions
Install PHP 7.4 and the necessary PHP extensions for phpMyAdmin.
sudo apt-get install php7.4 php7.4-mysql php7.4-mbstring php7.4-xml
Install phpMyAdmin
Install phpMyAdmin using the package manager.
sudo apt-get install phpmyadmin
During the installation, you will be prompted to select the web server that should be automatically configured to run phpMyAdmin. Select apache2 by pressing Space and then Enter.
You will also be asked to configure a database for phpMyAdmin with dbconfig-common. Choose Yes and provide a password for the phpMyAdmin application to register with the database.
Configure Apache
After installation, you need to include the phpMyAdmin configuration in your Apache configuration.
sudo nano /etc/apache2/apache2.conf
Add the following line at the end of the file to include the phpMyAdmin configuration:
apache
Copy code
Include /etc/phpmyadmin/apache.conf
Save and close the file (Ctrl+X, Y, Enter).
Restart Apache
Restart Apache to apply the changes.
sudo systemctl restart apache2
Access phpMyAdmin
You should now be able to access phpMyAdmin by navigating to http://your-ec2-instance-public-dns/phpmyadmin in your web browser. Log in using your MySQL username and password.
0 More Answers