Thursday, 8 November 2018

Ubuntu 18.04 - Changing the hostname

So I did not realise that it's now so hard to change a hostname in Ubuntu, I've obviously been spoilt in the past.

I assumed that it was a case of: -

sudo hostname hostname.domain.com
sudo vi /etc/hostname
sudo vi /etc/hosts
sudo reboot

but, alas, no longer - it's now more like: -

sudo hostnamectl set-hostname icpboot.uk.ibm.com
sudo vi /etc/cloud/cloud.cfg
sudo vi /etc/hosts
sudo reboot

Whilst I'm on a rant n' roll, the mechanism for changing an IP address has also changed ….

Now it's more like this: -

sudo vi /etc/netplan/50-cloud-init.yaml 

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens33:
            addresses:
            - 192.168.1.200/24
            gateway4: 192.168.1.1

            nameservers:
                addresses:
                - 9.9.9.9
                - 8.8.8.8
                - 1.1.1.1
                search: []
            optional: true
    version: 2


which is nice.

No comments: