CentOS 6 命令行下安装 VirtualBox 虚拟机步骤

1、 准备工作

安装内核更新

yum install kernel-devel
yum update kernel*
如果内核有更新,则需要重新启动操作系统。

2、 安装VirtualBox

wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
rpm --import oracle_vbox.asc
wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
yum install VirtualBox-4.3
3、 安装扩展包,以便使用RDP协议3389远程登录安装操作系统

wget http://download.virtualbox.org/virtualbox/4.3.2/Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
4、 创建虚拟机

创建一个2.6或者3.0内核的操作系统虚拟机,名称为centos6,虚拟机文件存放路径在/opt/virtualbox/

VBoxManage createvm --name centos6 --ostype Linux26_64 --register --basefolder /opt/virtualbox/
在创建之前可以查看下支持的客户操作系统类型:

VBoxManage list vms
5、 创建虚拟磁盘

创建一个150G的虚拟磁盘

VBoxManage createvdi --filename /opt/virtualbox/centos6.vdi --size 150000
6、 创建虚拟机的硬盘控制器

VBoxManage storagectl centos6 --name storage_controller_1 --add ide
7、 挂在虚拟硬盘和虚拟光驱

VBoxManage storageattach centos6 --storagectl storage_controller_1 --type hdd --port 0 --device 0  --medium /opt/virtualbox/centos6.vdi
VBoxManage storageattach centos6 --storagectl storage_controller_1 --type dvddrive --port 1 --device 0 --medium /opt/setup/CentOS-6.3-x86_64-LiveCD.iso
这里将5创建好的虚拟磁盘挂载在虚拟机上,同时挂在一个虚拟光驱,加载ISO镜像文件。

8、 设置启动顺序

将光驱设置为第一启动顺序,以便安装操作系统。

VBoxManage modifyvm centos6 --boot1 dvd
VBoxManage modifyvm centos6 --boot2 disk
9、 创建桥接的网络

VBoxManage modifyvm centos6 --nic1 bridged --cableconnected1 on --nictype1 82540EM --bridgeadapter1 em1 --intnet1 brigh1 --macaddress1 auto
在创建之前查看下当前宿主机器的网卡名称,例如此处是 em1

10、 启动vrde模块

VRDE模块用于启动RDP协议,使用微软的3389客户端即可连接。

VBoxManage modifyvm centos6 --vrde on
最后操作系统安装、设置完成后可以考虑关闭此屏幕输出。

VBoxManage modifyvm centos6 --vrde off
11、 调整系统参数

可以此时调整虚拟机的CPU、内存等参数

VBoxManage modifyvm centos6 --memory 4096
VBoxManage modifyvm centos6 --cpus 2
12、 启动虚拟机

VBoxHeadless -startvm centos6
13、 3389远程连接安装操作系统

安装完操作系统即可正常使用。

一些常见问题

遇到问题 ‘WARNING: The vboxdrv kernel module is not loaded.’

确认当前使用的内核和内核头文件版本完全一致:

yum list installed|grep kernel
然后使用vboxdrv进行配置

/etc/init.d/vboxdrv setup
启动、关闭虚拟机

可以使用下列方式启动虚拟机 https://www.virtualbox.org/manual/ch08.html#vboxmanage-startvm

VBoxManage startvm centos6 --type headless
VBoxHeadless -startvm centos6
关闭虚拟机,如果是前台运行的VBoxHeadless,直接CTRL+C即可。 如果是后台运行的VBoxHeadless或者VBoxManage startvm,使用

VBoxManage controlvm centos6 poweroff
无法使用3389端口连接?

检查端口是否存活:

netstat -nap|grep 3389
ss -nap|grep 3389
检查防火墙是否允许通过。

虚拟机控制常用操作

常用操作地址https://www.virtualbox.org/manual/ch08.html#vboxmanage-controlvm

VBoxManage controlvm pause|resume|poweroff|savestate centos6
无法使用rsa publickey登录?

检查是否selinux禁止登录。

