To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 6
LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the server is already running CentOS, the linux part is taken care of. Here is how to install the rest.
In this article you can see how to Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 6. Please follow the step by step.
Step 1 : To Install Apache
sudo yum install httpd
sudo service httpd start
That’s it!
To check if Apache is installed, direct your browser to your server’s IP address.
The page should display the words “It works!” like this
How to find your Server’s IP address
ifconfig eth0 | grep inet | awk ‘{ print $2 }’
Step 2 : To Install MySQL
sudo yum install mysql-server
sudo service mysqld start
During the installation, MySQL will ask you for your permission twice. After you say Yes to both, MySQL will install.
Once it is done installing,
sudo /usr/bin/mysql_secure_installation
The prompt will ask you for your current root password.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Then the prompt will ask you if you want to set a root password.
CentOS automates the process of setting up MySQL, asking you a series of yes or no questions.
It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL 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
production environment.Remove anonymous users? [Y/n] y
… Success!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
… Success!By default, MySQL 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…
… Success!
– Removing privileges on test database…
… Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y
… Success!Cleaning up…
All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.Thanks for using MySQL!
Step 3 : To Install PHP
sudo yum install php php-mysql
Once you answer yes to the PHP prompt, PHP will be installed.
That’s it!
PHP Modules
PHP also has a variety of useful libraries and modules that you can add onto your server. You can see the libraries that are available by typing:
yum search php-
Terminal then will display the list of possible modules. The beginning looks like this:
php-bcmath.x86_64 : A module for PHP applications for 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 : Human Language and Character Encoding Support
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-imap.x86_64 : A module for PHP applications that use IMAP
To see more details about what each module does,
yum info name of the module
sudo yum install name of the module
You can install multiple libraries at once by separating the name of each module with a space.
Congratulations! You now have LAMP stack on your droplet!
sudo chkconfig httpd on
sudo chkconfig mysqld on
Step 4 : RESULTS: See PHP on your Server
Although LAMP is installed on your virtual server, we can still take a look and see the components online by creating a quick php info page.
sudo nano /var/www/html/info.php
<?php
phpinfo();
?>
sudo service httpd restart
Finish up by visiting your php info page (make sure you replace the example ip address with your correct one)
It should look similar to this.
That’s it! 🙂
In today's digital landscape, timing is everything. Whether you're a social media manager, business owner, or content creator, the success…
Are you a website owner? Maintaining the website is the prime concern for any website owner. Yes, it’s equally important…
If you’ve planned to launch a WordPress website, you might get a question, “How do I log in to WordPress?”…
As the demand for virtual private servers (VPS) continues to grow, businesses and individuals are faced with a crucial decision:…
Web hosting is a large industry, as many other factors help any web hosting provider to form a company. The…