Ubuntu修改主机名称

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chenyefei/article/details/48177427


1.  查看主机名称:

    $ hostname或uname –n  

2. sudo find / -name "hostname" 
    /bin/hostname
    /proc/sys/kernel/hostname
    /usr/share/doc/hostname
    /etc/init.d/hostname
    /etc/hostname

3. $ sudo chmod +w /etc/hostname /etc/hosts

4. $ sudo vim /etc/hostname

5. $ sudo vim /etc/hosts    #加入127.0.0.1 new_hostname 即可。

6. $ sudo chmod -w /etc/hostname /etc/hosts   #然后reboot即可生效


猜你喜欢

转载自blog.csdn.net/chenyefei/article/details/48177427
今日推荐