Change hostname in opensuse Leap

1
3281

Let me tell you how to change to the hostname in OpenSUSE Leap test machine. I was fighting the last two days before this working method, this method should work on Suse Server 12,  OpenSUSE 42.x and Opensuse 15.

My server:

suse15:~ # uname -a
Linux suse15 4.12.14-lp150.8-default #1 SMP Sat Apr 7 05:12:52 UTC 2018 (8719fc4) x86_64 x86_64 x86_64 GNU/Linux

IP: 192.168.65.151
Hostname:  suse15
Domain name:  osradar.com.

The actual info:

Change hostname procedure :

The procedure to change the computer hostname on openSuse Linux:

Type the following command to edit /etc/hostname using your preferred text editor:
sudo vi /etc/hostname
Delete the existing name and put a new name.
Now Edit the /etc/hosts file:
vi /etc/hosts
Replace any name related to the existing computer name with your new one.


Reboot the system to changes take effect
sudo reboot

Using hostingctl command

hostingctl is   a command from where you can change  the hostname  also  with the following commands:

hostnamectl set-hostname  suse15

Using  Yast2

Yast2 us  GUI tool  to  manage your  server/desktop

Start Yast2 with
# sudo yast2

 

Then NetworkServices > Hostnames > and  change hostname related to your  IP address

Restart rcnetwork services.

osradar@suse15~> sudo rcnetwork restart

How to verify? 

Please reboot for the final check and enjoy

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here