Installing & setting up LAMP stack on CentOS7 Linux Server, Here I'll be showing how to setup Apache,
You can install PHPMyAdmin in CenOS7. By using PHPMyAdmin, you can manage databases easily.
Follow these steps
1. Install Apache Web Server on CentOS7
To Install and Setup Apache Web Server in CentOS7, execute these commands in SSH terminal.
yum install httpd
After executing above command, it will asks for confirmation about total download size and installed size, also about dependent packages.
Here the download size is 3MB, Installed size is 10MB and 4 dependent packages. To continue installing type y and hit Enter button.
After the Completion of Apache Web Server installation in CentOS7 Linux Server, you will see a message like this below.
After Installing Apache web server, start the apache server by using below command
systemctl start httpd
To start apache web server on server restart, execute this command once.
systemctl enable httpd
After completing above
If you see the output, apache web server is installed in centos7 and ready to use.
2. Install MySQL (MariaDB) in CentOS7
MariaDB is a
Follow these commands to install MySQL database in CentOS7.
yum install mariadb-server mariadb
Few seconds after executing above step, you will see information about download size and installed size, dependent packages. To continue installation type y and hit Enter button.
After Completion of MySQL (MariaDB) Database installation, you will see
After installation, you need to start the database for that use start command. You need to setup database to
systemctl start mariadb
systemctl enable mariadb
After executing above command, you need to enter
Remove anonymous user, we don't need it.
Disallow root login, this is used to database on this server from
We are not going to use test database, just remove it.
Reload the database privileges to update the newly configured settings.
Now you have configured you database to secure settings.
3. Install PHP in CentOS7 Server
To complete LAMP
yum install php php-mysql
You will see the information about download size, installed size, dependent packages. Type y and press Enter button to continue installation.
After Completion of installation, you will see a message like this below.
After installation, to change to take effect in web server. Restart the apache web server. Follow below command.
systemctl restart httpd
We need to check whether PHP & apache web server configured correctly or not. For that create a PHP file and add
Put this below code in that file.
Open this file in browser, http://your-ip-address/phpinfo.php
You should see output like this below.
4. Install PHPMyAdmin in CentOS7 Server
This is optional step to install PHPMyAdmin, PHPMyAdmin is used to manage databases in MySQL database. To install and
yum install phpmyadmin
To continue installation type y and press Enter button.
After completion of installation, you should see a message like this.
Next edit phpMyAdmin.conf file to access PHPMyAdmin from other computers using
Comment the lines indicated below, and also add few extra lines to access it.
## Comment the following Section ##
# <IfModule mod_authz_core.c>
# # Apache 2.4
# Require ip 127.0.0.1
# Require ip ::1
# <IfModule !mod_authz_core.c>
# # Apache 2.2
# Order Deny,Allow
# Deny from All
# Allow from 127.0.0.1
# Allow from ::1
## Add the following lines:
Require all granted
Edit config.inc.php file and set the auth_type to http instead of cookie.
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
// Authentication method (config, http or cookie based)?
Restart the apache server for changes to take effect.
systemctl restart httpd
Open http://your-server-ip-address/phpmyadmin, it will
I hope you have successfully installed LAMP Stack on