35

centos7 esxi6.7模板实际应用-三十而立

 4 years ago
source link: https://blog.51cto.com/3607453/2463861
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

centos7 esxi6.7模板实际应用

一、创建centos7.6系统并优化系统

1.关闭NetworkManager

systemctl disable NetworkManager
systemctl stop NetworkManager

2.关闭selinux

setenforce 0
sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config

3.关闭firewalld

systemctl stop firewalld
systemctl disable firewalld

4.安装日常需要用的软件

yum install vim nc wget lrzsz telnet net-tools epel-release bind-utils tree cifs-utils ntpdate -y

5.修改网络配置(改为/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

6.修改所有用户的最大文件数

#cat >> /etc/security/limits.conf <<eof
*       soft    nofile  65535
eof
#cat >> /etc/security/limits.conf <<eof
*       hard    nofile  65535
eof

7.修改普通用户的最大进程数

#sed -i "/*/s#*          soft    nproc.*#*          soft    nproc     65535#g" /etc/security/limits.d/20-nproc.conf

二、导出centos7 ova模板并修改模板文件

1.用ovftool工具导出(由于浏览器不支持大文件导出)

1)下载ovftool工具
https://www.vmware.com/support/developer/ovf/
2)安装ovftool工具
双击VMware-ovftool-4.3.0-7948156-win.x86_64.msi,默认下一步,完成即可
3)用ovftool命令导出ova模板
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://[email protected]: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

2.修改ova模板里文件

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两个文件拖放到此区域) --> 默认下一页 -->完成

注意:请勿在部署此虚拟机时刷新浏览器。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK