![]() To do this, simply follow the given syntax: sudo hostnamectl set-hostname Just like the hostname command, you can use the hostnamectl command to change your hostname. You have successfully changed your hostname temporarily. Let’s change the hostname to “DSHome” by using the following hostname command in the terminal: sudo hostname DSHomeĪfter running this command, use the hostname command to verify the temporary change: The syntax of using this command is defined as: sudo hostname You can temporarily change your machine’s hostname by simply using the hostname command. ![]() You have successfully changed your Hostname permanently. After the restart, verify the hostname using the hostnamectl command: Replace the old hostname with the new one and save the file.įinally, restart your machine to apply your permanent changes. Look for the line that starts with 127.0.0.1 and has the old hostname next to it: Open the file with the following command: sudo nano /etc/hosts Replace the current hostname with the new hostname:Īfter that, simply save and close the file using the “ CTRL+O” followed up by “ CTRL+X.” You’ll also need to update the /etc/hosts file to reflect the new hostname. Running this will show the hostname file’s content: The configuration files are “hosts” and “hostname.” Start by opening the hostname file using the following command: sudo nano /etc/hostname If you want to change the hostname permanently, you’ll need to change your system configuration files. Method 2: Edit the Hosts Configuration Files However, this change is temporary and will reset after your machine has been rebooted. You have successfully changed your hostname. This will show you the hostname of your machine after the change has been made: Type the hostname that you want and press the Enter key:Īfter that, exit the Network Manager UI and type the following command in the terminal: hostnamectl Doing this will open a new pop-up window asking you about the new hostname: Use the keyboard arrow keys to head to the third option, “ Set system hostname,” and press enter. Type in the password for the root user, and the terminal will display the following textual menu: If the nmtui utility is not installed on your Linux operating system, then you will first install it using the following commands:įor CentOS/RHEL: sudo yum install NetworkManager-tuiįor Ubuntu/Debian: sudo apt install NetworkManager-tuiĪfter that nmtui has been installed, open a terminal and type the following command: sudo nmtui This is a great tool for beginners in the Linux Operating System. This means that it allows the users to change their hostname as well. The Network Manager Text User Interface is a setup wizard that lets users manage their network settings. Method 1: Change Hostname With Network Manager Note: Alternatively, you can use the command “ hostnamectl” to get more information. You can easily check the hostname of your machine by running the following command in the terminal: hostnameĪs you can see from the image, the current hostname is set to “ linux.” This guide will teach you all the different ways that you can use to change the hostname of your Linux Operating System.īut first… How to Check the Hostname in Linux?īefore learning how to change the hostname, you should be aware of the method of checking the current hostname. Also, having a more meaningful hostname allows your PC to be easily accessed instead of using its IP Address. ![]() Various scenarios can require you to change the hostname of your Linux Operating System, such as deploying a Local Server/domain. However, the user can manually set it after the installation at any time according to the requirements. By default, the hostname is set during the installation process of the Linux Operating System. The hostname is an identifier every Linux Operating System has on the network. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |