CentOS 7.0 修改hostname
2016-04-10 11:35
591 查看
linux中修改hostname,可以临时修改hostname也可以永久修改,临时修改无需重新启动,立即生效。
SET NAME
When called with one argument or with the - -file option, the commands
set the host name or the NIS/YP domain name. hostname uses the
sethostname(2) function, while all of the three domainname, ypdomain‐name and nisdomainname use setdomainname(2). Note, that this is effec‐
tive only until the next reboot. Edit /etc/hostname for permanent
change.
如果我们要修改永久修改hostname,可以通过修改
注:
如果要永久修改RedHat的hostname,就修改/etc/sysconfig/network文件,将里面的HOSTNAME这一行修改成HOSTNAME=NEWNAME,其中NEWNAME就是你要设置的hostname。
临时修改hostname
#hostname //查看当前hostname #hostname newname //临时修改hostname
永久修改hostname
要永久修改hostname需要修改文件,man hostname查看使用手册是,有这样一段,
SET NAME
When called with one argument or with the - -file option, the commands
set the host name or the NIS/YP domain name. hostname uses the
sethostname(2) function, while all of the three domainname, ypdomain‐name and nisdomainname use setdomainname(2). Note, that this is effec‐
tive only until the next reboot. Edit /etc/hostname for permanent
change.
如果我们要修改永久修改hostname,可以通过修改
/etc/hostname文件来实现,使用vim将该文件中的hostname 替换为要修改的值即可。
注:
如果要永久修改RedHat的hostname,就修改/etc/sysconfig/network文件,将里面的HOSTNAME这一行修改成HOSTNAME=NEWNAME,其中NEWNAME就是你要设置的hostname。
相关文章推荐
- 关于Linux下解压tar文件出错问题
- Linux内核设计与实现 阅读笔记:8、下半部和推后执行的工作
- Linux删除文件常用的几种措施
- Linux中yum和apt-get用法及区别
- Centos6下DRBD的安装配置
- CentOS6 下rsync服务器配置
- centos7 挂载数据盘
- Web服务器磁盘满故障深入解析
- Linux下socket的五种IO模型
- date命令
- 在CentOS 6.6磁盘上分了个区的
- Linux内核如何装载和启动一个可执行程序(Linux)
- Linux内核分析实验七
- 64位 ubuntu 运行32位命令 (arm-none-linux-gnueabi-gcc)
- Linux kernel Makefile for ctags
- Linux内核分析第七周———可执行程序的装载
- 实验七:Linux内核如何装载和启动一个可执行程序
- linux备份
- centos7搭建hadoop集群
- 我就是个俗人,我还是继续用Windows开发吧