Centos 7.X 初始化配置

来源:互联网 发布:windows下载单机游戏 编辑:程序博客网 时间:2024/06/04 20:06

因为平时经常需要使用的是centos 7最小化安装,所以这里记录下在安装之后的初始配置


1、配置网络

修改配置文件:vi /etc/sysconfig/network-scrips/ifcfg-ens33

(需要查看自己的网关进行配置)

BOOTPROTO=noneDEVICE=ens33ONBOOT=yesIPADDR=192.168.1.3PREFIX=24GATEWAY=192.168.1.2

修改dns解析文件:

vi /etc/resolv.confnameserver 8.8.8.8

安装网络工具:yum insatll net-tools

重启网络:service network restart

然后通过: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/selinuxsetenforce 0

查看SELinux状态:sestatus

关闭防火墙:

systemctl status firewalldsystemctl stop firewalldsystemctl disable firewalldsystemctl status firewalldfirewall-cmd --state

5、epel源

yum install epel-release

查看repo情况:

yum repolist

6、同步时间

yum install ntpsystemctl enable ntpd.servicesystemctl start ntpd.service

手工同步时间

ntpdate 0.centos.pool.ntp.org

7、修改主机名 域名解析

8、重启主机 reboot

原创粉丝点击