搭建centOS6模板机
1设置网卡配置文件
命令:vi /etc/sysconfig/network-scripts/ifcfg-eth0
配置网络配置文件
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
2创建光盘挂载点
mkdir -p /media/cdrom
3设置开机自动挂载
echo "mount /dev/sr0 /media/cdrom" >> /etc/rc.d/rc.local(centos7是没有执行权的,需要手动增加)
先手动挂载一下
mount /dev/sr0 /media/cdrom
4配置yum光盘源
命令:vi /etc/yum.repos.d/CentOS-Media.repo
5下载常用的支持包
yum -y install gcc gcc-c++ make automake conf autoconf lrzsz wget openssh-client* readline-devel
6关防火墙和selinux
service iptables stop 关闭防火墙
chkconfig iptables off 永久关闭防火墙
7清理网卡
/etc/udev/rules.d/70-persistent-net.rules
8关机
init 0
搭建centos7模板机
配置网卡文件
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=ens32
DEVICE=ens32
ONBOOT=yes
开启网卡
[root@localhost ~]# ifup ens32
创建挂载点
[root@localhost ~]# mkdir /media/cdrom
设置开机自动挂载
[root@localhost ~]# vi /etc/rc.d/rc.local
mount /dev/sr0 /media/cdrom
添加执行命令
[root@localhost ~]# chmod a+x /etc/rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local
配置yum源
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mount /dev/sr0 /media/cdrom/
mount: /dev/sr0 写保护,将以只读方式挂载
下载常用支持包
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
[root@localhost yum.repos.d]# yum -y install lrzsz gcc gcc-c++ openssh-client* net-tools wget
关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl disable NetworkManager
[root@localhost ~]# systemctl stop NetworkManager
关闭selinux
[root@localhost ~]# setenforce 0
[root@localhost ~]# vi /etc/selinux/config
[root@localhost ~]# cat /etc/selinux/config
SELINUX=disabled
清理网卡
[root@localhost ~]# >/etc/udev/rules.d/70-persistent-net.rules
关机
[root@localhost ~]# init 0
设置为固定IP
修改网卡
vi /etc/sysconfig/network-scripts/ifcfg-ens32
网段相当于255.255.255.0
重启网络服务
systemctl restart network
查看网卡
ip a
💕💕💕 好啦,这就是今天要分享的全部内容了✨ ✨ ✨
🍻🍻🍻如果你喜欢的话,就不要吝惜你的一键三连了~