How to Change Hostname on Ubuntu 18.04
This instructional exercise will manage you through the way toward changing the hostname on a Ubuntu 18.04 framework.
The hostname is set when the Ubuntu working framework is introduced or on the off chance that you are turning up a virtual machine it is progressively relegated to the occurrence at startup.
The technique depicted in this guide will work without the need of restarting your framework.
Despite the fact that this instructional exercise is composed for Ubuntu 18.04 similar guidelines apply for Ubuntu 16.04 and any Ubuntu-based dispersion, including Linux Mint and Elementary OS.
Prior to proceeding with this instructional exercise, ensure you are signed in as a client with sudo advantages .
A hostname is a mark that distinguishes a machine on the organization. You shouldn't utilize the equivalent hostname on two unique machines on an equivalent organization.
Display the Current Hostname
To see the current hostname, enter the accompanying order:
Ubuntu 18.04 hostnamectl
As should be obvious in the picture over, the current hostname is set to ubuntu1804.localdomain.
Change the Hostname
The accompanying advances layout how to change the hostname in Ubuntu 18.04.
1. Change the hostname using
In Ubuntu 18.04 we can change the framework hostname and related settings utilizing the order hostnamectl.
For instance, to change the framework static hostname to linuxize, you would utilize the accompanying order:
sudo hostnamectl set-hostname linuxize
The hostnamectl order doesn't create yield. On progress, 0 is restored, a non-zero disappointment code in any case.
2. Edit the
Open the/and so forth/has document and change the old hostname to the enhanced one.
127.0.0.1 localhost 127.0.0.1 linuxize # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
3. Edit the
In the event that the cloud-init bundle is introduced you likewise need to alter the cloud.cfg document. This bundle is generally introduced naturally in the pictures gave by the cloud suppliers, for example, AWS and it is utilized to deal with the instatement of the cloud occurrences.
To check if the bundle is introduced run the accompanying ls order :
ls -l /etc/cloud/cloud.cfg
In the event that you see the accompanying yield it implies that the bundle isn't introduced and no further activity is required.
ls: cannot access '/etc/cloud/cloud.cfg': No such file or directory
In the event that the bundle is introduced the yield will resemble the accompanying:
-rw-r--r-- 1 root root 3169 Apr 27 09:30 /etc/cloud/cloud.cfg
For this situation you'll have to open the/and so on/cloud/cloud.cfg record:
sudo vim /etc/cloud/cloud.cfg
Quest for preserve_hostname and change the incentive from bogus to valid:
# This will cause the set+update hostname module to not operate (if true) preserve_hostname: true
Save the document and close your proofreader.
Verify the change
To confirm that the hostname was effectively changed, by and by utilize the hostnamectl order:
Static hostname: linuxize Icon name: computer-vm Chassis: vm Machine ID: 6f17445f53074505a008c9abd8ed64a5 Boot ID: 1c769ab73b924a188c5caeaf8c72e0f4 Virtualization: kvm Operating System: Ubuntu 18.04 LTS Kernel: Linux 4.15.0-22-generic Architecture: x86-64
You should see your new worker name imprinted on the support.
In this instructional exercise, we have told you the best way to handily change your Ubuntu worker hostname without restarting the machine.
Don't hesitate to leave a remark in the event that you have any inquiries.
FFmpeg is a free and open-source assortment of devices for taking care of sight and sound documents. It contains a lot of shared sound and video li...
FFmpeg is a free and open-source order line apparatus for transcoding sight and sound records. It contains a bunch of shared sound and video librar...
A cron work is an errand that is executed at indicated spans. The errands can be planned to run by a moment, hour, day of the month, month, day of ...
Python is one of the most generally utilized programming dialects on the planet. With its basic and simple to learn punctuation, Python is a mainst...
TeamViewer is a cross-stage arrangement that can be utilized for controller, work area sharing and record move between PCs. TeamViewer is exclusive...
This article discloses how to set up a static IP address on Ubuntu 20.04. Regularly, in most organization designs, the IP address is alloted...
sudo is an order line utility that permits confided in clients to run orders as another client, of course root. This instructional exercise ...
On CentOS, the framework's timezone is set during the introduce, however it tends to be handily changed sometime in the not too distant future....
Java is one of the most well known programming dialects on the planet, utilized for building various kinds of cross-stage applications. This...
Python is one of the most well known programming dialects on the planet. With its straightforward and simple to learn grammar, Python is a famous d...
The mouseenter event permits us to set off a way of behaving when the client mouses over a component. Study this and other mouse events. Precise i...
Normally the hostname is set during the establishment of the working framework or progressively appointed to the virtual machine when it is made.&n...
Nagios is a mainstream open-source checking programming. It keeps a stock of your whole IT foundation and guarantees your organizations, workers, a...
In CodeIgniter, there is a zip library for creating a zip file but there is no library available for extracting the zip file. To extrac...
Records are one of the most ordinarily utilized information types in Python and are utilized to store assortments of things of a similar sort. ...
Apache is an open-source and cross-stage HTTP worker. It comes stacked with amazing highlights and can be additionally stretched out with a wide as...
Introduction React empowers engineers to compose reusable code as parts. This particular methodology simplifies it to create hearty applications b...
Boa constrictor is the most mainstream Python/R information science and AI stage. It is utilized for huge scope information preparing, prescient in...
In this instructional exercise, we will tell you the best way to make a bootable Ubuntu USB stick from the Linux terminal. You can utilize this USB...