centos7.2模板机制作
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7.2模板机制作相关的知识,希望对你有一定的参考价值。
#关闭防火墙和selinux
systemctl disable firewalld
systemctl stop firewalld
sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/sysconfig/selinux
#修改主机名为模板机
sed -i ‘s#localhost.localdomain#mobanji#g‘ /etc/hostname
logout
配置网卡1:
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME=eno16777736
UUID=090f01e1-6bcc-4434-b85b-4c0eed7a29be
DEVICE=eno16777736
ONBOOT=yes
IPADDR=10.0.0.100
NETMASK=255.255.255.0
GATEWAY=10.0.0.2
DNS1=10.0.0.2
NDS2=223.5.5.5
[[email protected] ~]# ip a|grep eno
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
inet 10.0.0.100/24 brd 10.0.0.255 scope global eno16777736
3: eno33554984: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
新增一个网卡,照猫画虎,配置网卡2:
[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno33554984
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME=eno33554984
DEVICE=eno33554984
ONBOOT=yes
IPADDR=172.16.1.100
#安装常用工具包
yum install vim net-tools wget -y
CentOS
1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、之后运行yum makecache生成缓存
epel
##epel 配置方法
###1、备份(如有配置其他epel源,默认是没有的)
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
2、下载新repo 到/etc/yum.repos.d/
epel(RHEL 7)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
以上是关于centos7.2模板机制作的主要内容,如果未能解决你的问题,请参考以下文章