openSUSE and SLES will assign a random hostname to the system during installation if not manually set. The random hostname starts with linux- followed by four random alphanumeric characters.
hostname information for openSUSE and SLES is stored in /etc/hostname file as with other Linux systems. You can change the hostname for your SUSE system by editing the /etc/hostname file or by using hostnamectl program at the terminal.
Steps to change hostname in openSUSE and SLES:
- Open the Terminal application.
- Show current hostname.
user@linux-ui1m:~> hostname linux-ui1m
hostname is normally displayed in at the shell prompt via \h in the $PS1 environment variable.
- Set hostname using hostnamectl.
user@linux-ui1m:~> sudo hostnamectl set-hostname host [sudo] password for root:
- Check hostname again to confirm.
user@linux-ui1m:~> hostname host
The shell prompt is not immediately updated as $PS1 is only set when a new shell is started
- Start a new shell to test.
user@linux-ui1m:~> bash user@host:~>
Author: Mohd
Shakir Zakaria
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Discuss the article:
Comment anonymously. Login not required.