In this post we will discuss how to change hostname with nmtui and nmcli tools.
nmtui
Let’s first try with nmtui tool
- If you don’t have the nmtui tool installed, you can install it using yum
yum install NetworkManager-tui
- Invoke the nmtui interface from the command line by executing as root user
nmtui
- In the menu select “Set system hostname” .
- Write the new hostname which you want to keep. We want to change it to “prodvedas”.
- To make it effective restart the “hostnamed” service
systemctl restart systemd-hostnamed
- Now if you login with new session or do “su -” in same session you should see new hostname.
Let’s try changing the hostname with nmcli tool in Redhat Linux.
- To check the current hostname
nmcli general hostname
- If you want to change the hostname
nmcli general hostname prodvedas
- To make it effective restart hostnamed service
systemctl restart systemd-hostnamed
- Now if you login with new session or do “su -” in same session you should see new hostname.
If you are trying to change hostname of AWS EC2 linux instance the process will be slightly different. Refer this post to change AWS EC2 instance hostname.
No comments:
Post a Comment