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.

Step-by-step video guide:

Steps to change hostname in openSUSE and SLES:

  1. Open the Terminal application.
  2. Show current hostname.
    user@linux-ui1m:~> hostname

    hostname is normally displayed in at the shell prompt via \h in the $PS1 environment variable.

  3. Set hostname using hostnamectl.
    user@linux-ui1m:~> sudo hostnamectl set-hostname host
    [sudo] password for root:
  4. Check hostname again to confirm.
    user@linux-ui1m:~> hostname

    The shell prompt is not immediately updated as $PS1 is only set when a new shell is started

  5. Start a new shell to test.
    user@linux-ui1m:~> bash
Discuss the article:

Comment anonymously. Login not required.