Lamp ( Linux, Apache, MYSQL, PHP ) stack is a gathering of open source programming used to get web servers ready for action. The abbreviation represents Linux, Apache, MySQL, and PHP. Since the virtual private server is as of now running Ubuntu, the linux part is dealt with. Here is the way to introduce the rest.
PhpMyAdmin is a free, open source, notable, completely included, and natural online frontend for managing MySQL and MariaDB database. It bolsters different database activities, and has numerous highlights that permit you to effortlessly deal with your databases from a web interface, for example, bringing in and sending out information in different configurations, producing unpredictable and helpful questions utilizing Query-by-model (QBE), overseeing various servers, and significantly more.
You need to update the ubuntu repository before install apache2 on Ubuntu, Use the given command.
$ sudo apt-get update && sudo apt-get install apache2 -y
Once installation completed the Apache web server so the check the Apache2 status by using the command.
$ sudo systemctl status apache2.service
To get more information about Apache web server click here, Now need to verify the Apache web server working or not for that open the browser with http://localhost if you get the apache test web page So that means, Your apache2 installation is working fine.
Update UFW Firewall
By default Apache2 will use port 80 for HTTP and Port 443 for HTTPS So that why you need to open the required port to open in network, Use the given command for that.
$ sudo ufw allow 443
$ sudo ufw allow 80
$ sudo ufw reload
Test Apache Web Server
After open port, You need to test the Apache web server with browser, You need tp open your browser with given url for testing.
http://localhost or http://ip_address
Note :- You should get the test page from Apache web server, Here our Apache2 installation is completed, Click here to get brief information about Apache2.
To add the PHP 7.4 repo and install PHP on ubuntu, Use the following commands.
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install php7.4 -y
$ sudo apt-get install php7.4-curl php-pear php7.4-gd php7.4-dev php7.4-zip php7.4-mbstring php7.4-mysql php7.4-xml
To verify PHP installation use the given command.
$ php -v
After installation of PHP, You need to test the PHP using Apache Web Server, Follow the given steps for that, You need to create getinfo.php in /var/www/html/ for testing of PHP.
$ echo “<?php phpinfo(); ?>” | sudo tee /var/www/html/getinfo.php
After this, You need to open the browser with given URL.
http://localhost/getinfo.php or http://ip_assress/getinfo.php
You should get the Installed PHP details on your web page.
Note :- PHP 7.4 installation is completed, Click here brief information about PHP installation.
To add the MariaDB 10.3 repository and installation, Use the following commands.
$ sudo apt-get install software-properties-common dirmngr -y
$ sudo apt-key adv –recv-keys –keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
$ sudo add-apt-repository ‘deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu xenial main’
$ sudo apt-get update
$ sudo apt-get install mariadb-client mariadb-server -y
After this get MariaDB service status, Use the given command for that.
$ sudo systemctl status mysql.service
The MariaDB default installation isn’t secure as a matter of course, you have to execute a security content that accompanies the bundle. You will be approached to set a root secret word to guarantee that no one can sign into the MariaDB.
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n’.
Change the root password? [Y/n] y
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
Remove anonymous users? [Y/n] y
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
– Dropping test database…
– Removing privileges on test database…
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Note :- MariaDB 10.3 installation is completed, Click here brief information about MariaDB installation.
You need to update the repository and Use the given command to install PHPmyAdmin.
$ sudo apt–get update
$ sudo apt-get install phpmyadmin -y
While installation you need to select the web server to get services for PHPmyAdmin, You need to select here Apache2 and Enter required details about Databases.
After installation of PHPmyAdmin, You need to reload the Apache2 services, To do that use the given command.
$ sudo systemctl reload apache2.service
Open your browser with given URL.
http://localhost/phpmyadmin or http://ip_address/phpmyadmin