Display the current Suse Linux hostname

Type any one of the following commands:

 

$ hostname


OR

$ hostnamectl

 

How to change the SUSE Linux server hostname without a system restart?

Type the following commands:

$ sudo hostname new-server-name-here

 

Next, edit the /etc/hostname file and update hostname:

$ sudo vi /etc/hostname

 

Finally, edit the /etc/hosts file and update the lines that read your old-host-name:

$ sudo vi /etc/hosts



From:

127.0.1.1 old-host-name



To:

127.0.1.1 new-server-name-here



Save and close the file.

 

A note about hostnamectl command

Systemd based Linux distor such as SUSE Linux 12.x and above can simply use the hostnamectl command to rename hostname. To see the current setting just type:

$ hostnamectl

 

To change the hostname from Linux-mig6 to suse-rootadminz, enter:

$ sudo hostnamectl set-hostname suse-rootadminz
$ hostnamectl


How to assign a static hostname to a server running Suse Linux using yast

yast is a universal configuration utility for SuSe/OpenSuse. To setup hostname run yast command:

$ sudo yast


OR

$ sudo yast2

 

You must use the  TAB and arrow keys to navigate YaST. In YaST, navigate to System, then Network Settings, and then press the Enter key. Use the arrow keys to navigate to Hostname/DNS and use the TAB key and Shift + TAB key combination to set options


Next set the hostname and domain name to preferred values. Use the TAB key to navigate to [ OK ] and press the Enter key to save changes. Finally, use the TAB key to navigate to [Quit] and press the Enter key to exit app.

Was this answer helpful? 0 Users Found This Useful (0 Votes)