1. Install Apache
First of all, update Ubuntu server using commands :
Login with root :
Next, install Apache web server :
Check if Apache web server is running or not :
Sample output would be:
Now, open your web browser and access Apache test page by navigating to
http://localhost/ or http://IP.ADDRESS - http://192.168.94.99
2. Install MySQL
To install MySQL On Ubuntu, run :
Verify if MySQL service is running or not using command :
Sample output :
The available password validations are low, medium and strong. Just enter the appropriate number (0 for low, 1 for medium and 2 for strong password) and hit ENTER key.
Now, enter the password for MySQL root user. Please be mindful that you must use password for mysql root user depending upon the password policy you choose in the previous step. If you didn’t enable the plugin, just use any strong and unique password of your choice.
For the rest of questions, just type y and hit ENTER. This will remove anonymous user, disallow root user login remotely and remove test database.
2.2 CHANGE AUTHENTICATION METHOD FOR MYSQL ROOT USER
Run the following command at the mysql prompt to find the current authentication method for all mysql user accounts :
Change this authentication to mysql_native_password method.
Sample output :
Mysql is running!
2.1 SETUP DATABASE ADMINISTRATIVE USER (ROOT) PASSWORD
By default, MySQL root user password is blank. You need to secure your MySQL server by running the following script :
If your answer is Yes, you will be asked to choose the level of password validation.The available password validations are low, medium and strong. Just enter the appropriate number (0 for low, 1 for medium and 2 for strong password) and hit ENTER key.
Now, enter the password for MySQL root user. Please be mindful that you must use password for mysql root user depending upon the password policy you choose in the previous step. If you didn’t enable the plugin, just use any strong and unique password of your choice.
For the rest of questions, just type y and hit ENTER. This will remove anonymous user, disallow root user login remotely and remove test database.
2.2 CHANGE AUTHENTICATION METHOD FOR MYSQL ROOT USER
Run the following command at the mysql prompt to find the current authentication method for all mysql user accounts :
Change this authentication to mysql_native_password method.
Update the changes using command :
Now check again if the authentication method is changed or not using command :
Good! Now the myql root user can authenticate using password to access mysql shell.
Exit from the mysql prompt :
2. Install PHP
To install PHP, run :
After installing PHP, create info.php in folder /var/www/html/
Let us create info.php file in the apache root folder:
Add the following lines :
Press CRTL X Y to save and quit the file. Restart apache service to take effect the changes.3.1 TEST PHP
Open up your web browser and navigate to http://IP-address/info.php
Usually, when a user requests a directory from the web server, Apache will first look for a file named index.html. If you want to change Apache to serve php files rather than others, move index.php to first position in the dir.conf file as shown below
Here is the contents of the above file.
Move the “index.php” file to first. Once you made the changes, your dir.conf file will look like below.
Press CRTL X Y to save and quit the file. Restart apache service to take effect the changes.
3.2 INSTALL PHP MODULES
To improve the functionality of PHP, you can install some additional PHP modules.
To list the available PHP modules, run :
To install a php module run :To install all modules (not necessary though), run :
After Then
2. Install phpMyAdmin
Once you’ve setup LAMP stack, enable ‘universe’ repository, which is disabled by default on Ubuntu 19. To do so, run :
Now is the time to install phpMyAdmin.
To install phpMyAdmin on Ubuntu 19, run :
Hit the TAB key to choose OK and again hit ENTER key to continue.Hit ENTER to continue.
Choose Yes to configure database for phpmyadmin :
Provide mysql application password phpmyadmin. using the first password you set before.
Enter password :
Re-enter password :
Once phpmyadmin is installed, enable mbstring php extension and restart Apache service update the changes as shown below.
You can now verify if mbstring extension is enabled or not by loading into info.php file from the web browser. http://ip.address/info.php
To do so, login to mysql shell using command:
Enter your mysql root password. You will now be in mysql shell.
Enter the following command to create a new dedicated user for phpmyadmin :
Here, phpmyadmin is the new user for accessing phpmyadmin dashboard. The password for phpmyadminuser is isipassword. Replace these values with your own.
Next give the appropriate privileges to the ‘phpmyadminuser’ using command :
Finally exit from mysql shell :Before access phpMyAdmin dashboard http://IP.ADREESS/phpMyAdmin
Edit apache2.conf
Then add the following line to the end of file :
Then Restart apache2
Access phpMyAdmin dashboard
Open your web browser and navigate to :
http://IP.ADREESS/phpMyAdmin
Then Log in using root password.
SEMOGA BERMANFAAT!