Anytime you change an option in your vhost.conf file, or any other Apache configuration file, remember to reload the configuration with the following command:

1

sudo service httpd reload

MySQL

Install and Configure

Install the MySQL package:

1

sudo yum install mysql-server

Start MySQL, and set it to run at boot:

1
2

sudo service mysqld start
sudo /sbin/chkconfig --levels 235 mysqld on

Run mysql_secure_installation to secure MySQL. You will be given the option to change the root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases and reload privileges. It is recommended that you answer yes to these options:

1

mysql_secure_installation

Create a MySQL Database

Log in to MySQL:

1

mysql -u root -p

Enter MySQL’s root password. You will then be presented with a MySQL prompt.

Create a database and user:

1
2

create database webdata;
grant all on webdata.* to 'webuser' identified by 'password';

In the above example webdata is the name of the database, webuser the user, and password a strong password.

Exit MySQL:

1

quit

With Apache and MySQL installed you are ready to move on to installing PHP.

PHP

Install and Configure

Install PHP:

1

sudo yum install php php-pear

If you wish to install MySQL support for PHP also install the php-mysql package:

1

sudo yum install php-mysql

Edit /etc/php.ini for better error messages and logs, and upgraded performance. These modifications provide a good starting point for a VPS with 2GB Ram: