1. 基本命令包

首先需要yum groupinstall base (在光盘镜像)

安装完后ifconfig、service、chkconfig等命令就都有了

2. 运行级修改

Redhat 7之前,是修改 /etc/inittab文件。

Redhat 7的话,查看该文件会有提示。

# inittab is no longer used when usingsystemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ONYOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by/etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. Bydefault, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<targetname>.target /etc/systemd/system/default.target

只需要在/lib/system/system/目录下建个软件连即可。

 

3. 网络配置

a) 网络管理器

RHEL 7 安装有网络管理器,并处于启动状态

#systemctl status NetworkManager.service

b) 查看网络接口

#nmcli dev status

查看网络接口。

c) 文本配置网络

在如下路径,增加文件如ifcfg-enp0s3

#/etc/sysconfig/network-scripts/

 

d) 图形化配置网络

#nmtui

启动图形化配置。

e) 启动网络

#systemctl restart network.service

4. 主机名

编辑文件

/etc/hostname

即可修改主机名。

注:RedHat7之前,编辑/etc/sysconfig/network文件。

Redhat7中使用命令 hostnamectlstatus 命令查看主机名

#hostnamectl status

此外也可以在

#nmtui

中设置主机名

 

5. 防火墙

查看防火墙状态。

#systemctl status firewalld

临时关闭防火墙命令。重启电脑后,防火墙自动起来。

systemctl stop firewalld

永久关闭防火墙命令。重启后,防火墙不会自动启动。

systemctl disable firewalld

打开防火墙命令。

systemctl enable firewalld