校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > CentOS7的hostnamectl命令使用詳解

CentOS7的hostnamectl命令使用詳解

熱門標簽:ai人工電話機器人 京東外呼系統怎么操作 bs外呼系統 長沙人工外呼系統公司 常州云呼叫外呼系統 上海營銷外呼系統定制 阿克蘇市地圖標注app 河北機器人電銷 小藍鴿電話機器人

centos7 上在主機名變更新增了一個hostnamectl 指令 ,該指令的無論在輸出和更改上都較之前更加的便利。先看下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

設置主機名

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

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.
更改主機名

一般情況下都是使用set-hostname進行更改:

復制代碼
代碼如下:

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

更改主機名一般會涉及到/etc/hostname 、/etc/machine-info 兩個文件,同時對于不同的名字修改在man手冊上也給了說明:

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 設置的主機一般和圖形界面會用到,對應的hostnamectl 輸出中的Icon name  ,set-chassis 指定了主機的平臺類型,如本機的是desktop,還可以設置為:"desktop", "laptop", "server", "tablet", "handset"

標簽:泉州 忻州 甘孜 來賓 邢臺 甘南 銅仁 周口

巨人網絡通訊聲明:本文標題《CentOS7的hostnamectl命令使用詳解》,本文關鍵詞  CentOS7,的,hostnamectl,命令,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《CentOS7的hostnamectl命令使用詳解》相關的同類信息!
  • 本頁收集關于CentOS7的hostnamectl命令使用詳解的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 洞口县| 廉江市| 泌阳县| 奇台县| 二连浩特市| 永济市| 铁力市| 尤溪县| 邛崃市| 峡江县| 科技| 资源县| 西宁市| 连江县| 临桂县| 永清县| 汤原县| 山西省| 营山县| 商南县| 若羌县| 辽宁省| 晴隆县| 连南| 嵊泗县| 石屏县| 于田县| 边坝县| 会理县| 黄大仙区| 淳安县| 浦城县| 大石桥市| 蒲城县| 佛教| 来宾市| 温宿县| 珲春市| 阳新县| 渝北区| 长汀县|