Install KVM Hypervisor on arrch64 Linux Server
Install KVM Hypervisor on arrch64 Linux Server
参考链接:
https://wiki.ubuntu.com/ARM64/QEMU
https://wiki.ubuntu.com/kvm
https://help.ubuntu.com/community/KVM/Installation
https://help.ubuntu.com/community/NetworkManager
# 更新系统软件包 sudo apt-get update sudo apt-get install aptitude
# 查找命令所属包名
sudo aptitude install apt-file
sudo apt-file update
sudo apt-file search ifconfig
sudo apt-file list net-tools # 安装软件包 sudo aptitude install openssh-server sudo aptitude install vim sudo aptitude install tree sudo aptitude install bash bash-completion
sudo aptitude install net-tools sudo aptitude install htop sudo aptitude install xterm
sudo aptitude install tmux
sudo aptitude install curl
sudo aptitude install wget
sudo aptitude install lynx
sudo aptitude install pciutils
sudo aptitude install unzip
sudo aptitude install network-manager
sudo aptitude install ethtool
# 启动 network-manager 服务
sudo service network-manager restart
sudo service network-manager status
# 通过查看开机信息获取网卡信息
sudo dmesg | grep -i "eth"
sudo dmesg | grep udev
sudo lspci | grep -i "eth"
sudo ethtool -i eth0 | grep "bus"
sudo ethtool eth0 | grep "Link"
sudo ethtool -p eth0 10 # 网卡持续LED闪烁一段时间
# 查看网卡配置信息
ls /etc/NetworkManager/system-connections/ # wifi配置文件
ls /etc/udev/rules.d/70-persistent-net.rules # 网卡配置文件
nmcli device status # [查看网卡状态]
nmcli con status # 查看所有连接的状态
nmcli con list id Cloud_SIgn_C1F0 # 查看wifi配置文件详细信息
sudo nmcli dev wifi connect ZDEC password zdec1234 # [连接wifi]
nmcli dev wifi list iface wlan0 # 查看wlan1网卡附近的wifi
nmcli con delete id ZDEC # 删除wifi配置文件。断开wifi
nmcli con up iface wlan0 id Cloud_SIgn_C1F0 # [发出wifi]
nmcli con up id Cloud_SIgn_C1F0 # 发出wifi
nmcli nm wifi off/on # 关闭/打开 所有无线网卡
nmcli dev disconnect iface wlan0 && nmcli nm wifi off && nmcli nm wifi on && sleep 3 && echo 1111 | sudo -S nmcli dev wifi connect ZDEC password zdec1234 # 桥接wifi
# 安装 QEMU/libvirt 软件包 sudo aptitude install qemu-system-arm qemu-efi qemu-efi-aarch64 qemu-efi-arm sudo aptitude install libvirt-clients libvirt-daemon-system sudo aptitude install virt-manager
# 添加用户至 kvm 用户组
sudo adduser deepin kvm
sudo adduser root kvm
# 添加用户至 libvirt 用户组 sudo adduser deepin libvirt sudo adduser root libvirt
# 添加用户至 libvirt-qemu 用户组
sudo adduser deepin libvirt-qemu
sudo adduser root libvirt-qemu # 命令行方式查看QEMU虚拟机列表 virsh -c qemu:///system list
# 生成qemu磁盘镜像文件
qemu-img convert -f vmdk -O qcow2 vans-esx-disk1.vmdk vans-kvm.qcow2
# 复制镜像文件至指定目录
sudo cp vans-kvm.qcow2 /var/lib/libvirt/images/vans-kvm.qcow2
# 以图形化的方式管理QEMU虚拟机 virt-manager # 在ARM64服务器上使用QEMU模拟x86_64虚拟机运行时的参数
# 注意: 该 vans-x86_64 虚拟机,仅支持的模拟网卡类型为 E1000 或 virtio /usr/bin/qemu-system-x86_64 -name guest=vans-x86_64,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1-vans-x86_64/master-key.aes -machine pc-i440fx-2.10,accel=tcg,usb=off,dump-guest-core=off -m 2048 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 07c80fd8-a2db-4b7b-8450-18a023a2b8c8 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-1-vans-x86_64/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -no-kvm-pit-reinjection -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -drive file=/var/lib/libvirt/images/vans-kvm.qcow2,format=qcow2,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -netdev tap,fd=25,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:3d:6f:97,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 127.0.0.1:0 -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on
# 连接虚拟机的串口
sudo virsh console vans-x86_64
# 查看虚拟机启动列表
sudo virsh list --all
# 查看宿主机网卡统计数据
netstat -i
============== End