How to change the host name or machine name of a Linux Server

Source: Internet
Author: User

Change Linux Method of server host name or machine name IP The host name or machine name can be dynamically changed using the command hostname, or the hostname environment variable in/etc/sysconfig/Network/can be changed permanently.

You can also run the RedHat-config-network command and click the "DNS" page to change the "hostname" item.

If Samba is running, you want to change the system's NetBIOS name so that it is not the same as the IP host name. You can modify/etc/samba/smb. add a line to the conf file: NetBIOS name = <server name:>. Here, <server name:> is the name of your machine displayed on Windows. Most people use the Host Name of the system.

In the following example, the host name is changed from jaws to peahi in the command line. Note: If you only run the hostname command, the current host name is displayed.

# Hostname
Jaws.example.com
# Hostname peahi.example.com
# Hostname
Peahi.example.com

In the following example, modify the/etc/sysconfig/network file and change the host name from jaws to peahi. Use your favorite editor to make such changes.

# Cat/etc/sysconfig/Network
Networking = Yes
Hostname = jaws.example.com

# Cat/etc/sysconfig/Network
Networking = Yes
Hostname = peahi.example.com

Bu wzwind

You also need to modify the/etc/hosts file. Otherwise, software such as subversion may fail to obtain the local IP address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.