Installing CentOS in Virtual Box of Windows Host Machine for Development

Posted by Navdeep Singh on January 13, 2017

Installing CentOS in Virtual Box of Windows Host Machine for Development

It was really excited to use Linux based OS in my Windows Host Machine through Oracle based Virtual Box Manager. Since many months i want to use Linux in Windows. So at last when i assigned with task to fix some bugs in Drupal site that is installed in CentOS with httpd and mariadb and I need to replicate server and site on my local to fix bugs then understands this all stuff altogether. The need to create replica first because we cant do directly change the css on server Drupal site and second it got some direct changes on server and we cant take risk to break the live site by discarding the direct live changes on server.

1.Installing CentOS

image-title-here First installed CentOS-7 from iso file which downloaded from centOS website.

  1. Installing VBoxGuestAdditions.iso and setting up

Actually this step is essential to mount host machine development folder in virtual host machine. This VBoxAdditions allows your VM to setup shared folders and other good things. We’ll need shared folders to allow your host machine to edit files and have your guest machine use those updated files. Once that is done, you’ll need to restart your VM and remove the VBoxAdditions ISO CD.

First select VBoxGuestAdditions.iso in storage device and select folder to mount. And following commands need to run.

su root
mkdir /media/cdrom
mount -r /dev/cdrom /media/cdrom
yum -y update kernel*
yum group install "Development Tools"
sudo /media/cdrom/

Reference links :


By default the path is created and symbolic link is created for easy reference.

ln -s /media/sf_www /www

Edit the file /etc/sysconfig/selinux to disable it. Change the string from SELINUX=enforcing to SELINUX=disabled. Save it and exit.

vi /etc/sysconfig/selinux


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-enp0s3

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3


service network restart

Now we have network setup

  1. Install NGINX and MariaDB

Below reference links are best to install nginx and mariadb

In precise following commands used to install same

sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx


The way to find ip address of virtual machine

ip addr


Install MariaDB

sudo yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation
sudo systemctl enable mariadb

Login to MariaDB

mysql -u root -p

Reference Link

Install PHP

sudo yum install php php-mysql php-fpm
sudo vi /etc/php.ini
sudo vi /etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nobody = nobody
user = nginx
group = nginx
sudo systemctl start php-fpm

Working in Vim Editor

# Open Edit file
vi filename.php

# Edit Mode
Press Insert Key

# Save & Quit
Press Escape Key + :wq + Enter

# Quit without saving
Press :q! + Enter

# Quit
Press :q + Enter

// Cut, Copy, Paste
# Press v to select characters
# Press V to select whole line

# Press d to cut
# Press y to cut

# Press p to paste

Hope to continue my development in LEMP environment with nodejs powered apps. Future is Javascript seems so.