Red Hat Enterprise Linux 7.2修改主机名(hostname)
Red Hat Enterprise Linux 7.2在安装的时候,会默认生成主机名:localhost. 那么如何修改成自己想要的自己名?
//格式为:用户名@主机名
比如: [root@localhost ~]# 修改成[root@xiaolyu ~]#
我的目前已经是[root@xiaolyu ~]# 主机名(hostname)为xiaolyu ,可以修改为lyu。

方法一: 用图像界面修改(永久性修改)
在终端输入命令 nutui :[root@xiaolyu ~]# nmtui
进入如下图形界面:

选择第三行:Set system hostname

按回车键,进入:

然后直接进行编辑修改即可:

选中《OK>按回车键即可。

OK 即可!
重新打开一个新的终端,既可以发现主机名已经修改过来了:
[root@lyu ~]#

方法二:用命令行模式修改主机名:(永久修改,静态模式)
比如这里讲lyu改成xiaolyu:
[root@lyu ~]# hostnamectl
Static hostname: lyu
Icon name: computer-vm
Chassis: vm
Machine ID: 41395788ce5a4b3f93805203ebf82245
Boot ID: 02c90c2e76784d1293358ab6bc509f78
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
CPE OS Name: cpe:/o:RedHat:enterprise_linux:7.2:GA:server
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@lyu ~]# hostname --help
Usage: hostname [-b] {hostname|-F file} set host name (from file)
hostname [-a|-A|-d|-f|-i|-I|-s|-y] display formatted name
hostname display host name
{yp,nis,}domainname {nisdomain|-F file} set NIS domain name (from file)
{yp,nis,}domainname display NIS domain name
dnsdomainname display dns domain name
hostname -V|--version|-h|--help print info and exit
Program name:
{yp,nis,}domainname=hostname -y
dnsdomainname=hostname -d
Program options:
-a, --alias alias names
-A, --all-fqdns all long host names (FQDNs)
-b, --boot set default hostname if none available
-d, --domain DNS domain name
-f, --fqdn, --long long host name (FQDN)
-F, --file read host name or NIS domain name from given file
-i, --ip-address addresses for the host name
-I, --all-ip-addresses all addresses for the host
-s, --short short host name
-y, --yp, --nis NIS/YP domain name
Description:
This command can get or set the host name or the NIS domain name. You can
also get the DNS domain or the FQDN (fully qualified domain name).
Unless you are using bind or NIS for host lookups you can change the
FQDN (Fully Qualified Domain Name) and the DNS domain name (which is
part of the FQDN) in the /etc/hosts file.
[root@lyu ~]# hostnamectl --static set-hostname xiaolyu
再次打开一个新终端,可以发现@后面的用户名已经修改。
[root@lyu ~]# hostname
xiaolyu
[root@lyu ~]# hostnamectl
Static hostname: xiaolyu
Icon name: computer-vm
Chassis: vm
Machine ID: 41395788ce5a4b3f93805203ebf82245
Boot ID: 02c90c2e76784d1293358ab6bc509f78
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.2:GA:server
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
[root@lyu ~]#
(init6或者reboot之后也可以,但是比较麻烦)。
而且是永久修改。
如何让@后面显示的主机名也跟着变呢?重启! reboot或者init 6
再次查看:

