Redhat Enterprise Linux 7.4/CentOS 7.4 安装后初始化配置

时间:2022-04-01 16:26:21

由于我是最小化安装,需要在安装后进行一些配置

1. 设定启动级别

[root@home ~]# systemctl set-default multi-user.target

2. 设定网络

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=54a33101-00eb-41223-9c65-cd7c03adb019
DEVICE=eth0
ONBOOT=yes
IPADDR=10.108.1.15
PREFIX=24
GATEWAY=10.108.1.1
DNS1=10.108.1.1

IPV6_PRIVACY=no

3. 由于我是在内网环境使用,所以关闭selinux

[root@home ~]# vi /etc/selinux/config
SELINUX=disabled

4. 由于我是在内网环境使用,所以也关闭firewall

[root@home ~]# systemctl stop firewalld.service
[root@home ~]# systemctl disable firewalld.service

5. 设定aliyun作为CentOS yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache

6. 挂载ISO作为RHEL yum源 (Red Hat Enterprise Linux)

[root@home ~]# mkdir /mnt/rhel
[root@home ~]# mount -o loop -t iso9660 /opt/rhel-server-7.4-x86_64-dvd.iso /mnt/rhel
[root@home ~]# vi /etc/yum.repos.d/rhel.repo
[rhel]
name=rhel
baseurl=file:///mnt/rhel
gpgcheck=0
enabled=1
[root@home ~]# yum repolist

7. 安装常用的软件

yum -y install yum-utils yum-priorities epel-release
yum -y install bind-utils wget vim htop

8. 更新系统

yum -y update