![]() ![]() In this tutorial, we learned how we can change the hostname of a Debian system by editing the etc/hostname file. First, let’s check the current hostname by using either the hostname or hostnamectl command. It should display the new hostname you set. Use the following steps to change Debian’s hostname using systemd’s hostnamectl command. You can verify the changes by opening a terminal and running the following command: hostname You can do this by running the following command: sudo rebootĪfter the system restarts, it should have the new hostname you set. To apply the new hostname, you need to restart your system. Update the hostname part in that line to match the new hostname you set in the /etc/hostname file. Use the arrows keys for navigation and select the option ‘Set system hostname’. Execute the ‘nmtui’ command in the terminal and the following dialogue will pop up on the terminal screen. In the file, you'll see a line starting with 127.0.1.1. The ‘nmtui’ command allows you to change the hostname in Debian 11. Open it with the text editor using the following command: sudo nano /etc/hosts Next, you need to update the /etc/hosts file. In nano, you can do this by pressing Ctrl+O to write the file and then Ctrl+X to exit. For example, if you want to change the hostname to "myhostname", your /etc/hostname file should contain only the following: myhostname Replace it with the new hostname you want to set. In the editor, you'll see the current hostname. For example, to use nano, run the following command: sudo nano /etc/hostname Use a text editor like nano or vim to open the file. In the terminal, you need to edit the /etc/hostname file. You can do this by clicking on the "Activities" button in the top-left corner, searching for "Terminal," and selecting the terminal application. ![]() Note that those also require root privileges (run with sudo). Find wherever your current name is mentioned and replace it with your desired one. To change the hostname in Debian 11, you can follow these steps: In general, the way to change the hostname in most if not all linux distributions (including Ubuntu and Debian) is by modifying the /etc/hosts/ and /etc/hostname files. It is used to distinguish one machine from another in a networked environment. Please do share your feedback and queries in below comments section.A hostname is a label or identifier assigned to a computer or device on a network. I hope you have found it informative and insightful. Verify the new hostname by running following command that’s all from this post. In the following window, specify the hostname that you want to set and then choose OK and hit enter.Ĭhoose OK in the following window and then quit the nmtui tool. It’s simple and straight forward, start nmtui tool by running, $ nmtuiĬhoose ‘ Set system hostname’ option and hit enter. Static hostname can also be set using nmtui tool. To remove pretty hostname, run $ sudo hostnamectl -pretty set-hostname "" Set hostname using nmtui tool Just use the following command: hostname Method 2: Identify Hostname Using -f Flag We can use the -f flag with the hostname command which will display FQDN (Fully Qualified Domain Name). To remove the static hostname, run $ sudo hostnamectl set-hostname "" Method 1: Identify Hostname Using Hostname Command This is the easiest way to identify the hostname of your Debian system. Perfect, above shows that static and pretty hostname are set. To set the pretty type hostname then use –pretty arguments in hostnamectl command, example is shown is below: $ sudo hostnamectl -pretty set-hostname "PKUMAR_LinuxBuzz #Blog#" ![]() Verify the hostname using following commands, $ hostname To set the static hostname, run the following hostnamectl command,Įxample $ sudo hostnamectl set-hostname "" When we run hostnamectl command without any arguments then it will display the current hostname, $ hostnamectlĪlternate way to check the hostname of your system is by running hostname command without any options, example is show below Set Static Hostname In modern linux distributions like RHEL, CentOS, Rocky Linux, Debian and Ubuntu hostnamectl is available for setting up the hostname. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |