Installation of PHP, MySQL and Apache on LAMP Linux. By installing the services listed above, your server will be ready to host your desired website or application.
Installing LAMP Although the operation is very easy, managing the installed software in this way requires study and research.
After installing LAMP, it’s best to read the Linux Document Resources and Services installed. Troubleshooting, customizing or optimizing your service is inevitable and you may or may not get it sooner or later. The disadvantages and benefits of this type of service are:
- In this way, since you do not have the control panel installed, you will not need any additional costs and control panel licenses.
- Installing new or old versions of the services will be customized depending on your needs and infrastructure.
- Due to the minimal operating system and manually installing services, unnecessary services are not installed and therefore consumes less resources on the server.
- Due to the lack of control panel usage, it may be difficult to manage and configure the server to have the best possible quality of service.
- Managing files and resources due to the inaccessibility of the graphical and web environment can be tedious and time consuming.
By installing LAMP, your server will be ready to host HTML pages, content management systems like WordPress and more. Considering the above and knowing all the aspects of installing LAMP, we will teach you how to install LAMP on CentOS Linux in the following article.
Lamp installation tutorial on Linux server
This article attempts to teach p along with the initial configuration of servers for server preparation. The following will be installed on CentOS 7 Linux:
- Apache 2.4
- MySQL MariaDB
You will need a CentOS 7 Linux server to start the installation. Then get started and install the above explanation on your server. Then connect to the server through Putty software or other SSH clients and perform the installation steps step by step.
Step One – Install Apache
Apache is a world-famous and widely used web server, so it makes it a good choice to start. Installing Apache web server using Package Managers is very easy and you can install it on your own server with just one command. To install Apache using putty, connect to your server and enter the following command:
yum -y install httpd
After you enter the above command in the command-line environment, the Apache web server will be installed on your server. To get started Web server, enter the following command in Command-Line environment:
systemctl start httpd.service
You can use the httpd -V command to view the installed web server version. If you can, you can see the default web server page by entering the IP server address in the browser:
http: // your_server_IP_address /
The following page should appear in the browser if installed correctly and set up a web server:
And finally you need to enable this service on Boot Server. After activating this service in Boot after restart and power on the server will automatically start this web server:
systemctl enable httpd.service
Step Two – Install MySQL Database [MariaDB]
After installing the web server at this point you should install the database service. For our database, the choice is MySQL MariaDB, which is a good choice for database servicing. You can easily install MySQL MariaDB using yum. To install, just run the following command in SSH:
yum -y install mariadb-server mariadb
After installing, launch MySQL MariaDB:
systemctl start mariadb
Once installed, you will need to run a database security script to perform the related steps. Enter the following command to run the database security script:
After entering the command above you will be prompted for the root password, just press Enter without entering anything. You will then be asked “Do you want to set a password for the root user?” If you want to set a password for the root user, press the y key.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that no one can log into MariaDB
root user without proper authorization.
New password: password
Re-enter new password: password
Password updated successfully!
Reloading privilege tables ..
You will also be asked further questions to choose the default values. Just press Enter for other questions. If you would like to get started during the MySQL MariaDB service system boot, just enter the following command:
systemctl enable mariadb.service
After installing the database we will move on to the next step.
Step Three – Install PHP
The PHP component is used to compile and display Dynamic code. Installing this tool is as simple as previous services and can be easily installed using Package Manager. To install, just run the following command in SSH:
yum -y install php php-mysql
After entering the above command PHP should be installed without problems. After installing PHP you need to restart the web server to invoke PHP functions. Enter the following command to restart the Apache web server:
systemctl restart httpd.service
Install PHP Modules
You can install the modules you need for different uses of PHP. You can use the following command to search and display existing modules:
systemctl restart httpd.service
Entering the above command will display all modules available through Package Manager with a brief description:
php-bcmath.x86_64: A module for PHP applications using the bcmath library
php-cli.x86_64: Command-line interface for PHP
php-common.x86_64: Common files for PHP
php-dba.x86_64: A database abstraction layer module for PHP applications
php-devel.x86_64: Files needed for building PHP extensions
php-embedded.x86_64: PHP library for embedding in applications
php-enchant.x86_64: Enchant spelling extension for PHP applications
php-fpm.x86_64: PHP FastCGI Process Manager
php-gd.x86_64: A module for PHP applications using the gd graphics library
. . .
To see more details about the module you can use the following command:
yum info package_name
For example, to see the description of the php-fpm module you can use the following command:
yum info php-fpm
The description will appear as follows:
. . .
Summary: PHP FastCGI Process Manager
License: PHP and Zend and BSD
Description: PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI
: implementation with some additional features useful for sites of
: any size, especially busier sites.
You can also use the following command to install the php-fpm module:
yum install php-fpm
Finally, restart the web server to make changes. If you have any problems, you can ask your question in the comments. We hope this article has been helpful to you dear ones.