Setting up a Linux CentOS virtual image with Vagrant


In this post, I’m going to create a new CentOS Linux image using Vagrant, tweak a couple of settings and make sure it has all the latest and greatest packages ready for Hyperledger.



  • You have followed all the steps to install Vagrant and Cygwin as described in this older post, right up to and including the section “Test Go in Cygwin”;
  • You are comfortable using a Linux command prompt.


Steps we will take

  • Build a 64bit Linux CentOs 7 virtual image using Vagrant
  • Change the Spanish language of the vm to English
  • Make sure Num lock is on at session start
  • Fix vi
  • Update from CentOS version 7.2 to 7.3


Build a 64bit Linux CentOs 7 virtual image using Vagrant

To start off, I open a Cygwin prompt in my Windows 7 host:


I am going to use a CentOs 7 Vagrant box that comes with a GUI. I enter the following commands:

cd /cygdrive/c/gocode

mkdir cent

cd cent

vagrant init kane_project/centos7x64GUIpuppet; vagrant up –provider virtualbox

After just a few minutes, I have a brand new virtual machine to play with:


Next, I set the Linux password for the vagrant user first by connecting to Centos via SSH and running the passwd command as a privileged user:

vagrant ssh

sudo passwd vagrant

That went well, except… my Linux talks Spanish instead of English:



Change the Spanish language of the vm to English

Let’s fix that, rapidamente. I do the following commands in Cygwin:

sudo yum install system-config-language

# confirm:


The result is successful, instalado !


Next we run the command to change the terminal language:

sudo system-config-language

This brings up the Wordperfect 5.1 interface to change languages:


We change the selection with the Up arrow to “English (USA)“, hit the TAB key to jump to the Yes button and hit the ENTER key:


Back in the Cygwin prompt, I disconnect from Centos with command:


Then I log back in with:

vagrant ssh

This time, my prompt is in English:


The next step is to get a GUI. Log out again with:


We need to edit the file C:\gocode\cent\Vagrantfile in a text editor and edit out a few pound “#” characters to enable our GUI. You could do it using vi in Cygwin but I’m lazy and I’m going to do it in Notepad++ on Windows 7.

Here is the section of the Vagrantfile contents before I make the change:


Here is the same thing after I have saved my changes:


All right, let’s launch our graphical user interface with command:

vagrant reload

Hola! The result is promising,  but we still have some Spanish language artifacts we will need to get rid of:


Worth noting that when the CentOS GUI session times out and locks the screen, there is no login field in the window. You need to click on the screen and drag it up with the mouse to reveal the above login screen.

Anyhow, I click on the “vagrant” button:


I enter the password I set earlier with the passwd terminal command and click the Sign In button. I get a “sort-of” Spanish UI:


I click on menu Aplicaciones > Herramientas del ssistema > Configuracion


Next, click on Region e idioma :


Change the following:




When prompted, click the “Reiniciar ahora” button, then the “Cerrar la sesion” button to accept to restart the session:


Log in to CentOS again. This time you are prompted to update the standard folders:


Click the “Update Names” button.  Log out once more to apply the changes to the session:


Log back in. This time if you click on places, there is no longer any Spanish visible:


Pretty good. Let’s move on.


Make sure Num lock is on at session start

This is a quick fix. In a terminal, do the command:

sudo yum install numlockx

That will take care of it, your num lock will be on on next session start.


Fix vi

I start editing in vi and every time I hit ENTER, the letter “B” appears. Annoyance. To fix this, you have to create new file /home/vagrant/.vimrc and add one line to it with the commands:


echo “set nocompatible” > ./.vimrc

If you are used to the .bashrc file in your home folder to add an alias because you use Ubuntu or Linux Mint, then beware. On Centos and RHEL, the file used is different, it’s .bash_profile

Now that vi is working, like me you could tediously add the following command shortcut in that .bash_profile file:

alias ll=’ls -la’


Update from CentOS version 7.2 to version 7.3

After some struggles with Hyperledger 1.0, it turns out gRPC requires the very latest Linux kernel and C libraries. In other words, CentOs need to be updated from version 7.2 to 7.3.

Here are the instructions.

Don’t forget to restart, while still keeping your vm up, with command:

sudo reboot

(end of post)


Bertrand Szoghy,

Updated July 2017







One thought on “Setting up a Linux CentOS virtual image with Vagrant

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s