本文主要是介绍使用cbsd指令快速创建bhyve Ubuntu虚拟机实践,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
首先查看当前的模板
ls -la /usr/jails/etc/defaults/
可以看到Ubuntu的20 22 23 24都有模板
ls /usr/jails/etc/defaults/vm-linux-ubuntuserver-amd64-2*
/usr/jails/etc/defaults/vm-linux-ubuntuserver-amd64-20.conf
/usr/jails/etc/defaults/vm-linux-ubuntuserver-amd64-22.conf
/usr/jails/etc/defaults/vm-linux-ubuntuserver-amd64-23.conf
/usr/jails/etc/defaults/vm-linux-ubuntuserver-amd64-24.conf
看下所有的cloud云模板
ls /usr/jails/etc/defaults/vm-linux-cloud-*
/usr/jails/etc/defaults/vm-linux-cloud-Alma-9-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Arch-x86-2022.conf
/usr/jails/etc/defaults/vm-linux-cloud-CentOS-7-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-CentOS-stream-8-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-CentOS-stream-9-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Debian-x86-10.conf
/usr/jails/etc/defaults/vm-linux-cloud-Debian-x86-11.conf
/usr/jails/etc/defaults/vm-linux-cloud-Debian-x86-12.conf
/usr/jails/etc/defaults/vm-linux-cloud-Debian-x86-9.conf
/usr/jails/etc/defaults/vm-linux-cloud-Devuan-x86-5.conf
/usr/jails/etc/defaults/vm-linux-cloud-Euro-9-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Fedora-37-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Fedora-38-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Fedora-39-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Fedora-40-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-FreePBX-16-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-HomeAssistantOS-2024.conf
/usr/jails/etc/defaults/vm-linux-cloud-Kali-2022-amd64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Oracle-7-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Oracle-8-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Oracle-9-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Parrot-5-amd64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Rocky-8-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-Rocky-9-x86_64.conf
/usr/jails/etc/defaults/vm-linux-cloud-firestarter-debian-11.conf
/usr/jails/etc/defaults/vm-linux-cloud-kubernetes-27.conf
/usr/jails/etc/defaults/vm-linux-cloud-ubuntudesktop-amd64-22.04.conf
/usr/jails/etc/defaults/vm-linux-cloud-ubuntuserver-amd64-20.conf
/usr/jails/etc/defaults/vm-linux-cloud-ubuntuserver-amd64-22.04.conf
/usr/jails/etc/defaults/vm-linux-cloud-ubuntuserver-amd64-23.04.conf
/usr/jails/etc/defaults/vm-linux-cloud-ubuntuserver-amd64-24.04.conf
对于模板,可以忽略vm-linux的前缀,因此在命令里vm-linux-cloud-CentOS-stream-9-x86_64.conf写做cloud-CentOS-stream-9-x86_64 ,那么vm-linux-cloud-ubuntuserver-amd64-22.04.conf 写作cloud-ubuntuserver-amd64-22.04
云和普通模板两者的不同点在于:vm-linux-ubuntu这个需要自己安装系统,而vm-linux-cloud 云模板则使用了已有的云系统。vm-linux-cloud云里面Centos的云系统很好用,网络也是好的,但是么有相关的ping等命令,而Ubuntu的云系统,启动后网络不通,也没有ping、netstat等命令,调试起来非常麻烦。
使用云Centos模板:
执行命令:
cbsd bcreate jname=cent1 vm_ram=1g vm_cpus=1 imgsize=10g vm_os_type="linux" vm_os_profile="cloud-CentOS-stream-9-x86_64" ci_ip4_addr="10.0.0.100" ip4_gw="10.0.0.1" interface="cbsdvale_vale1" astart=0 runasap=1
使用云Ubuntu 22版本的模板
执行命令
cbsd bcreate jname=ub1 vm_ram=1g vm_cpus=1 imgsize=10g vm_os_type="linux" vm_os_profile="cloud-ubuntuserver-amd64-22.04" ci_ip4_addr="10.0.0.100" ip4_gw="10.0.0.1" interface="cbsdvale_vale1" astart=0 runasap=1
因为对centos不熟,所以后面以ubuntu为例说明。
创建完虚拟机后,启动虚拟机,如
cbsd bstart ub1
然后登录虚拟机
cbsd blogin ub1
这时候就进入Ubuntu 22虚拟子系统了
cbsd blogin ub1
blogin.conf: /usr/bin/ssh -oStrictHostKeyChecking=no -oConnectTimeout=15 -oServerAliveInterval=10 -i /usr/jails/.ssh/id_rsa ubuntu@10.0.0.100
Custom login command: /usr/bin/ssh -oStrictHostKeyChecking=no -oConnectTimeout=15 -oServerAliveInterval=10 -i /usr/jails/.ssh/id_rsa ubuntu@10.0.0.100
Last login: Thu Aug 22 21:09:54 2024 from 10.0.0.1------------------: System Data :-------------------------------
Hostname: ub1 (10.0.0.100 )
Kernel: 5.15.0-67-generic (Ubuntu 22.04.2 LTS)
Uptime: 21:30:43 up 23 min, 1 user, load average: 0.08, 0.05, 0.05
CPU: Intel(R) Celeron(R) CPU @ 1.99GHz (1 cores)
Memory(Mb): 968 Mb total / 670 Mb free
Env info:
------------------------: Logged as: [ubuntu] ------------------------------This image was created for ClonOS/CBSD/MyBee Project.Please Support Us: https://www.patreon.com/clonosubuntu@ub1:~$
这篇关于使用cbsd指令快速创建bhyve Ubuntu虚拟机实践的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!