LAMP is a basic server installation of open source software that is also an acronym. The acronym stands for: Linux, Apache, MySQL and PHP.
Since the server comes with CentOS 6.5 installed, all we need to pay attention to is Apache, MySQL and PHP.
The VPS you install this on needs to be CentOS 6. This tutorial was tested and successfully completed on VPS with CentOS 6.5.
Step one: Update
To start, the first thing I always do is update the VPS repositories.
sudo yum update
Great, now your VPS is ready!
Step two: Install Apache
Apache is free webserver software that is very commonly used.
To install apache, you need to run:
sudo yum install httpd
Once apache has installed, we need to start apache on your VPS. Run:
service httpd start
Great, your VPS now has Apache. Next we install MySQL.
Step three: Install MySQL
MySQL is a advanced database system that is used to send and retrieve data. It is very commonly used on virtual private servers.
To install and start MySQL, you need to run both commands:
sudo yum install mysql-server
service mysqld start
After you run those commands, mysql will install on your VPS.
Now that MySQL is installed, you need to set a root password for MySQL. To do so, you need to run:
After you run that on your server, it will ask you if you currently have a root password set for MySQL. If you do, type it in and press enter. If not, just hit enter and you can set a root password.
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 MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
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
Remove anonymous users? [Y/n] y
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
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...
- Removing privileges on test database...
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Great, you now have both apache and MySQL installed on your virtual private server. Next we install PHP.
Step four: Install PHP
PHP is a extremely common web scripting language. Just like apache, PHP is open source.
Lets install PHP:
Congratulations, you have installed the LAMP setup on your CentOS virtual private server. To finish, restart the apache webserver:
service httpd restart