依赖安装
1 | apt install pkg-config |
安装构建工具
1 | 需要更新python>=3.7 |
编译安装util-linux-2.39
1 | apt-get install libtool-bin |
编译安装libslirp
1 | 手动编译,直接`apt-get install libslirp-dev`安装没有.a静态文件 |
静态编译qemu
1 | wget https://download.qemu.org/qemu-8.1.0.tar.xz |
打包取出
1 | mkdir qemu-bins |
qemu使用
1 |
|
qemu参数
- vhost_user:
1
2
3
4
5
6
7
8./qemu-system-x86_64 -L /usr/share/kvm/ -m 2048 -enable-kvm centos.img \
-net nic -net user,hostfwd=::22345-:22 \
-vnc 0.0.0.0:8100,websocket=14600,to=16000 \
-chardev socket,id=chr0,path=/run/vhost_user_1234567890_net_1,reconnect=1 \
-netdev type=vhost-user,id=net0,chardev=chr0,vhostforce=on,queues=4 \
-device virtio-net-pci,host_tso4=on,host_tso6=on,romfile=,mac=FE:FC:FE:3A:11:22,netdev=net0,bus=pci.0,addr=0x12,id=net0,vectors=9 \
-object memory-backend-file,id=mem-node0,size=2048M,mem-path=/qemu_vhost_user,share=on \
-numa node,nodeid=0,memdev=mem-node0,cpus=0
- vhost_user:
- vhost_net:
1
2
3
4./qemu-system-x86_64 -L /usr/share/kvm/ -m 2048 -enable-kvm alpine.img -nographic \
-net nic -net user,hostfwd=::22345-:22 -vnc 0.0.0.0:8100,websocket=14600,to=16000 \
-netdev type=tap,id=net0,ifname=virt0,vhost=on,script=no,downscript=no,queues=2 \
-device virtio-net-pci,host_tso4=on,host_tso6=on,romfile=,mac=FE:FC:FE:3A:11:22,netdev=net0,bus=pci.0,addr=0x12,id=net0
- vhost_net:
- 在qemu的启动参数里加入参数, 在外部环境中使用 telnet localhost 4444 登录
1
-chardev socket,id=mon0,host=localhost,port=4444,server,nowait -mon chardev=mon0,mode=readline
- 在qemu的启动参数里加入参数, 在外部环境中使用 telnet localhost 4444 登录