Download Norman's Resume

Follow Norman

Norman J. Cimerol

Norman's Blog

How to install a LAMP server with CentOS 6.4 (64 Bit) On Oracle VirtualBox

Posted by: Norman J. Cimerol on July 13, 2013

I can't stress enough that this setup is for developmental purposes only. There will be no security settings. This is ideal if you are developing on your desktop or laptop connected to a standard home network which is preferrably behind a firewall or router with a firewall built in. Ideally this instance will not be left on but only when you are developing/testing code.

You should be familiar with the command line interface. You should also know how to use the vi editor. To edit files press I to enter INSERT mode, use the ESC key to toggle between insert mode and command mode. Press :wq to write/save your file and quit vi. I will not explicitly tell you to save your file, it is assumed you will do this while following these instructions. The same goes for logging in after reboots, confirming downloads, etc. If you have any questions, feel free to send me an email.

Step 1) Goto VirtualBox Downloads Page. Choose the correct download for your platform. I am on Windows 7 as my host machine. Download and run the installer. Download the Extension pack as well; however, I do not think it's required.

Step 2) After VirtualBox is install, open the program. You will arrive at the main screen. The left pane will display the virtual machines you have defined. The right pain will show the details for the selected virtual machine.

Step 3) Click the New icon. Name the new virtual machine.


Step 3a) If you use the name I chose, the type and version will select automatically. If not, choose type: Linux; version: Red Hat (64 Bit), click Next.


Step 4) Select the memory size. Choose 2048 (2 GB). This way the CentOS installer will be able to render the GUI; otherwise, you will have to install using the command line; click Next.


Step 5) Hard drive, leave default setting; click Create.


Step 6) Hard drive file type, leave default setting; click Next.


Step 7) Dynamically allocated hard drive, leave default setting; click Next.


Step 8) Set the size of the virtual hard drive. I used 15 GB. The recommended size is at least 8 GB; click Create.


Step 9) The newly created virtual machine will appear in the left pane.


Step 9a) Click the Settings button on the tool bar. Click the Display tab, adjust the video memory to 128 MB.


Step 9b) Click the Network tab, where it says Attached to: change it to Bridged Adapter; click OK.


Step 10) That's it, you are ready to begin the OS installation process. Download CentOS-6.4-x86_64-bin-DVD1.iso. Save it to a convenient place. You only need DVD1 ISO file for this installation.

Step 11) Select the virtual machine and click the Start button in the toolbar.


Step 12) Click the browse button and locate the ISO you just downloaded.


Step 12a) Choose the ISO; click Start.


Step 13) Leave the first option selected; press Enter.


Step 14) Press the right arrow to highlist the Skip option; press Space.


Step 15) The GUI portion of the installation begins; click Next.


Step 16) Select English; click Next.


Step 17) Select US English; click Next.


Step 18) Leave default setting Basic Storage; click Next.


Step 19) Click Yes, discard any data.


Step 20) Enter your FQDN (Fully Qualified Domain name). The first name is the host name, following by the dot (.) followed by the domain name. I used a spare domain I keep registered; click Configure Network.


Step 21) Select System eth0; click Edit.


Step 22) Check the box next to Connect Automatically; click the IPv4 Setting tab.


Step 23) From the Method drop down select Manual. Enter your IP address, Subnet Mask and Gateway. You can probably use the same settings I did; however, you should verify these with your own network setup. Next, enter your primary and secondary DNS IP addresses. This is probably supplied from your ISP. To find yours on your Windows machine, goto RUN or search on Windows 7-8, type CMD. At the prompt type: ipconfig /all. There you will see your DNS servers listed; click Apply; click Close; click Next.


Step 24) Select your time zone; click Next.


Step 24) Select a root password. Root is the superuser on Linux. If you do not select a strong enough password, the installer will prompt you to select a new one, or use what you supplied; click Next.


Step 25) Leave the default setting, Replace Existing Linux System; click Next.


Step 26) Click Write changes to disk. The installer will perform its operations.


Step 27) Select Web Server; click Next.


The installer will do a dependency check and begin copying files. This time may vary.


Step 28) After the post installation wrap up; click Reboot.


Step 29) At this point, you can use the VirtualBox terminal, or you can use a program like Putty to SSH into the server. I like putty because it scrolls nicely. You can now log in as root and the password you chose.


You can check your network configuration with command.

  1. ifconfig


  1. cat /etc/resolv.conf

Make sure your nameservers are listed there. If you didn't configure your network properly before, you can edit it now with the following command; otherwise, skip to step 30.

  1. system-config-network

Step 30) Disable the firewall. Press the space bar to remove the asterisk (*).

  1. system-config-firewall-tui

Step 31) Edit the hosts file. After the localhost entry, on the second line add your IP address you assigned your server, then the FQDN, then the host name.

  1. vi /etc/hosts



Step 32) Disable SELINUX by changing enforcing to disabled.

  1. vi /etc/selinux/config
  2. reboot



Step 33) Import Epel repository.

  1. cd /tmp
  2. wget
  3. rpm -ivh epel-release-6-8.noarch.rpm

Step 34) Import remi repository.

  1. wget
  2. rpm -ivh remi-release-6.rpm

Step 35) Set priority on Epel repository, located at the top under the [epel] section. Add priority=2 and make sure enabled=1.

  1. cd /etc/yum.repos.d
  2. vi epel.repo



Step 36) Set priority and enable Remi repository, located at the top under the [remi] section. Add priority=1 and make sure enabled=1.

  1. vi remi.repo



Step 37) Install yum priorities then update. This may take several minutes. You will need to press Y, then press enter when prompted.

  1. yum install yum-priorities
  2. yum update

Step 38) Install MySQL Server. Set it to start upon boot, start the service, then run the configuration program. Set your root password and follow the on-screen instructions. Make sure you allow remote access.

  1. yum install mysql mysql-server
  2. chkconfig mysqld on
  3. service mysqld start
  4. mysql_secure_installation

Step 39) Install PHP.

  1. yum install php php-mysql

Step 40) Install phpMyAdmin and configure.

  1. yum install phpMyAdmin

Step 40a) Change every instance of to the IP of your server. Comment out all instances of Deny from All by adding # at the beginning of the line.

  1. vi /etc/httpd/conf.d/phpMyAdmin.conf

Step 40b) Change auth type from cookie to http on this line: $cfg['Servers'][$i]['auth_type'] = 'cookie';.

  1. vi /usr/share/phpMyAdmin/

Step 40c) Change the name of the config file.

  1. mv /usr/share/phpMyAdmin/ /usr/share/phpMyAdmin/

Step 41) Configure Apache to start upon boot and turn the service on.

  1. chkconfig httpd on
  2. service httpd start

Step 42) Set phpinfo(); as your homepage to test your setup.

  1. echo "<?php phpinfo(); ?>" > /var/www/html/index.php

Step 43) Open your browser and point it to the IP address of your server.


Step 44) Now point your browser to your phpMyAdmin install and login with username: root and the password you set.