I am going to show you how simple it is to create a local web development environment using PHP, Linux, Apache, and MySQL. After we get get the Lamp Stack installed, we will install some development tools that will optimize the database and add some extra security to the website and database. I am doing this with Virtual Box and Ubuntu Server 12.04, but the process is almost exactly the same if you were to do it on a VPS type system. Now before you people come around and go into a rant about how Ubuntu Server is crappy (and in enterprise environments, I wouldn’t use it either) compared to Debian or CentOS, etc.. it kicks ass in this type of environment; it’s just an OS, liabilities and a budget are not an issue in this situation, so it’s not a big deal if the OS doesn’t keep up to date with security updates as fast as others do, or if they consume more resources than other platforms do.
In Ubuntu Server, during the installation process, there is an option to automatically install the LAMP Stack and that is more convenient and time efficient. But I am going to do this the manual way, to showcase how simple and fun the process is. Also, there are quite a few ways to do this, this is the method I like the most.
This instruction will install all the core packages that we will need for our lab: Apache, MySQL and PHP.
During the installation, you should be prompted to assign a password for the root account in MySQL. Don’t leave it blank, and choose a strong password because we can’t afford to be lazy about security, especially at work.
Since we are doing this in a VM, I need to point something out to you that is going to prevent Apache from successfully restarting when you add tools for optimization and security purposes to Apache and are required to restart/reload it for the changes to be successfully implemented. This error is displayed during the final stages of our LAMP installation.
To fix this error, we need to add a line to our Apache2.conf file that is located in the /etc/apache2 directory. After you add that line, save the changes.
After you saved the changes, restart Apache. If we didn’t add that line to the Apache2.conf file, when you restart Apache, you would have received a “failed to restart” error. It’s amazing how the simplest stuff can cause headaches, but I digress.
Now let’s configure some basic security settings for MySQL.
Now let’s add some security to it. Fail2ban is to keep people from attacking your site. After a few failed login attempts, their IP address will be banned for a set amount of time. There are some additional ways you can ban their IP range, but that is beyond the scope of this tutorial.
In the fail2ban jail.conf file, there are some additional settings that you can change to tighten security, they are straight forward.
This is the document root folder, which is where your website and message boards will be located. Need to install Joomla, WordPress, Drupal or MyBB? This is where you install it.
Open your browser of choice, and navigate to your VM’s LAN IP Address. Congrats, you’re done. Now you can test different CMS’s, forum software, web applications, etc ..
Side Notes: I didn’t address FTP, SSH, CHMOD, WordPress Installations, Creating Databases and Adding Users to it, among many other things; If I forgot something, wasn’t clear about a step or you have questions or concerns, or if you could do it better and faster than I can, please leave feedback and I will try to respond in a timely manner.
To Be Continued ..