How to install LAMP on Centos 6.5
This article main scope is to guide you through a complete step by step instructions that in the end will lead on installing one of the most used software combination in Web Development: LAMP (Linux, Apache, MySQL/MariaDB, and PHP/PhpMyAdmin ) and it will present you some nice features.
When the upgrade process finish install LAMP from rags, first install Apache Web Server and start/verify every server process daemon.
$ sudo systemctl start httpd $ sudo systemctl status httpd
Step 1: Install Apache ( httpd ) using Yum
The Apache web server is currently the most popular web server in the world, which makes it a great default choice for hosting a website.We can install Apache easily using CentOS’s package manager, yum. A package manager allow us to install most software pain-free from a repository maintained by CentOS.
First installing in lamp web server using of below command these are :
$sudo yum install httpd
After installing Apache, start Apache service using following command and enable auto start on system reboot.
# sudo service httpd start # sudo chkconfig httpd on
Now point your browser to localhost on port 80, you will get default Apache page
Step 2: Install MySQL :
Now you have successfully installed Apache server. Lets install MySQL server and MySQL client using yum package manager with following command. Also you can use this tutorial to install MySQL 5.6 on your system.
MySQL/MariaDB is a community-developed fork of the MySQL relational database management system. Basically, it will organize and provide access to databases where our site can store information. This time, we’ll also install some other “helper” packages that will assist us in getting our components to communicate with each other:
$sudo yum install mysql mysql-server
After installing MysQL server packages, start the services and execute following command for applying initial security. Execute below command and follow the instructions.
$service mysqld start $sudo chkconfig mysqld on $/usr/bin/mysql_secure_installation
The prompt will ask you for your current root password. Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter.
Then the prompt will ask you if you want to set a root password. Go ahead and enter Y, and follow the instructions:
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 authorization. New password: password Re-enter new password: password Password updated successfully! Reloading privilege tables.. ... Success!
Step 3 — Install PHP
PHP is the component of our setup that will process code to display dynamic content. It can run scripts, connect to our MySQL databases to get information and hand the processed content over to our web server to display.We can once again use the yum system to install our components. We’re going to include the PHP package as well:
$ yum install php php-common
This should install PHP without any problems. We need to restart the Apache web server in order for it to work properly with PHP. Follow these instructions:
$sudo systemctl restart httpd.service
Install PHP Modules
To enhance the functionality of PHP, we can optionally install some additional modules.To see the available options for PHP modules and libraries, you can type this into your system:
$yum search php- Or You can install without searching of PHP modules if you knows name of packages # yum install php-common php-cli php-mysql php-devel
Step 4: Start Services
Finally start Apache and MySQL services using following commands and setup them to auto start on system boot.
# service httpd restart # chkconfig httpd on # service mysqld restart # chkconfig mysqld on
Now! You have successfully configured Web hosting environment on your CentOS based system.