For installing this flavor of Linux I am going to use Cent OS 6.3 x86_64 minimal version [Don’t be fooled by its name "minimal"] and Oracle Virtual box 4.2.6 x86. These are the current releases of both softwares.What do you need for this:
1. A computer which can run oracle virtual box [ can be Windows or Mac OS X ]
2. Cent OS 6.3 ISO – No need to burn a disk for this and you can download it here [Under CD and DVD Iso images click on x86_64 and then click on one of the mirrors to download it. Look for the file name CentOS-6.3-x86_64-minimal.iso to download, if this link becomes invalid, then browse for other mirrors]
3. Oracle Virtual box 4.2.6 and you can download it here
Alright, now that you have downloaded both CentOS 6.3 and Oracle Virtual Box 4.2.6 you can start installing the Linux server.
1. Installing oracle virtual box on your computer – Step by step process with screen shots
change the installation location if you have disk space constraint on your primary hard disk. See the screen shot below and update the location by browsing to the location where you want to install.
In the next screen as shown below you will see a warning message about your network interfaces going away, yes as of this version of virtual box, it does disconnect you from your internet and so be prepared for a quick network interruption.
At this point you have a successfully installed virtual box on your computer. Go ahead and click finish to launch the program
2. Now that you have your virtualization software installed you are now ready to install CensOS 6.3 server in oracle virtual box – Step by step process with screen shots
Click on new to create a new virtual machine [Keyboard shortcut : CTRL+N to create a new VM]
Name it appropriately and hit next. [If you want to install more virtual machines you want a follow good naming convention, avoid naming it too generic]. I named it as opensourcedbms_testbed. Dont worry about what version on Linux you are going to put over there as CentOS is not listed under there. We can mention it has RedHat 64bit or Fedora 64bit as these are close cousins of Cent OS.
Give appropriate memory size you want to allocate to your VM. depending on you main computer memory. I suggest for a basic Cent OS Linux server give at-least 1 GB and this can be modified at any time. If you give memory less than 1GB your CentOS Server will switch to text mode installation down the line rather than GUI. So stick with 1GB memory for now.
In the next screen its going to ask you to create a virtual hard drive and that’s what we want for a new server installation.
One nice thing in virtual box is that it can create virtual machines hard disk in multiple formats, I am not going to discuss which one is better over the other for now. I will choose the default one VDI (VirtualBox Disk Image).
In the next screen it will ask you how it wants to store this data on your main hard disk. Pick dynamically allocated to keep the size growing when needed. Fixed option will just use up all the space even if the CentOS VM does not physically use it.
In the next screen you can define the max hard disk size for this virtual machine. You can change the location of where you want to store this on your disk if want to place this virtual machine hard disk other than default. Hit create after you change the parameters as you desired.
Now you are done creating environment for your CentOS 6.3 Linux Server. Before you start the server installation we need to tweak certain things to mount the operating system ISO disk and some performance enhancements for the installation of operating system in this VM.
Select virtual machine and click settings.
Add some CPU cores to the VM if needed
Now mount the operating system disk image of Cent OS minimal that you have downloaded earlier. Browse to the download location for this image in your main computer to mount it.
Now you are ready to install Cent OS 6 Server in your VM. Go ahead and click start after selecting your VM in virtual box.
Once you click start you virtual machine starts up for the first time in a new window. Pay attention to the little red circle I drew to indicate how to release your mouse once you are inside the VM. You need to hit Right CTRL to release your mouse from your virtual machine. Hit enter inside this console window to begin installation.
Choose Install or upgrade an existing system and hit enter [its the default option]
In the next step it will request for a disk check. You can do it, I am skipping it as I am confident that my ISO image is good. Right arrow on you key board to move the highlighter onto skip option and hit enter to continue. At this point it will switch installation to Graphical user interface[GUI] mode.
Select basic storage devices as we fall under that category
In the next screen it will ask to discard any data that exists in the hard disk that you created earlier for this VM. Go ahead and say yes to that. Note : This is not going to discard any of your main hard disk data. Only discard the VM HDD drive that you created along the way which should be empty any way.
Name your new CentOS VM Server. Name to what ever you want this server to be called as.
pick a time zone for the Cent OS VM server
In this screen you can choose how to layout your partitioning schema. I am not covering how to change default partitioning schema[Custom partitioning] here. Pick the default option "replace existing systems". This will clean wipe the VM HDD one more time and layout partitioning schema to install CentOS Server.
Go ahead and write changes to disk and viola ! Cent OS will start installing in your Virtual Machine.
Congratulations ! you now have successfully installed Cent OS Linux Virtual Machine Server.
Restart and log into the console for enabling SSH access from out site virtual box into virtual machine. Use root as login and the password that you have setup for root user earlier in the Cent OS Server installation.
login into console
Now before you do anything we need to disable SELINUX. I am assuming you know a little bit of vi editor here, which is the default text editor in Cent OS Linux. If you do not know how to use vi editor please read about it a bit before you proceed further.
Edit the file /etc/sysconfig/selinux to disable it. Change the string from SELINUX=enforcing to SELINUX=disabled. Save it and exit.
Now SELINUX is disabled. We now need to fix our networking. To do that we need to edit our network file at this location : /etc/sysconfig/network-scripts/ifcfg-eth0
Remove HWADDR line and change ONBOOT="no" to ONBOOT="yes". Save the file and exit. Now the changes are made restart network for gaining network access to this server. To restart network simply run the command "service network restart"
Now we have network to our server.
Almost done and we are at our final stretch. We just need to open up port 22 from outside this server to make the SSH connection come into server. To do that open up VM settings one more time from main virtual box window [Leave the console window behind – no need to shutdown].
Click on Network navigation item and then click on port forwarding
Add port 22 to the list of ports that you want main computer forward into this guest Cent OS virtual machine. Save these settings and you are ready to access this Cent OS VM server secure shell from any where in your network. You can also forward other ports like 80/3306/5432 etc if you want to make this VM a web-server or database server in future. One modification that you might have to do it enable that new port in your iptables and restart iptables for server to start listening to that port.
3. Accessing CensOS 6.3 server secure shell from outside oracle virtual box – Step by step process with screen shots
Fire up the SSH client that you downloaded earlier
Login with root / password [That you creating for root while installing Cent OS Operating system] and there you are in your Cent OS Server Console.