Modificar el nombre registrado en los archivos:
/etc/hostname
/etc/hosts
Modificar el nombre registrado en los archivos:
/etc/hostname
/etc/hosts
How do I change hostname under Linux operating system?
You need to use the hostname command. It is used to either set or display the current host or domain name of the system. The hostname is used by many of the networking programs (such as sendmail, Apache servers) to identify the machine.
Type the following command:
hostname
Sample ouputs:
server.nixcraft.net.in
You need to update two files:
Edit /etc/sysconfig/network, enter:
vi /etc/sysconfig/network
Set HOSTNAME=newhost.example.com, enter:
HOSTNAME=server2.nixcraft.com
Save and close the file. Type the following command:
hostname server2.nixcraft.com hostname
Now, proceed to step # 2.
Edit, /etc/hostname file, enter:
vi /etc/hostname
Delete old name and add new name:
server2.nixcraft.com
Save and close the file. Type the following command:
hostname server2.nixcraft.com hostname
Now, proceed to step # 2.
Edit /etc/HOSTNAME, enter:
vi /etc/HOSTNAME
Delete old name and add new one:
server2.nixcraft.com
Save and close the file. Type the following command:
hostname server2.nixcraft.com hostname
Now, proceed to step # 2.
Edit /etc/HOSTNAME, enter:
Delete old name and add new one:
server2.nixcraft.com
Save and close the file. Type the following command:
hostname server2.nixcraft.com hostname
Now, proceed to step # 2.
Now, you need to edit /etc/hosts file, enteR:
vi /etc/hosts
Change all old hostname with newer one.
RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit
/etc/sysconfig/network
NETWORKING=yes
HOSTNAME="plain.domainname.com"
GATEWAY="192.168.0.1"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"