Configure the network environment for the VM so that it can connect to the Internet and installation packages can be uploaded to it.
Run the vi /etc/apt/sources.list command and add the following content to the file:
deb http://mirrors.ustc.edu.cn/debian jessie main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian jessie main contrib non-free deb http://mirrors.ustc.edu.cn/debian jessie-proposed-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian jessie-proposed-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian jessie-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian jessie-updates main contrib non-free
Enter :wq! to save the file and run the apt update command.
Run the apt-get install dkms command.
Run the apt-get install linux--headers-3.16.0-4-common command.
Run the apt-get install linux-headers-3.16.0-4-amd64 command.
Run the vi /etc/network/interfaces command. If there is a configuration of eth0, delete the last two rows of configuration items.
... # The loopback network interface auto lo iface lo inet loopback # The primary network interface # The following are the configuration items that need to be deleted: allow-hotplug eth0 iface eth0 inet dhcp
Enter :wq! to save the file.
Configure an available IP address for the VM so that it can communicate with the host.
ifconfig -a
ifconfig
Information similar to the following is displayed (xxx indicates the IP address automatically obtained and XX indicates the MAC address):
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX inet addr:xxx.xxx.xxx.xxx Bcast:xxx.xxx.x.xxx Mask:xxx.xxx.xxx.xxx
ifup NIC name
An example is as follows:
ifup eth0
Information similar to the following is displayed:
Determining IP information for eth0... done
You can also run the following command:
ifconfig eth0 up
No information is displayed.
vi /etc/systemd/system.conf
Remove the number sign (#) before the DefaultTimeoutStartSec and DefaultTimeoutStopSec and change the time to 300s. The modified configuration file is as follows:
#TimeSlackNSec= #DefaultTimerAccuracySec=1min #DefaultStandardOutput=journal #DefaultStandardError=inherit DefaultTimeoutStartSec=300s DefaultTimeoutStopSec=300s #DefaultRestartSec=100ms #DefaultStartLimitInterval=10s #DefaultStartLimitBurst=5 #DefaultEnvironment= #DefaultCPUAccounting=no #DefaultBlockIOAccounting=no
systemctl disable firewalld.service
systemctl stop firewalld.service
Run the systemctl status firewalld.service command to query the status of the service.
chkconfig iptables off
service iptables stop
Run the service iptables status command to query the status of the service.
[root@localhost ~]# service iptables status iptables: Firewall is not running.
systemctl disable SuSEfirewall2.service
systemctl stop SuSEfirewall2.service
Query the status of the service: service SuSEfirewall2 status
rcSuSEfirewall2 stop
Run the yast command and perform the following operations:
Choose Security and Users > Firewall. Check whether Disable Firewall Automatic Starting is displayed. If yes, click Cancel and then Quit. If no, click Next, Finish, and then Quit.
The deb package is as follows (the version number is only for reference):
ufw_0.35-0ubuntu2_all.deb
Run the following command to disable the firewall:
ufw disable
linux-locc:/home/fsp/Desktop # rpm -qa | grep wick wicked-service-0.6.28-1.1.x86_64 libwicked-0-6-0.6.28-1.1.x86_64 libwicked-0-6-0.6.40-28.6.1.x86_64 wicked-0.6.28-1.1.x86_64 wicked-service-0.6.40-28.6.1.x86_64 wicked-0.6.40-28.6.1.x86_64
linux-locc:/home/fsp/Desktop # rpm -e wicked-service-0.6.28-1.1.x86_64 linux-locc:/home/fsp/Desktop # rpm -e libwicked-0-6-0.6.28-1.1.x86_64 linux-locc:/home/fsp/Desktop # rpm -e wicked-0.6.28-1.1.x86_64
systemctl disable NetworkManager.service
systemctl stop NetworkManager.service
Query the status of the service: service NetworkManager.service status
[root@localhost ~]# service NetworkManager.service status edirecting to /bin/systemctl status NetworkManager.service NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service disabled; vendor preset: enabled) Active: inactive (dead) since Mon 2017-11-13 19:06:18 CST; 1 min 17s ago
For EulerOS 2.2 and EulerOS 2.3, disable the following services if they are running:
Systemctl disable euleros-security
Systemctl disable NetworkManager-wait-online
If you choose to install the desktop when creating a Red Hat 6.7, Red Hat 6.8, Red Hat 6.9, CentOS 6.8, CentOS 6.9, Oracle Linux 6.8 or Oracle Linux 6.9 VM, you need to run the following command to disable the network service. Otherwise, do not run these commands.
service NetworkManager stop
chkconfig NetworkManager off
systemctl disable wicked
systemctl stop wicked
When installing the VM, you need to create a local user. After the installation is complete, you can delete the local user by running the following command:
userdel -rf xxx
xxx is the name of the local user. The user is deleted successfully if the /home directory does not contain the folder of the user.
If the user is not deleted, restart the VM, log in to it as user root, and run the command again.
This operation is required for SUSE Linux. For other OSs, skip this step.
Press i to enter editing mode and set the value of this configuration item to yes to enable DHCP to obtain the default gateway during start.
Press Esc to exit editing mode.
If the configuration file does not contain the DHCLIENT_PRIMARY_DEVICE configuration item, ignore it.
Press i to enter editing mode and set the value of this configuration item to no to prevent DHCP from modifying the hostname.
Press Esc to exit the editing mode.
Press i to enter editing mode and set the value of this configuration item to no to enable DHCP to obtain IP addresses continuously.
Press Esc to exit the editing mode.
Press i to enter editing mode and set the value of this configuration item to managed to enable DHCP to obtain IP addresses continuously.
Press Esc to exit the editing mode.
GRUB_DEFAULT=0 #GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=2 GRUB_DISTRIBUTOR='lsb_release -i -s 2> /dev/null || echo Debian' GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0" GRUB_RECORDFAIL_TIMEOUT=10
grub-mkconfig -o /boot/grub/grub.cfg
This method is recommended. You can query how to use it by running the scp -help command. An example command is as follows (the following file name is an example):
scp fsp@xxx.xxx.xxx.xxx:/home/fsp/network-config-1.0-1.x86_64.rpm /home
In the command, fsp is the username, xxx.xxx.xxx.xxx is the host IP address, home/fsp is a customized directory, network-config-1.0-1.x86_64.rpm is the name of the file uploaded to the host, and /home is the VM directory.
Step 1: Create an ISO file on the host.
Step 2: Use virt-manager to mount the ISO image.