1. Clone template machine
Right-click on the virtual machine you want to clone and continue to the next step.
Reference: https://www.jianshu.com/p/ebba00a0e503
2. Modify the configuration
2.1 Modify the host name
- Temporarily modify the host name
sudo hostnamectl set-hostname 主机名
- Modify the configuration file:
- /etc/hosts
sudo vi /etc/hosts
- /etc/sysconfig/network
sudo vi /etc/sysconfig/network
3. The reboot command restarts the server
4. Check the host name:
hostnamectl 或 hostname
2.2 Modify ip
vi /etc/sysconfig/network-scripts/ifcfg-eth32
Note: ifcfg-eth0 is the name of the network card, pay attention to what your network card name is.
2.3 Modify UUID
The UUID after cloning a virtual machine is generally the same and needs to be modified.
- Generate new uuid
uuidgen
2. Write the generated uuid to the network card configuration file
vi /etc/sysconfig/network-scripts/ifcfg-eth32
2.4 Delete the /etc/udev/rules.d/70-persistent-net.rules file
mv –f /etc/udev/rules.d/70-persistent-net.rules rules.back
2.5 Modify the MAC address
Modify the configuration file and delete the HWADDR content.
cat /sys/class/net/eth0/address #查看eth0的MAC地址
2.6 Configure DNS Resolution
sudo vi /etc/resolv.conf
Add to:
nameserver 8.8.8.8
Restart the gateway:
sudo service network restart