I'm trying to set up a virtual machine with CentOS 7 to use it as an Oracle Database Server (I'm new to Linux). I have encountered a problem about the host configuration that as I was reading has to be configured previously.
You see, this is where I collide with my knowledge that I have in windows. I thought it was enough to change the device name like this:
[root@localhost.localdomain ~] # hostname SERVER01
[root@localhost.localdomain ~] # hostname
SERVER01
[root @ SERVER01 ~] #
And I do not understand why from windows I can not ping
the Linux machine only using its hostname (SERVER01
)
The ping request could not find host SERVER01. Check the name and
try again.
I understand that the previous configuration of the host in CentOS 7
that I am asked to install the database server has to do with the fact that I can not ping
it using SERVER01
. Although I have to clarify that using the IP if I can.
What do I do to make that change in Linux and can ping
only using the hostname as it happens in windows?
When you change the hostname
in linux you are essentially just telling the OS "this is your name".
In order to reflect that on the network mapping as well, you need to edit the hosts file:
nano /etc/hosts
or if you are a vi fan:
vi /etc/hosts
Note that you will need root access to do this.
In that file you can just extend the localhost mapping to also include your custom hostname SERVER01
127.0.0.1 localhost.localdomain localhost SERVER01
Once you do this, from the same CentOS terminal you can type ping SERVER01
and it should give you a proper ping results.
If you want to be able to ping and access the services on that virtual machine from your Windows OS, then you will need to do the same mapping through the hosts file on your Windows, but this time you will have to use the IP provided to the vm, instead of 127.0.0.1.