centos7 esxi6.7模板使用
一、创建centos7.6系统并优化系统
systemctl disable NetworkManager
systemctl stop NetworkManager
setenforce 0
sed -i “s#SELINUX=enforcing#SELINUX=disabled#g” /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
yum install vim nc wget lrzsz telnet net-tools epel-release bind-utils tree cifs-utils ntpdate -y
cat >> /etc/hosts <<eof
10.10.90.159 master.salt.51hrbz.com
10.10.90.159 time.51hrbz.com
eof
6.安装salt-minion并配置,请不要开启salt-minion服务及开机关闭服务
###centos7
yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest.el7.noarch.rpm
yum install -y salt-minion
###centos6
yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest.el6.noarch.rpm
yum install -y salt-minion
#vim /etc/minion
master: master.salt.51hrbz.com
groupadd -g 1000 ycj
useradd -u 1000 -g ycj ycj
passwd ycj
ycj密码:123456
8.修改网络配置(改为/etc/sysconfig/network-scripts/ifcfg-eth0)及多网卡配置
###修改网卡文件名和配置
cd /etc/sysconfig/network-scripts
cp ifcfg-ens192 /tmp/ifcfg-ens192_bak
sed -i "s#NAME=.*#NAME='eth0'#g" ifcfg-ens192
sed -i "s#DEVICE=.*#DEVICE='eth0'#g" ifcfg-ens192
mv ifcfg-ens192 ifcfg-eth0
###修改grub配置
sed -i 's#GRUB_CMDLINE_LINUX=.*#GRUB_CMDLINE_LINUX=\"rhgb quiet net.ifnames=0 biosdevname=0\"#g' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
#cat >> /etc/security/limits.conf <<eof
* soft nofile 65535
eof
#cat >> /etc/security/limits.conf <<eof
* hard nofile 65535
eof
#sed -i "/*/s#* soft nproc.*#* soft nproc 65535#g" /etc/security/limits.d/20-nproc.conf
二、导出centos7 ova模板并修改模板文件
https://www.vmware.com/support/developer/ovf/
双击VMware-ovftool-4.3.0-7948156-win.x86_64.msi,下一步,完成即可
PS >cd C:\Program Files\VMware\VMware OVF Tool
PS >.\ovftool.exe -dm=thin "vi://10.10.90.239/centos-template" d:\centos-template\centos-template.ova #10.10.90.239为宿主机ip
Fingerprint will be added to the known host file
Write 'yes' or 'no'
yes #输入yes
Enter login information for source vi://10.10.90.239/
Username: root #用户名
Password: ********* #密码
Opening VI source: vi://root@10.10.90.239:443/centos-template
Opening OVA target: d:\centos-template\centos-template.ova
Writing OVA package: d:\centos-template\centos-template.ova
Transfer Completed
Completed successfully
1)将centos-template.ova后缀名改为centos-template.rar
2)解压缩centos-template.rar
3)删除centos-template.mf和centos-template.nvram
4)修改centos-template.ovf文件,将带有nvram字符的两行删除掉,保存文件
三.导入ovf模板
打开浏览器-->进入vmware esxi6.7 宿主机页面 --> 虚拟机 --> 创建/注册虚拟机 --> 从OVF或OVA文件部署虚拟机 --> test-centos-template(为该虚拟机输入名称。)--> 单击以选择文件或拖放(将centos-template.ovf和centos-template-disk1.vmdk两个文件拖放到此区域) --> 默认下一页 -->完成
注意:请勿在部署此虚拟机时刷新浏览器。