Run CentOS on your Windows laptop

Here are the steps to run a virtual instance of Linux CentOS on your Windows laptop using Oracle VirtualBox –

Advertisements

Here are the steps to run a virtual instance of Linux CentOS on your Windows laptop using Oracle VirtualBox –

Downloading the essentials

  1. Get Oracle VirtualBox from https://www.virtualbox.org/wiki/Downloads
  2. Get CentOS 6.3 ~ 64bit from AOL India servers -> http://centos.aol.in/6.3/isos/x86_64/ (assuming you’re in India, else get your CentOS from another mirror). I had downloaded CentOS minimal which is about 300+ MB.

VM setup

  1. Go ahead and install Oracle VirtualBox. This should be an easy step.
  2. Now it’s time to setup your Linux instance….
  3. Click “New” and go ahead and give the new instance a name.
  4. Select Type:”Linux” and Version:”2.6″ (64 bit). Hit Next.
  5. Change recommended memory size to 512 MB.
  6. Select “Create a Virtual Hard Drive now” > Next > Keep VDI selected. Hit Next.
  7. Select “Fixed size” > 2.0 GB. Hit Next.
  8. The wizard should now close.
  9. The instance you just created should show up on the Left hand bar in the “powered off” state.
  10. Now right click on the instance you just created. Hit Start.
  11. When prompted to provide a start disk, select the CentOS 6.3 ISO that you had previously downloaded. Hit Start.
  12. Now follow the instructions to install Linux just like you would on a bare metal box.
  13. If you plan to run web-server or an app-server on this CentOS VM then you’ll have to change the networking mode for this VM from NAT to Bridged. This ensures that your VM will get an IP address from the same DHCP source as your Windows Laptop.

Making CentOS ready

  1. Now log into your CentOS instance via the console
  2. Once you’re logged in as “root”, run -> ifup eth0. This will bring up your ethernet interface.
  3. Now your instance will have a “real” IP address. To check, run -> ifconfig
  4. Now open up “/etc/sysconfig/network-scripts/ifcfg-eth0” and change ONBOOT to “yes“. This will ensure that you don’t have to perform step #2 above whenever you bring up your VM instance.
  5. From now on you can SSH into your instance (via putty, if you prefer) via the IP address of the machine – as found out in step #3.
  6. Now let’s change an ipfilter rule to allow HTTP traffic to the VM instance.
  7. Open up the /etc/sysconfig/iptables file and add the following rule
    • -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    • The above should be added just below the this line “-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT” in the file
  8. You’re all set. Now go ahead and run -> init 6 for a VM reboot.
  9. Now go ahead and install Apache or any other web server and  it shall be ready to serve on port 80 since we’ve opened up the port via step #7.

 

Hope the above steps will help you take the first few steps towards understanding virtualization and running your own virtual linux instance under Windows.

Author: anand

Currently CleverTap. Founder & ex-CTO - burrp. A techie and an entrepreneur at heart. Have worked in US, China and India.

1 thought on “Run CentOS on your Windows laptop”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s