[Linux] Modify the host name under Linux - simple three steps

linux server http host Blog network

summary: Please indicate the source for reprint: http://blog.csdn.net/qq_26525215 The user name turned out to be the product ID, which is very uncomfortable to use.

Please indicate the source for reprinting: http://blog.csdn.net/qq_26525215

This article comes from [University Journey_Anyi's Blog]
I bought a Linux server in Alibaba Cloud, but the root user name turned out to be the product ID. Feeling very upset.

How to change the username, the following three simple steps can be done.

1.
Log in as the root user, or switch to the root user after logging in, and
enter: hostname in the terminal will display the current host name.



Enter vi /etc/sysconfig/network, then change the value after HOSTNAME= to the hostname you want to set.



2.
Change the hosts file under /etc, enter vi /etc/hosts at the prompt, and then change localhost.localdomain (may be other, please find the corresponding location according to the picture, here it is chenhaoxiang) to the desired setting hostname.



3.

Enter the reboot command to restart the server.

After restarting, log in, and then enter hostname to view the host name!
To sum up the above core command is:

vi /etc/sysconfig/network
vi /etc/hosts
reboot
This article was written by [Anyi], all rights reserved.
Welcome to reprint, sharing is the source of progress.

Please indicate the source for reprinting: http://blog.csdn.net/qq_26525215

This article is from [University Journey_Anyi's Blog]
Copyright Notice: The content of this article is contributed voluntarily by Internet users, and this community does not own or bear the responsibility related legal responsibilities. If you find any content suspected of plagiarism in this community, please send an email to: [email protected] to report and provide relevant evidence. Once verified, this community will immediately delete the allegedly infringing content.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326219200&siteId=291194637