Centos虚拟机克隆模板

时间:2023-03-09 17:21:05
Centos虚拟机克隆模板

Centos6模板

IPTABLES/SELINUX

# iptalbes -F

# service iptables save

# /etc/init.d/iptables stop

# chkconfig iptables off

# setenforce 0

NETWORK

保证网卡都是eth0 :

#/etc/init.d/NetworkManager stop

#chkconfig NetworkManager off

# >/etc/udev/rules.d/70-persistent-net.rules

#vim /etc/sysconfig/network-scripts/ifcfg-eth0 (删除mac,uuid)

#vim /etc/sysconfig/network-scripts/ifcfg-eth1 (删除mac,uuid)

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

BOOTPROTO=dhcp

#/etc/init.d/network restart

配置YUM

时间同步

#yum install chrony -y

#systemctl start chronyd

#systemctl enable chronyd

#vim /etc/chrony.conf

server 192.168.2.148 iburst

allow 192.168/16

# chronyc sources

SSH连接

优化SSH连接速度

注:重启生效

# vim /etc/ssh/sshd_config

UseDNS no

GSSAPIAuthentication no

密钥认证

#ssh-keygen -t rsa

#ssh-copy-id -i 192.168.10.6

 

Centos7模板

# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

BOOTPROTO=dhcp

#mv /etc/sysconfig/network-scripts/ifcfg-enp0s3 /etc/sysconfig/network-scripts/ifcfg-eth0

#tail -3 /etc/default/grub #红色是添加内容

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet
net.ifnames=0 biosdevname=0"

GRUB_DISABLE_RECOVERY="true

#grub2-mkconfig -o /boot/grub2/grub.cfg

#reboot

当克隆机出现网络问题时,处理方式如下:

  • 编辑相关网卡配置文件,删除其中的"身份证"-->UUID
  • # rm -rf /etc/udev/rules.d/70-persistent-ipoib.rules