搞定!
Red Hat Enterprise Linux 7.2修改主机名(hostname)的更多相关文章
- Configure Always On Availability Group for SQL Server on RHEL——Red Hat Enterprise Linux上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Red Hat Enterprise Linux上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的 ...
- Red Hat Enterprise Linux 7.x新特性
Red Hat Enterprise Linux 7.x新特性 RHEL7新特性简介 1. RHEL7目前支持架构 64-bit AMD.64-bit Intel.IBM POWER.IBM ...
- Red Hat Enterprise Linux 6.6安装体验
Red Hat Enterprise Linux 6.6的安装首界面有五个选项,这跟以前的Red Hat Enterprise Linux 5.x的安装界面是有一些区别的. 安装或者升级现有系统( ...
- 如何安装win10+Red Hat Enterprise Linux双系统?
1,如何安装win10+Red Hat Enterprise Linux双系统???? 有很多人(没做过调查,可能就我自己想装吧)想要安装Red Hat Enterprise Linux系统,但是又不 ...
- Red Hat Enterprise Linux 6.4常用命令
常用命令: profile文件立即生效:source /etc/profile source /home/kituser/.bash_profile 修改文件夹子文件权限:chmod -R 777 / ...
- Deploy Oracle 10.2.0.5 DataGuard on Red Hat Enterprise Linux 6.4
系统:Red Hat Enterprise Linux 6.4 数据库:Oracle 10.2.0.5.0 Patch Set 4 主机:10dg1 192.168.1.91 10dg2192.168 ...
- Red Hat Enterprise Linux Server(RHEL) yum安装软件时This system is not registered with RHN. RHN support will be disabled. 的解决方法(转)
新安装了redhat6.5.安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription M ...
- Deploy Oracle 10.2.0.5 on Red Hat Enterprise Linux 6.4
一.Linux系统安装和配置 1.安装系统时选Desktop 2.设置eth0网卡为静态IP,加入子网掩码,网关,DNS.并配置自己主动启动 3.改动/etc/hosts.加入主机名和相应IP 4.禁 ...
- 在Red Hat Enterprise Linux 7.3上安装SQL Server 2017
必要条件: 1.在此快速安装过程中,您需要安装SQL Server 2017或SQL Server 2019上Red Hat Enterprise Linux (RHEL) 7.3 +.然后使用sql ...
随机推荐
- Python基础之读写xml总结
参考文章:https://blog.csdn.net/weixin_42749767/article/details/82770563 先介绍xml.dom.minidom包,有一个读写的例子 rea ...
- 【Azure API 管理】在APIM中使用客户端证书验证API的请求,但是一直提示错误"No client certificate received."
API 管理 (APIM) 是一种为现有后端服务创建一致且现代化的 API 网关的方法. 问题描述 在设置了APIM客户端证书,用户保护后端API,让请求更安全. 但是,最近发现使用客户端证书的API ...
- element+vue点击新增表格内在已有数据添加一行带输入框内容
在element+vue项目中,需求要表格内已有数据,点击新增在首行添加一行带输入框内容 table的数据为datas=[],那么下面是一列的数据,多列可循环或复制 <el-table-colu ...
- Django GIS SQL注入漏洞(CVE-2020-9402)
影响版本 Django 1.11.29之前的1.11.x版本.2.2.11之前的2.2.x版本和3.0.4之前的3.0.x版本中存在SQL注入漏洞 提示有admin.vuln.vuln2,3个页面,存 ...
- python算法练习(1)抓交通肇事犯
抓交通肇事犯 1.问题描述 一辆卡车违反交通规则,撞人后逃跑.现场有三人目击该事件,但都没有记住车号,只记下了车号的一些特征.甲说:牌照的前两位数字是相同的:乙说:牌照的后两位数字是相同的,但与前两位 ...
- upload-lab 靶场实战
文件上传/下载 漏洞 冲冲冲,好好学习 2020.02.13 淦靶场之前,先来点知识铺垫铺垫. 文件上传漏洞 前端Js绕过. MIME类型绕过 后缀名大写写绕过 / php4 .php5 00截断 覆 ...
- Build Puppet Clusters with Vagrant
$ cd ~/docs/propuppetex/chapter3 $ cat Vagrantfile Vagrant.configure(VAGRANTFILE_API_VERSION) do |co ...
- webpack 配置文件外置
转自:https://www.jianshu.com/p/377bfd2d9034 1.问题初衷 解决问题的初衷,源于vue项目中公共路径在打包之后一旦遇到整体的路径更改就需要再次build一下. 如 ...
- Sqli-Labs less20-22
less-20 第20关成功登陆之后会产生一个cookie,作为下次登陆的凭证(可以用于登陆其他人的qq空间) 这里我依然使用burp suite,其实火狐和谷歌上有许多插件可以改http头和cook ...
- <span> 标签与<p>标签的区别
p标签指一个段落,是块级元素,有换行效果:span是行内元素,一般单独修饰文字: span 标签可以放在p标签里,p标签不应该放在span标签里: