Uncategorized

How To Install and Secure phpMyAdmin on Ubuntu

Pinterest LinkedIn Tumblr

To set up Ubuntu, PHP, and phpMyAdmin in AWS, follow these steps:

  1. Launch an EC2 instance with Ubuntu:
  • Sign in to your AWS Management Console and go to the EC2 Dashboard.
  • Click on “Launch Instance” and select “Ubuntu Server” as the AMI.
  • Choose the instance type you want and configure any additional settings you need.
  • Create a new key pair or use an existing one to access the instance.
  1. Install PHP:
  • Connect to the instance using SSH and update the package list by running the following command: sudo apt update
  • Install PHP and the required extensions by running the command: sudo apt install php libapache2-mod-php php-mysql
  • Verify that PHP is installed correctly by creating a test PHP file in the web server’s document root directory: sudo nano /var/www/html/info.php
  • Paste the following code into the file: <?php phpinfo(); ?>
  • Save the file and exit the editor.
  • Open a web browser and navigate to the instance’s public IP address followed by /info.php to see the PHP information page.
  1. Install phpMyAdmin:
  • Install the phpMyAdmin package by running the command: sudo apt install phpmyadmin
  • During the installation, select “Apache2” as the web server to configure phpMyAdmin to work with Apache.
  • When prompted to configure the database for phpMyAdmin, select “Yes” and enter the password for the MySQL root user.
  • Create a symbolic link to the phpMyAdmin directory in the web server’s document root directory by running the command: sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
  • Open a web browser and navigate to the instance’s public IP address followed by /phpmyadmin to access phpMyAdmin.
sudo service apache2 restart
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password@';

GRANT ALL ON *.* TO 'user'@'localhost';

FLUSH PRIVILEGES;

That’s it! You now have a fully functional Ubuntu instance with PHP and phpMyAdmin installed and configured.

Extra:

sudo apt install libapache2-mod-php php-mysql
sudo apt-get install mysql-server
sudo mysql
sudo apt remove phpmyadmin
sudo apt install phpmyadmin
sudo service apache2 restart
sudo service mysql start
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin