To Set the host name Temporarily:
The '-v' in this example means verbose. If the '-v' option is used, the output will look similar to what is below:
server1~# hostname -v computer2Setting hostname to `computer2'server1~#
log out of the terminal and login the terminal again. Now you can see the changed hostname
However, with hostname command, it might not be a global change with in your Linux system.
To set the Hostname Permenantly in SuSe Linux Enterprise server:
Edit /etc/HOSTNAME# vi /etc/HOSTNAME
or# echo server2.mycompany > /etc/HOSTNAME
This will change hostname permenantly. Reboot the server and verify.
CHANGING THE HOST NAME THROUGH YAST Tool
Open the YAST control center.
Navigate to Network Services --> DNS and Hostname.
The Hostname and Name Server Configuration window appears.
Under the Hostname field, change the host name to a desired name and click the finish button.
Reboot the computer.
To View/check the server details, use the following commands:
- hostname - will show or set the computer's host name
- domainname - shows or sets the computer's NIS/YP domain name
- dnsdomainname - shows the computer's DNS domain name
Your suggestions/comments are welcome on this.