Set Ubuntu Hostname and Network

To define the Ubuntu hostname use:

hostnamectl set-hostname new-hostname

You can also define a “pretty” hostname that is shown to the user:

hostnamectl set-hostname new-hostname --pretty

Ubuntu 22.04 uses netplan to configure the network. The configuration is stored in “/etc/netplan”. The initial setup will create a file here, and you can manipulate it to suit your needs:

sudo nano /etc/netplan/00-network-config.yaml
network:
  ethernets:
    ens192:
      addresses:
      - #.#.#.#/#
      gateway4: #.#.#.#
      nameservers:
        addresses:
        - #.#.#.#
        - #.#.#.#
        search:
        - domain.name
  version: 2

To apply the changes use:

sudo netplan apply

To configure the timezone you can use:

sudo timedatectl set-timezone "America/Los_Angeles"

DavisSystem

Consolidated Notes From the Desk of Sean Davis.


Set Ubuntu Hostname and Network

By Sean, 2022-12-09