SystemMen - How to change the hostname in Ubuntu 16. This article will guide you how to change hostname in Ubuntu server 16. This article can be used for operating systems that are using systemd. Currently, Ubuntu version 16 or later, CentOS version 7 or later, these are the two most popular OS are using systemd.
Check the current hostname
You run the following command to check the current hostname:
Change hostname in Ubuntu 16
For operating systems that use systemd (Ubuntu 16 or later, CentOS 7 or later), there is support for a command that lets you change hostnames quickly.
To change the hostname using the
hostnamectl command, type the following command:
hostnamectl set-hostname your-new-hostname
For example, i will set the new hostname is writebash:
hostnamectl set-hostname writebash
After you run the command, you must exit the current ssh session or logout in the console window. You can then login and check the new hostname.
Change hostname in older Ubuntu
For older Ubuntu OSs, do not use systemd. You must change the hostname in the following two files:
/etc/hostname file, there is only one line. You delete the old hostname in the file and replace the new hostname.
After changing the hostname in the two files above, you reboot the system.
This article is about how to change the hostname in the Ubuntu operating system in general and the operating system Ubuntu server 16 in particular. To note with the Ubuntu operating system older than 16, you should change and reboot the system without installing anything.If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.