RHEL7.4 安装VirtualBox6.1
RHEL7.4 安装VirtualBox6.1虚拟CentOS7.7
系统配置
setenforce 0 sed 's/SELINUX=.*/SELINUX=permissive/g' -i /etc/selinux/config systemctl stop firewalld.service systemctl disable firewalld.service yum list | grep VirtualBox yum groupinstall "Server with GUI" yum install xorg-x11-apps xclock yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel SDL -y
下载VirtualBox
cd /root wget https://download.virtualbox.org/virtualbox/6.1.0/VirtualBox-6.1-6.1.0_135406_el7-1.x86_64.rpm wget https://download.virtualbox.org/virtualbox/6.1.0/Oracle_VM_VirtualBox_Extension_Pack-6.1.0-135406.vbox-extpack
安装VirtualBox
rpm -ivh VirtualBox-6.1-6.1.0_135406_el7-1.x86_64.rpm
安装VirtualBox扩展包
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.0-135406.vbox-extpack
拆卸扩展包(如果不需要)
VBoxManage list extpacks VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
验证
systemctl status vboxdrv VBoxManage -v
校验ISO
sha256sum CentOS-7-x86_64-Minimal-1908.iso md5sum CentOS-7-x86_64-Minimal-1908.iso
创建虚拟机
virtualbox
管理---全局设定---语言--简体中文
新建
这里更改了存储虚拟机的文件夹
默认内存2G,这里改为了4G
创建虚拟磁盘
虚拟磁盘文件类型选择VDI
动态分配
虚拟磁盘大小设置为20G
设置虚拟机
虚拟机网卡类型改为桥接,桥接到服务器team0网卡上
存储选项中,将第二IDE控制器主通道,浏览到CentOS的ISO上
启动虚拟机
启动盘为指定的光驱
可以开始安装了
设置VirtualBox后台启动
启动---无界面启动,这样就可以后台启动虚拟机了
命令行后台启动
VBoxManage startvm "centos7" --type headless
命令行关闭虚拟机
VBoxManage controlvm "centos7" poweroff
安装虚拟机增强工具
VirtualBox工具栏---设备---安装增强功能
yum install -y kernel-devel gcc bzip2 xorg-x11-server-Xorg mkdir /mnt/cdrom mount -t iso9660 /dev/cdrom /mnt/cdrom cd /mnt/cdrom/ ./VBoxLinuxAdditions.run
如果出错cat /var/log/vboxadd-setup.log查问题
定时恢复快照
VBoxManage list runningvms VBoxManage snapshot "centos" take snapshot3 打快照 VBoxManage snapshot centos list #查看快照名 VBoxManage snapshot centos showvminfo a04d9a25-ec96-4062-b5ce-11f403ac4e1e #查看快照 vim /root/restore.sh 添加 VBoxManage snapshot centos restore a04d9a25-ec96-4062-b5ce-11f403ac4e1e VBoxManage startvm "centos" --type headless crontab -e 20 9 * * * /root/restore.sh > /dev/null 2>&1
本站所有文章均可随意转载,转载时请保留原文链接及作者。