CentOS7中hostnamectl命令如何使用-創(chuàng)新互聯(lián)

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)CentOS7中hostnamectl命令如何使用,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

十年的防城網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整防城建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“防城網(wǎng)站設(shè)計(jì)”,“防城網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

centos7 上在主機(jī)名變更新增了一個(gè)hostnamectl 指令 ,該指令的無(wú)論在輸出和更改上都較之前更加的便利。先看下hostname的help幫助信息:


代碼如下:

[root@361way ~]# hostnamectl  --help
hostnamectl [OPTIONS...] COMMAND ...
Query or change system hostname.
 -h --help              Show this help
    --version           Show package version
    --transient         Only set transient hostname
    --static            Only set static hostname
    --pretty            Only set pretty hostname
 -P --privileged        Acquire privileges before execution
    --no-ask-password   Do not prompt for password
 -H --host=[USER@]HOST  Operate on remote host
Commands:
 status                 Show current hostname settings
 set-hostname NAME      Set system hostname
 set-icon-name NAME     Set icon name for host
 set-chassis NAME       Set chassis type for host



查看hostname信息



代碼如下:


[root@361way ~]# hostnamectl
  Static hostname: 361way
        Icon name: computer-desktop
          Chassis: desktop
       Machine ID: 6917731f5fe447d0bca296ed2802e250
          Boot ID: e0d20bc2a3a4474c960394967d33ab53
 Operating System: CentOS Linux 7 (Core)
      CPE OS Name: cpe:/o:centos:centos:7
           Kernel: Linux 3.10.0-123.6.3.el7.x86_64
     Architecture: x86_64



設(shè)置主機(jī)名

從上面的help 幫助里可以看到,在設(shè)置主機(jī)名時(shí),這里涉及到四種主機(jī)名,在hostnamectl 的man手冊(cè)里給予了說明和解釋,如下:

This tool distinguishes three different hostnames: the high-level "pretty" hostname which might include all kinds of special characters (e.g. "Lennart's
Laptop"), the static hostname which is used to initialize the kernel hostname at boot (e.g. "lennarts-laptop"), and the transient hostname which might be
assigned temporarily due to network configuration and might revert back to the static hostname if network connectivity is lost and is only temporarily
written to the kernel hostname (e.g. "dhcp-47-11").
Note that the pretty hostname has little restrictions on the characters used, while the static and transient hostnames are limited to the usually accepted
characters of Internet domain names.
更改主機(jī)名

一般情況下都是使用set-hostname進(jìn)行更改:



代碼如下:


[root@361way ~]# hostnamectl set-hostname blog



更改主機(jī)名一般會(huì)涉及到/etc/hostname 、/etc/machine-info 兩個(gè)文件,同時(shí)對(duì)于不同的名字修改在man手冊(cè)上也給了說明:

The static hostname is stored in /etc/hostname, see hostname(5) for more information. The pretty hostname, chassis type, and icon name are stored in /etc/machine-info, see machine-id(5).
set-icon-name 設(shè)置的主機(jī)一般和圖形界面會(huì)用到,對(duì)應(yīng)的hostnamectl 輸出中的Icon name  ,set-chassis 指定了主機(jī)的平臺(tái)類型,如本機(jī)的是desktop,還可以設(shè)置為:"desktop", "laptop", "server", "tablet", "handset"

上述就是小編為大家分享的CentOS7中hostnamectl命令如何使用了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

分享文章:CentOS7中hostnamectl命令如何使用-創(chuàng)新互聯(lián)
本文來(lái)源:http://muchs.cn/article14/dsgede.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、定制開發(fā)、虛擬主機(jī)、App設(shè)計(jì)、域名注冊(cè)Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁(yè)設(shè)計(jì)