CentOS 7 server VirtualBox tutorial. How to setup and install, part 4.

centos virtualbox horizontal

This is part 4 of the 5 part tutorial series that shows how to install CentOS 7 on VirtualBox.

Part 1 is on the installation and setup of VirtualBox.

Part 2 is on the installation of CentOS 7.

Part 3 and Part 4 is on the configuration of CentOS 7 as well as installation of some nice to have third party software’s.

Part 5 is on general security.

We are going to start off this part of the tutorial by explaining the benefits of a static ip address. If we choose to set a static IP on the server we have set up, we will be able to do a lot of things. One of those things is to log into the server via an ftp client. This will make working with files much easier.
But probably the most important part of settings a static IP in our case is that we will be able to SSH into the virtual machine. So what is the point with that you may ask. I personally like to work in another command line client with more features like for example “Cmder”, which we are going to use later in this tutorial.

To set up a static ip we will first change into the directory /etc/sysconfig/network-scripts.

Let us list the files:


We will be working with the file ifcfg-en0s3 so let us open it up with the vi editor.

Locate the line where it says BOOTPROTO=dhcp. Once you have done that be sure that you are in “INSERT mode”. You can do this by pressing the i button on your keyboard. Now edit that line to BOOTPROTO=static.

Now add these 4 lines of code at the end of the file.


Once you have done that press ESC to exit “INSERT MODE” and write “:wq” to write and quit.


The IPADDR line is going the virtual machines actual ip address on the network. Most network routers give out the IP address of the form 192.168.1.xxx to the devices on that local are network. I am going to assume that yours do the same, but it could also be something else so be sure to check that out. I chose the IP address of “” because it does not conflict with any other devices on the network.

Once we have saved the file and existed vi text editor we have to do a network restart.


Now let us ping Google DNS servers to see that everything is still working correctly.


If you see something like the screen above then it still works and that is great.

To make sure that we have gotten the correct IP address we type in “ip addr”.


If you can find the line where it says “inet” then that means we have the correct IP address.

Let’s do a quick reboot before we go on any further.

We are going to end this part of the tutorial by SSH’ing into the virtual machine from another command line client. But first of all we have to check if there are any firewalls installed on our system and whether or not that firewall is permitting us to SSH into the virtual machine.

The two most common firewall softwares on CentOS is iptables and firewalld. Since we are using CentOS 7 I am assuming that firewalld is already installed and activated on the virtual machine.

To see if firewalld is actviated on our system we can type in this command:


Here we can see that the service is clearly up and running. Now let us make sure that iptables is not running.


Here we can see that it did not find the service “iptables”. That is great because we do not want both firewall softwares to run simultaneously because that is not a good idea.

Next up we have to make sure that firewalld allows us to SSH into the virtual machine. We can find that out by listing the rules.


Here we can see that ssh is among the services that are allowed. That is good. We do not have to change any settings on the firewall for now.

Now we are going to SSH into the virtual machine with a very feature rich command line software called Cmder. If you are on a mac you might not need this but if you are sitting on a Windows operative system like I do then this is pretty much a must.

Go to their official webpage at http://cmder.net/

The website will present you with a screenshot of how Cmder looks like.


Scroll down until you reach the download section and click on “Download full”.


Once the download is complete extract the contents of the zip file to a place on your desktop as showed in the picture below.


Once you have zipped out the contents, make sure that the folder is named “cmder” and that the contents in that folder looks like this with the executable Cmder.exe file.


Now copy the “cmder” folder to C:\ as shown in the picture.


Now you might delete the cmder folder on your desktop as wel as the cmder.zip file. Be sure to create a shortcut on your desktop that points to Cmder.exe in that folder so that it is easily reachable for later.


Now start up Cmder by clicking on that shortcut you just created. A windows like this will pop up.


Now comes the moment of truth. We are going to SSH into our virtual machine. Make sure that the virtual machine is running in the background. And type in this command in the cmder command line.

The IP address after “@” must be the ip address of your virtual machine. After you have done
this an output like this will pop up.


It will say something like “The authenticity of host ‘ (’ can’t be established. RSA key fingerprint is 49:51:12:8c:4f:74:1b:14:6c:fc:e3:8a:09:ff:50:9a.”

Here you will write “yes” and press ENTER. This will only happen the first time.

It will then say something more and that the “connection was aborted”. Just ignore this and
type in the command to SSH again.

This time it will ask for password of the root user and once you have typed that in successfully you will be logged in to the server.


Now Cmder is much easier to work with than the console from VirtualBox. You can copy mulitple lines from the terminal screen by just selecting the lines with the mouse. And you can paste in single lines by pressing Ctrl + V. This will make it much easier to work with the command line as you can easily copy and paste commands.

This is end of part 4. part 5 will continue where we left off.

Click here for part 5.

Leave a Reply

Your email address will not be published. Required fields are marked *