Ubuntu 18.04 change hostname


1. Change the hostname using hostnamectl.

In Ubuntu 18.04 we can change the system hostname and related settings using the command hostnamectl.

For example is we want to change the system static hostname to linuxize, we can use the following command:

sudo hostnamectl set-hostname linuxize

2. Edit the /etc/hosts file.Open the /etc/hosts file and change the old hostname to the new one.

127.0.0.1   localhost
127.0.0.1   linuxize

3. Edit the cloud.cfg file.

If the cloud-init package is installed you also need to edit the cloud.cfg file. This package is usually installed by default in the images provided by the cloud providers such as AWS and it is used to handle the initialization of the cloud instances.
To check if the package is installed run the following ls command:

ls -l /etc/cloud/cloud.cfg

In this case you’ll need to open the /etc/cloud/cloud.cfg file:
sudo nano /etc/cloud/cloud.cfg

Search for preserve_hostname and change the value from false to true:

# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true



Create pem certificate

 Creating a .pem with the Private Key and Entire Trust Chain     Log into your DigiCert Management Console and download your Intermediate (D...

Mais vistos