1.VMware下CentOS7最小化安装

1.1.VMware安装虚拟机

centos7最小安装都会安装什么 centos7.6最小化安装_linux

centos7最小安装都会安装什么 centos7.6最小化安装_linux_02

centos7最小安装都会安装什么 centos7.6最小化安装_centos_03

centos7最小安装都会安装什么 centos7.6最小化安装_linux_04

centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_05

centos7最小安装都会安装什么 centos7.6最小化安装_linux_06

centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_07

centos7最小安装都会安装什么 centos7.6最小化安装_运维_08

centos7最小安装都会安装什么 centos7.6最小化安装_linux_09

centos7最小安装都会安装什么 centos7.6最小化安装_运维_10

centos7最小安装都会安装什么 centos7.6最小化安装_linux_11

centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_12

![在这里插入图片描述](

centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_13

centos7最小安装都会安装什么 centos7.6最小化安装_linux_14

centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_15

centos7最小安装都会安装什么 centos7.6最小化安装_centos_16


centos7最小安装都会安装什么 centos7.6最小化安装_linux_17

镜像文件下载地址:

CentOS 官方下载地址:https://www.centos.org/download/ Centos国内下载源:http://man.linuxde.net/download/CentOS

centos7最小安装都会安装什么 centos7.6最小化安装_centos_18


centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_19

centos7最小安装都会安装什么 centos7.6最小化安装_linux_20

centos7最小安装都会安装什么 centos7.6最小化安装_运维_21

centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_22

centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_23


centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_24


centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_25

centos7最小安装都会安装什么 centos7.6最小化安装_centos_26

centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_27

2.配置网络

2.1.设置

centos7最小安装都会安装什么 centos7.6最小化安装_运维_28


centos7最小安装都会安装什么 centos7.6最小化安装_centos_29


centos7最小安装都会安装什么 centos7.6最小化安装_运维_30

2.2.配置网络

2.2.1.配置网络时,要不断使用的命令

ip addr
systemctl restart/start/stop NetworkManager
systemctl restart/start/stop network

2.2.2.配置静态ip

默认文件路径如下:

vi /etc/sysconfig/network-scripts/ifcfg-ens33

修改如下:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
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=ens33
UUID=95d78d7c-728b-46e7-ac2c-60684fcd0f19
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.228.128
NETMASK=255.255.255.0
GATEWAY=192.168.228.2
DNS1=192.168.228.2
DNS2=8.8.8.8

其中最重要的是:

BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.228.128
NETMASK=255.255.255.0
GATEWAY=192.168.228.2
DNS1=192.168.228.2
DNS2=8.8.8.8

其中IPADDR为指定固定IP,BOOTPROTO值为static则表示静态ip,ip不会在下次重启之后发生变化。其他两个NETMASK和GATEWAY为子网掩码和默认网关。

2.2.3.配置DNS域名服务器

在配置了IPADDR、NETMASK、GATEWAY之后,重启了NetworkManager、network服务,可以ping通百度网站对应的数字ip地址

systemctl restart/start/stop NetworkManager
systemctl restart/start/stop network

并修改配置文件**/etc/resolv.conf**,修改内容如下:

nameserver 192.168.228.2
nameserver 8.8.8.8

2.2.4 修改SELINUX

vim /etc/selinux/config 



# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=permissive
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

重启环境:

systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl restart network
ip addr

2.2.5.ping 网络是否成功

centos7最小安装都会安装什么 centos7.6最小化安装_linux_31

3.安装vim编辑器

3.1.查看哪个组件包含了ifconfig命令

yum provides ifconfig

yum whatprovides ifconfig

centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_32

ifconfig命令依赖于net-tools的,安装

yum install -y net-tools

3.2.安装vim编辑器

yum install -y vim-enhanced

3.3.安装wget

yum install -y wget

4.配置国内yum源和epel源

4.1.配置yum源

4.1.1.新建文件夹,保存系统中原来的repo文件

cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/

centos7最小安装都会安装什么 centos7.6最小化安装_linux_33

4.1.2.下载阿里云和网易对应系统的repo文件

wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

centos7最小安装都会安装什么 centos7.6最小化安装_centos7最小安装都会安装什么_34

4.1.3.清楚系统yum缓存,并生成新的yum缓存

yum clean all
yum makecache

centos7最小安装都会安装什么 centos7.6最小化安装_linux_35

4.2.配置epel源

4.2.1.安装epel-release,安装成功后,会自动生成epel.repo和epel-testing.repo两个文件

yum list | grep epel-release
yum install -y epel-release

centos7最小安装都会安装什么 centos7.6最小化安装_IPV6_36

4.2.2.再次清除系统yum缓存,并重新生成yum缓存

yum clean all
yum makecache

4.2.3.查看系统可用的yum源和所有的yum源

yum repolist enabled

如果报Centos7 yum报错-One of the configured repositories failed (Unknown)错误
解决方案:

yum remove epel-release
yum update
yum install epel-release