centos设置名字(centos7安装软件选择)
各位老铁们好,相信很多人对centos设置名字都不是特别的了解,因此呢,今天就来为大家分享下关于centos设置名字以及centos7安装软件选择的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!
CentOS7的hostnamectl命令使用详解
centos7上在主机名变更新增了一个hostnamectl指令,该指令的无论在输出和更改上都较之前更加的便利。先看下hostname的help帮助信息:
复制代码代码如下:
[root@361way~]# hostnamectl--help
hostnamectl [OPTIONS...] COMMAND...
Query or change system hostname.
-h--help Show this help
--version Show package version
--transient Only set transient hostname
--static Only set static hostname
--pretty Only set pretty hostname
-P--privileged Acquire privileges before execution
--no-ask-password Do not prompt for password
-H--host=[USER@]HOST Operate on remote host
Commands:
status Show current hostname settings
set-hostname NAME Set system hostname
set-icon-name NAME Set icon name for host
set-chassis NAME Set chassis type for host
查看hostname信息
复制代码代码如下:
[root@361way~]# hostnamectl
Static hostname: 361way
Icon name: computer-desktop
Chassis: desktop
Machine ID: 6917731f5fe447d0bca296ed2802e250
Boot ID: e0d20bc2a3a4474c960394967d33ab53
Operating System: CentOS Linux 7(Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-123.6.3.el7.x86_64
Architecture: x86_64
设置主机名
从上面的help帮助里可以看到,在设置主机名时,这里涉及到四种主机名,在hostnamectl的man手册里给予了说明和解释,如下:
This tool distinguishes three different hostnames: the high-level"pretty" hostname which might include all kinds of special characters(e.g."Lennart's
Laptop"), the static hostname which is used to initialize the kernel hostname at boot(e.g."lennarts-laptop"), and the transient hostname which might be
assigned temporarily due to network configuration and might revert back to the static hostname if network connectivity is lost and is only temporarily
written to the kernel hostname(e.g."dhcp-47-11").
Note that the pretty hostname has little restrictions on the characters used, while the static and transient hostnames are limited to the usually accepted
characters of Internet domain names.
更改主机名
一般情况下都是使用set-hostname进行更改:
复制代码代码如下:
[root@361way~]# hostnamectl set-hostname blog
更改主机名一般会涉及到/etc/hostname、/etc/machine-info两个文件,同时对于不同的名字修改在man手册上也给了说明:
The static hostname is stored in/etc/hostname, see hostname(5) for more information. The pretty hostname, chassis type, and icon name are stored in/etc/machine-info, see machine-id(5).
set-icon-name设置的主机一般和图形界面会用到,对应的hostnamectl输出中的Icon name,set-chassis指定了主机的平台类型,如本机的是desktop,还可以设置为:"desktop","laptop","server","tablet","handset"
centos7网络配置
centos7网络配置的方法如下:
电脑:联想y7000
系统:Windows10
设备:centos78.0.2
1、安装时候配置如果是初始安装centos7系统,如图点击选择“网络配置”。
2、出现的网卡设置界面,选一个网卡,然后点击右侧的“配置”。
3、出现的对话框,选择ipv4栏目,改成手动配置,添加好IP掩码dns和网关等项目,确定即可。
4、图形界面设置如果是安装好了的centos系统,若有图形界面,找到系统工具(system tools,settings)。
5、接着找到network网络配置,如图是centos7.6kkiwork组件的设置界面,其他桌面的设置也是类似
6、命令行界面设置此外用的最多的当然是用命令来配置,先安装网络工具,如果不能上网跳过此步骤。
7、使用ifconfig或ipaddr查看确认都有哪些网卡,记录下网卡的名字,配置完重启。
centos7修改网卡名字的方法
很多同学在装完centos7,发现网卡接口名字变了,不再是eth*或者em*了,而是ens*,但是这样统一维护起来就比较麻烦,那么怎么修改呢,请看下文:
1.拷贝网卡接口配置文件
Ruby Code复制内容到剪贴板#cd/etc/sysconfig/network-scripts/#cpifcfg-ens32ifcfg-eth0
编辑ifcfg-eth0,将文件中的ens32改为eth0
Ruby Code复制内容到剪贴板#cd/etc/sysconfig/network-scripts/#cpifcfg-ens32ifcfg-eth0
编辑ifcfg-eth0,将文件中的ens32改为eth0
2.修改grub
Ruby Code复制内容到剪贴板#vim/etc/default/grub修改GRUB_CMDLINE_LINUX行内容,在后面加上net.ifnames=0biosdevname=0,如下:GRUB_CMDLINE_LINUX=crashkernel=autorhgbquietnet.ifnames=0biosdevname=0#vim/etc/default/grub修改GRUB_CMDLINE_LINUX行内容,在后面加上net.ifnames=0biosdevname=0,如下:GRUB_CMDLINE_LINUX=crashkernel=autorhgbquietnet.ifnames=0biosdevname=0
3.重新生成grub.cfg文件
Python
Ruby Code复制内容到剪贴板#grub2-mkconfig-o/boot/grub2/grub.cfgGeneratinggrubconfigurationfile...Foundlinuximage:/boot/vmlinuz-3.10.0-327.el7.x86_64Foundinitrdimage:/boot/initramfs-3.10.0-327.el7.x86_64.imgFoundlinuximage:/boot/vmlinuz-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619Foundinitrdimage:/boot/initramfs-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619.imgdone#grub2-mkconfig-o/boot/grub2/grub.cfgGeneratinggrubconfigurationfile...Foundlinuximage:/boot/vmlinuz-3.10.0-327.el7.x86_64Foundinitrdimage:/boot/initramfs-3.10.0-327.el7.x86_64.imgFoundlinuximage:/boot/vmlinuz-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619Foundinitrdimage:/boot/initramfs-0-rescue-cbe15acd3ca347f4a373c8f4adaf2619.imgdone
4. reboot重启
以上所述是小编给大家介绍的centos7修改网卡名字的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!