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 ...
随机推荐
- shell获取db信息及上传下载操作
这个脚本是获取目标机器的db信息和os信息的.os信息很好获取,db的信息包含db名字,db版本以及所有的db instance,db信息的获取稍显复杂,下面是整个脚本代码: 关键字: awk, se ...
- Zabbix探索:Proxy没有回传任何数据
因为Zabbix使用Puppet搭建的,实际上是通过脚本安装的,为了偷懒,将脚本都写一块去了,后来发现Proxy的配置和Zabbix的配置不同,又偷懒一次,复制了一下,但是为了调整脚本使用的便捷性,将 ...
- 树-二叉平衡树AVL
基本概念 AVL树:树中任何节点的两个子树的高度最大差别为1. AVL树的查找.插入和删除在平均和最坏情况下都是O(logn). AVL实现 AVL树的节点包括的几个组成对象: (01) key -- ...
- 用JDK自带的工具生成客户端调用Webservice的代码
JAVA下客户端调用Webservice代码简直是让人心生畏惧,今日尝试,做记录如下,参考网上的众多解决方案,下面这种方式是比较简单的. 在jdk的bin目录下有一个wsimport.exe的工具,使 ...
- 【转载】free查看内存
http://blog.csdn.net/hylongsuny/article/details/7742995 free 命令相对于top 提供了更简洁的查看系统内存使用情况:$ free ...
- HW6.19
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- dataStructure@ Check if a directed graph has cycles
#include<iostream> #include<cstdio> #include<cstring> #include<limits> #incl ...
- SRM 599 DIV 2
rating又掉了...变灰色了%>_<%.250pt很简单,一眼看上去是个背包,没有多想立马写了个01背包,后面发现其实就是个简单的排序...因为只是需要求数量而已.500pt被我写残了 ...
- 二叉搜索树算法详解与Java实现
二叉查找树可以递归地定义如下,二叉查找树或者是空二叉树,或者是满足下列性质的二叉树: (1)若它的左子树不为空,则其左子树上任意结点的关键字的值都小于根结点关键字的值. (2)若它的右子树不为空,则其 ...
- WebApi Json格式化
两种转换方式: 1.全局设定,针对GlobalConfiguration.Configuration.Formatters.JsonFormatter做设定,位于Global.asax 如: var ...