CentOS 6 命令行下安装 VirtualBox 虚拟机步骤的更多相关文章

  1. Linux(CentOS 7)命令行模式安装VMware Tools 详解

    本篇文章主要介绍了如何在Linux(CentOS 7)命令行模式安装VMware Tools,具有一定的参考价值,感兴趣的小伙伴们可以参考一下. 本例中为在Linux(以CentOS 7为例)安装VM ...

  2. VMware 命令行下安装以及导入Ubuntu系统

    前提: 鉴于个人PC性能太弱,考虑是否可以将在PC上搭建好的环境移植到高性能服务器上.想到后就干呗. 下载完对应操作系统的安装包后按如下步骤操作: 安装包名称:VMware-Workstation-F ...

  3. 在centos命令行下安装软件

    考虑到用linux纯命令行模式时,通常都是用作服务器,所以,一般主要是安装一个php.mysql.apache的集成环境和ftp服务器,在这里用xampp集成包即可解决所有问题,在这里说一下我自己的做 ...

  4. 使用KVM的命令行方式安装centos7虚拟机

    前提条件 1.宿主机上已经安装KVM软件,参考网址:https://www.cnblogs.com/sanduzxcvbnm/p/15538881.html 2.已经上传centos7镜像到宿主机里 ...

  5. Ubuntu命令行下安装,卸载软件包的过程[转]

    一.Ubuntu中软件安装方法 1.APT方式 (1)普通安装:apt-get install softname1 softname2 …; (2)修复安装:apt-get -f install so ...

  6. 【转】Ubuntu命令行下安装、卸载、管理软件包的方法

    原文网址:http://oss.org.cn/html/47/n-67447.html 一.Ubuntu中软件安装方法 1.APT方式 (1)普通安装:apt-get install softname ...

  7. Ubuntu命令行下安装、卸载、管理软件包的方法

    一.Ubuntu中软件安装方法 1.APT方式 (1)普通安装:apt-get install softname1 softname2 -; (2)修复安装:apt-get -f install so ...

  8. 在windows命令行下安装和使用babel(es6to5)

    在自己的目录下新建一个babel-test/目录 进入这个目录 1. 安装babel命令和转换库:      npm install babel-cli      npm install babel- ...

  9. Ubuntu14.04 命令行下安装teamviewer

    下载teamviewer 链接:https://pan.baidu.com/s/1hs0BppM  密码:sdmk 上传到 /home/[user] cd /home/[user] 移动安装包到 /o ...

随机推荐

  1. iOS_12_tableViewCell的删除更新_红楼梦

    终于效果图: Girl.h // // Girl.h // 12_tableView的增删改 // // Created by beyond on 14-7-27. // Copyright (c) ...

  2. Codeforces Round #267 (Div. 2) B. Fedor and New Game

    After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play ...

  3. OpenCV4Android编译

    http://blog.sina.com.cn/s/blog_602f87700102vdnw.html (2015-04-02 11:10:01) 转载▼     最近的一个项目中,需要自己编译Op ...

  4. 加载jsp页面报#{} is not allowed in template text

    问题是在引进jQueryUI时遇到 解决方法: 在page指令添加:             deferredSyntaxAllowedAsLiteral="true" 例如:&l ...

  5. 深入理解Java:注解(Annotation)自定义注解入门(转载)

    要深入学习注解,我们就必须能定义自己的注解,并使用注解,在定义自己的注解之前,我们就必须要了解Java为我们提供的元注解和相关定义注解的语法. 元注解: 元注解的作用就是负责注解其他注解.Java5. ...

  6. IOS UIScrollView滚动到指定位置

    [mScrollView setContentOffset:CGPointMake(0,200) animated:YES];

  7. Windows8-x64 VMWare安装Linux CentOS6-x64

    本文參考了:http://www.cnblogs.com/seesea125/archive/2012/02/25/2368255.html 其内容相当具体,以至于我还没依照其步骤做完.系统就已经安装 ...

  8. 功能强大的Xcode辅助工具Faux Pas:帮你找到各种隐形的bug

    本文转载至 http://www.cocoachina.com/industry/20140804/9307.html Faux Pas(Beta版下载地址)是一个Xcode辅助工具,用以检查Xcod ...

  9. 2018.11.23-day25 面向对象-封装

    1.经典类 2.多态 3.鸭子类型 4.封装

  10. Django学习之站点缓存详解

      本文和大家分享的主要是django缓存中站点缓存相关内容,一起来看看吧,希望对大家学习django有所帮助. 缓存整个站点,是最简单的缓存方法 在 MIDDLEWARE_CLASSES 中加入 “ ...