Linux查看及修改機器名稱

來源:互聯網
上載者:User

標籤:linux   修改機器名稱   

經常需要在VMWare中複製虛擬機器,對於複製的新機器需要修改機器名稱,不然在同一區域網路中就發生衝突了,下面是在Linux系統下查看及修改機器名稱的方法及步驟:

1、查看系統的機器名稱:

    使用root使用者登入,在終端控制台輸入: hostname

    [[email protected] ]# hostname

    AAAAAname

2、臨時修改機器名稱:

    [[email protected] ]# hostname yourname

    [[email protected] ]# hostname

    yourname

註:不過第2步的修改只能臨時有效,機器重啟又還原了,想要讓修改永久生效,還要繼續下面的步驟:

3、修改hosts 檔案(路徑:/etc/hosts):

    [[email protected] ]# vi /etc/hosts

    把hosts裡面所有原來的名稱改成你想改成的名稱

4、修改network檔案(路徑:/etc/sysconfig/network):

    [[email protected] ]# vi /etc/sysconfig/network

    把裡面的hostname=XXX 中XXX改成你想改成的名稱

5、重啟機器:

     [[email protected] ]# reboot

 

ok,修改完畢~~~~~~~~   

    

本文出自 “QYtag (Upspringing)” 部落格,請務必保留此出處http://qytag.blog.51cto.com/6125308/1579146

Linux查看及修改機器名稱

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.