Programming Tutorials

How to change the virtual machine name in Azure

By: Jason in Cloud Tutorials on 2020-06-01  

To change the hostname from an SSH terminal, follow these steps:

  1. Log in to your server via SSH using a user with root or sudo privileges.

  2. Open the file /etc/hostname in a text editor. For example:

    sudo nano /etc/hostname
    
  3. Replace the existing hostname with the new hostname that you want to set. Save and close the file.

  4. Open the file /etc/hosts in a text editor. For example:

    sudo nano /etc/hosts
    
  5. Find the line that contains the old hostname and replace it with the new hostname. Save and close the file.

  6. Reboot the server for the changes to take effect. You can do this by running the command:

    sudo reboot
    

After the reboot, your server will use the new hostname.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Cloud )

Latest Articles (in Cloud)