Detailed Explanation of Practical Application of centos7 esxi6.7 Template

  • 2021-07-22 11:56:31
  • OfStack

1. Create an centos 7.6 system and optimize it

1. Turn off NetworkManager


systemctl disable NetworkManager
systemctl stop NetworkManager

2. Turn off selinux


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

3. Turn off firewalld


systemctl stop firewalld
systemctl disable firewalld

4. Install daily software


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

5. Modify the network configuration (to/etc/sysconfig/network-scripts/ifcfg-eth0) and multiple network card configuration


### Modify the file name and configuration of the network card 
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
### Modify grub Configure 
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. Modify the maximum number of files for all users


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

7. Modify the maximum number of processes for ordinary users


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

2. Export the centos7 ova template and modify the template file

1. Export with ovftool tool (because the browser does not support large file export)

1) Download the ovftool tool
https://www.vmware.com/support/developer/ovf/

2) Install the ovftool tool
Double-click VMware-ovftool-4. 3.0-7948156-win.x86_64. msi to complete the next step by default

3) Export the ova template with the ovftool command


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 For the host machine ip
Fingerprint will be added to the known host file
Write 'yes' or 'no'
yes # Input yes
Enter login information for source vi://10.10.90.239/
Username: root # User name 
Password: ********* # 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

2. Modify files in ova template
1) Change the suffix centos-template. ova to centos-template. rar
2) Decompress centos-template. rar
3) Delete centos-template. mf and centos-template. nvram
4) Modify the centos-template. ovf file to delete the two lines with nvram characters and save the file

3. Import the ovf template

Open the browser- > Go to the vmware esxi 6.7 Host page-- > Virtual machine-- > Create/Register Virtual Machines-- > Deploy virtual machines from OVF or OVA files-- > test-centos-template (Enter a name for this virtual machine.) -- > Click to select a file or drag and drop (drag and drop the centos-template. ovf and centos-template-disk1.vmdk files into this area)-- > The next page by default- > Finish

Note: Do not refresh the browser when deploying this virtual machine.


Related articles: