KVM安装脚本
#!/bin/bash
cat /etc/redhat-release | grep "CentOS"
if [ $? -ne 0 ];then
echo -e "\033[33mSorry your machine not install docker-ce!\033[0m" && exit -1
fi
systemctl stop firewalld
systemctl disable firewalld
sed -ri 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
cat /proc/cpuinfo | grep vmx
if [ $? -ne 0 ];then
echo -e "\033[33mSorry Your CPU not support KVM\033[0m" && exit -1
fi
lsmod | grep kvm
if [ $? -ne 0 ];then
modprobe kvm && modprobe kvm-intel
lsmod | grep kvm
if [ $? -ne 0 ];then
echo -e "\033[33mSorry Your KVM model not loading!\033[0m" && exit -1
fi
fi
yum install -y bridge-utils
sleep 1
systemctl restart network
yum install -y libvirt virt-* qemu-*
sleep 3
systemctl start libvirtd
systemctl enable libvirtd
echo -e "\033[34mKVM 配置完成,请手动配置KVM网桥模式\033[0m"
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步