This guide will show you how to install a basic LAMP stack setup on CentOS 6. LAMP stands for Linux, Apache, MySQL, PhpMyAdmin and provides the basic tools needed to host web files on your server. There's also alternative web servers to use such as Nginx, but require additional configuration.
Before we get started lets install nano, which is an easy to use linux text editor, wget which is required to download files, unzip to unzip archives, and then update our currently installed packages. Updating all of the system packages might take some time as it will need to download new updates.
Once nano is installed and you've updated the system packages lets continue and install the Apache web server. The package manager will also install a few other required packages for the web server automatically.
Once Apache is installed lets start the web server.
Now we can install and setup the MySQL server, run the following command to install MySQL.
> Sample Output
Start the MySQL server.
Now we'll ened to run the MySQL server installer script to setup a root MySQL password and change a few settings, depending on your needs or preference.
> Sample Output
The MySQL installations script will ask you if you want to set a root password, type Y and press enter then enter a root password for the MySQL server to use. The other steps are to remove anonymous users, disallow root login remotely, remove test database, and to reload the privilege tables for MySQL. By default these are all set to Y (yes).
Once that's done we can install PHP and the MySQL extension along with the mcrypt extension (optional).
> Sample Output
Once PHP and the modules are installed restart the Apache web server so the changes take affect.
Now lets set the two server processes to start after bootup, so if your server is rebooted the services will start automatically.
Now a basic LAMP stack is setup on your server, you can navigate to your server IP in your web browser (e.g. http://your_server_ip) to check if it's working properly.
We can download PhpMyAdmin and set it up on your web server now. PhpMyAdmin lets you manage your MySQL database through your web browser remotely and is nice to have if you're not an experiened MySQL user and don't know many commands.
Lets navigate to your Apache web server directory first. By default this is the /var/www/html directory.
Now lets download the latest PhpMyAdmin script. For this we'll be using version 4.2.12.
Unzip the archive that you just downloaded. By default it should save the file as th name 'download' since we didn't specify a differnt output name.
After unzipping it will create a folder in the directory called "phpMyAdmin-4.2.12-english", lets rename it to make it eaiser to access, then enter the directory we renamed
Before we can use PhpMyAdmin we'll need to rename the configuration file, make sure to edit any options in this if necessary.
Now PhpMyAdmin is setup and you can access it by navigating to your server IP/phpmyadmin (e.g. http://your_server_ip/phpmyadmin).
Everything is ready now!
1) You may want to disable SELinux, it can cause permission issues with packages and might be a hassle if you're running certain web scripts on your server. Run "setenforce 0" to set SELinux to permissive mode.
2) If you can't connect to your web server, you might have the firewall on the server blocking connections to port 80 which is the default web server port. You can flush (clear) all IPTables rules by running the "iptables -F" command in SSH. You can also run the following commands below to add rules to allow traffic on port 80 (Web), 443 (Mail), and 3306 (MySQL)
If you have any questions you can always send in a technical support ticket and one of our technicians can assist you to the best of their ability.