Fedora 19修改主机名
Distribution为Fedora 19
方式一(重启后失效,需root权限):
hostname 新主机名
[root@promote hadoop]# hostname
promote.cache-dns.local
[root@promote hadoop]# hostname fedora
[root@promote hadoop]# hostname
fedora
方式二(重启后依然生效,需root权限):
网上有很多人说只要修改/etc/sysconfig/network文件,在文件中添加如下2行即可:
[root@promote sysconfig]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=fedora
[root@promote sysconfig]# hostname
promote.cache-dns.local
我实际操作了一次,这种修改方式在Fedora 19中是没有效果的,先使用man hostname看看命令说明,其中有一段很关键:
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, ypdomainname and nisdomainname use
setdomainname(2).Note,that this is effective only until the next reboot.
Edit /etc/hostname for permanent change. Note,that only the super-user can change the names. It is not possible to set the FQDN or the DNS domain name with the dnsdomainname
command(see THE FQDN below). The host name is usually set once at system startup (normally by reading the
contents of a file which contains the host name, e.g. /etc/hostname).
这下全明白了,Fedora 9中hostname命令根本不会读取/etc/sysconfig/network文件,它读取的是/etc/hostname文件
将/etc/hostname文件中的内容修改为fedora,没重启就生效了
[root@promote sysconfig]# cat /etc/hostname
fedora
[root@promote sysconfig]# hostname
fedora
并且在重启后依然生效
Fedora 19修改主机名的更多相关文章
- Linux命令之修改主机名
ubuntu永久修改主机名 1.查看主机名 在Ubuntu系统中,快速查看主机名有多种方法: 其一,打开一个GNOME终端窗口,在命令提示符中可以看到主机名,主机名通常位于“@”符号后: 其二,在终端 ...
- ubuntu永久修改主机名
1.查看主机名 在Ubuntu系统中,快速查看主机名有多种方法:其一,打开一个GNOME终端窗口,在命令提示符中可以看到主机名,主机名通常位于“@”符号后:其二,在终端窗口中输入命令:hostname ...
- ubuntu,CentOS永久修改主机名
1.查看主机名 在Ubuntu系统中,快速查看主机名有多种方法: 其一,打开一个GNOME终端窗口,在命令提示符中可以看到主机名,主机名通常位于“@”符号后: 其二,在终端窗口中输入命令:hostna ...
- Linux修改主机名方法
[root@lyx ~]# vim /etc/hosts vim代表修改,进入hosts文件进行添加192.168.10.128 hadoop128 [root@lyx ~]# hostname ...
- 修改主机名(/etc/hostname和/etc/hosts区别)
ubuntu永久修改主机名 1.查看主机名 在Ubuntu系统中,快速查看主机名有多种方法:其一,打开一个GNOME终端窗口,在命令提示符中可以看到主机名,主机名通常位于“@”符号后:其二,在终端窗口 ...
- Redhat 7修改主机名
修改主机名: Linux master2 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 G ...
- CentOS 7 修改主机名
今天在阿里云上买了一个centos7的服务器,连接上以后,发现一个很长很长的主机名,看着让人很是不爽,就想着怎样将其改成一个有个性的名字. 这里我想说的是,在centos7 版本的linux系统上和c ...
- SIHA环境修改主机名实施步骤
目 录 1 实施需求 2 修改主机名 2.1 停止HAS服务 2.2 修改主机名 3 重新配置服务 3.1 使用root用户重新配置CSS & OHAS服务 3.2 设置cssd自动启动属性 ...
- CentOS6.8 修改主机名(1)
1.临时修改主机名 显示主机名:spark@master:~$ hostnamemaster修改主机名:spark@master:~$ sudo hostname hadoopspark@mast ...
随机推荐
- [2015更新]用Word2007写CSDN博客
搞了半天终于可以用word2007发布CSDN博客了,特分享出来,以方便其他用户. 所示的界面. 图1 office按钮 所示的管理账号,然后点击"新建"也可以进入图3所示 ...
- 2016CCPC 中南地区邀请赛 A 矩阵快速幂
A A^n=A^(n%2016)%7; #include <iostream> #include <cstdio> #include <cstring> #incl ...
- Python subprocess Popen
目的:顺序执行进程 在Bash里面类似 a.sh && b.sh && c.sh 先来说下Popen这个函数 class subprocess.Popen(args ...
- Ubuntu安装JDK1.6
1.下载JDK 网址: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-4 ...
- JLink 在J-Flash ARM批处理自动下载
"C:\Program Files\SEGGER\JLinkARM_V420c\jflasharm.exe" -openprj.\stm32f100c8.jflash -open. ...
- FreeModbus Slave 改进的eMbPoll()【worldsing 笔记】
eMbPoll()的作用是FreeMod协议通信过程中不断查询事件对列有无完速数据桢,并进行地址和CRD验证,最后运行和回复主机. 为了减小代码尺寸对eMbPoll进行改进: 原版: 1: 2: e ...
- 偶遇mysql外键不好使
原来是创建表时选择的类型不一样,应该是innoDB,而且关联的主表类型也必须是innoDB
- 3.x的触摸响应机制
第一种是采用函数回调,主要是用于MenuItem [cpp] view plaincopy // a selector callback void menuCloseCallback(Object* ...
- hadoop 2.0 详细配置教程
http://www.cnblogs.com/scotoma/archive/2012/09/18/2689902.html
- 教你50招提升ASP.NET性能(六):为了生动的用户体验,总是在客户端验证
(12)For a snappy user experience, always validate on the client 招数12: 为了生动的用户体验,总是在客户端验证 To avoid un ...