因为平时经常需要使用的是centos 7最小化安装,所以这里记录下在安装之后的初始配置
1、配置网络
修改配置文件:vi /etc/sysconfig/network-scrips/ifcfg-ens33
(需要查看自己的网关进行配置)
BOOTPROTO=none
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.3
PREFIX=24
GATEWAY=192.168.1.2
修改dns解析文件:
vi /etc/resolv.conf
nameserver 8.8.8.8
重启网络:service network restart
安装网络工具:yum insatll net-tools
然后通过:ifconfig 查看网络配置成功
2、配置源
yum install wget vim -y
配置网易源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
配置阿里云:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
生成缓存:
yum makecache
3、安装yum的优先级插件
yum install yum-plugin-priorities -y
4、关闭 SELinux 和 防火墙
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
setenforce 0
查看SELinux状态:sestatus
关闭防火墙:
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
firewall-cmd --state
5、epel源
yum install epel-release
查看repo情况:
yum repolist
6、同步时间
yum install ntp
systemctl enable ntpd.service
systemctl start ntpd.service
手工同步时间
ntpdate 0.centos.pool.ntp.org
7、修改主机名 域名解析
8、重启主机 reboot