LAMP Server

LAMP Server

What is LAMP Server?

LAMP Server stands for Linux, Apache, MySQL or MariaDB and PHP server. It is the base for any high end web-based application on your server. LAMP server supports many applications like WordPress, Joomla, Ecommerce platforms etc.

Let’s Begin with Linux in LAMP server, Linux is an open-source Operating System. We will use CentOS 9 as our Linux platform in this post and we have already discussed in several posts how to create a virtual server with the help of CentOS 9. Please click on the link to learn that first.

Now, It is time for installing and configuring the Apache on our CentOS 9 server. Apache is open-source web server software to show website content to users by using http protocol or port 80. Apache is called as ‘httpd‘ on CentOS. We can install Apache by running the “yum install httpd -y” command.

You will get ‘Complete!’ at the last that will show that your Apache package is installed successfully.

Now, We have to start the Apache service and make it enable for every restart or booting of the server. We can do that by running the two simple commands that is “systemctl start httpd” and “systemctl enable httpd“.

We can check the status of the Apache service with the help of “systemctl status httpd“. It will show ‘enabled‘ and “active (running)“.

Now, We will install MariaDB for our LAMP server. MariaDB is the advance version of MySQL. After installing we have to start the service and configure it for our server. MariaDB is the database engine to store the data for different kinds of applications. We can install MariaDB by running the “yum install mariadb-server -y” command.

Next, We have to start the MariaDB service and make it enable for every restart or booting of the server. We can do that by running the same commands that is “systemctl start mariadb” and “systemctl enable mariadb“.

We will check the status of the MariaDB service with the help of “systemctl status mariadb“. It will show ‘enabled‘ and “active (running)“.

Next, We have to configure the MariaDB installation to improve the security by doing secure installation with “mysql_secure_installation“.

We have to enter the current password for root and then we have to type ‘n‘ in front of Switch to unix_socket authentication.

Now, We have to answer few configuration questions in y or n according to the requirement. You can see in the screenshots or you can see from here.

Change the root password? [Y/n] n

Remove anonymous users? [Y/n] y

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y

You will get “Thanks for using MariaDB!” at last. MariaDB is successfully configured to install web application with the help of LAMP server.

Now, We have to install PHP to complete our LAMP server on CentOS 9. PHP is used for handling the server side scripting. For Installing PHP on our server we have to run “yum install php -y“.

For PHP, We don’t have to check the service status as PHP don’t work as a service. After installation we can check PHP version by “php –version” command.

That’s all about LAMP server for this post. We will make post on how to install WordPress on LAMP server.

You May Like :

How to take help in CentOS 9

How to get your own local CentOS Server for free

FAQ on LAMP Server

Q. What is a LAMP server?

A. A LAMP server is a combination of Linux, Apache, MySQL/MariaDB, and PHP/Perl/Python used to host dynamic websites and web applications. It’s a popular open-source solution stack for web development.

Q. Why is it called “LAMP”?

A. The acronym “LAMP” stands for the four core components of the stack:
1. Linux (operating system)
2. Apache (web server)
3. MySQL/MariaDB (database)
4. PHP/Perl/Python (programming languages)

Q. How do I verify that Apache is running?

A. You can check if Apache is running by visiting http://localhost in your web browser. If it’s working, you should see a default Apache welcome page.

Q. How do I secure my LAMP server?

A. Security best practices include:
1. Regularly updating your software packages.
2. Configuring a firewall to limit access to necessary ports.
3. Disabling remote root login for MySQL.
4. Using strong passwords and SSH keys.
5. Configuring HTTPS with an SSL/TLS certificate.

Q. How do I access MySQL/MariaDB from the command line?

A. You can access MySQL using the command:
mysql -u root -p

Q. What are some alternatives to LAMP?

A. Alternatives to the LAMP stack include:
1. LEMP (Linux, Nginx, MySQL/MariaDB, PHP/Perl/Python)
2. MEAN (MongoDB, Express.js, Angular, Node.js)
3. WAMP (Windows, Apache, MySQL/MariaDB, PHP/Perl/Python)


Discover more from Root Learning

Subscribe to get the latest posts sent to your email.

One thought on “LAMP Server

Leave a Reply

Your email address will not be published. Required fields are marked *