On the Internet, a hostname is a domain name assigned to a host computer.
To find out your hostname, use the following command:
$ uname -n
or $ hostname
There are 2 ways to change the host name, a temporary and a permanent way.
- To immediately (but not permanently) change the hostname:
- $ hostname newhostname
- The "permanent" way is a bit different depending the distro you run:
If you want the hostname to stick even after a reboot in Linux there are 2 files to change: the /etc/sysconfig/network and the /etc/hosts:
In the /etc/sysconfig/network I added the line:
CODE |
HOSTNAME= newhostname |
Next in the /etc/hosts file I changed the "127.0.0.1 localhost.localdomain localhost" to:
CODE |
127.0.0.1 newhostname localhost |
Finally reboot and you will see that the hostname is set.
0 comments:
Post a Comment