fedora修改hostname
来源:互联网 发布:免费看书软件哪个好 编辑:程序博客网 时间:2024/05/01 00:32
Linux 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
并且在重启后依然生效
阅读全文
0 0
- fedora修改hostname
- 如何在Fedora 20上修改hostname
- 修改Hostname
- 修改hostname
- 修改hostname
- 修改hostname
- 修改hostname
- Access Fedora via hostname
- fedora启动进入命令窗口_查看版本_修改hostname
- HostName 永久修改
- linux如何修改hostname
- hostname的修改
- CentOS修改主机名(hostname)
- ubuntu修改hostname
- linux下修改hostname
- CentOS修改主机名(hostname)
- Linux 修改hostname
- linux 修改hostname
- Faster R-CNN中的anchors和YOLO中的grid的理解
- 河南省第十届ACM比赛题解
- H5的postMessage解决跨域问题
- python yield generator 详解
- MYSQL解析2017/5/24
- fedora修改hostname
- java 方法以及方法的重载
- postgres的备份(Linux)与恢复(Windows)
- bl31的执行
- 列表中播放 videoview 仿内涵段子
- 不懂提高简历命中率?难怪没有面试!
- 有点乱,想歇歇
- 28.七-27拆分的runtest
- yii2框架下在两个页面之间传递弹出消息