001:环境-开发环境搭建
本章摘要:
一、在win10系统安装virtualBox
二、利用vagrant 在virtualBox中安装centos/7
正文:
一、在win10系统安装virtualBox
1、virtualBox是什么?为什么不是用VMWare?
VirtualBox 是一款开源虚拟机软件。VirtualBox 是由德国 Innotek 公司开发,由Sun Microsystems公司出品的软件,使用Qt编写,在 Sun 被 Oracle 收购后正式更名成 Oracle VM VirtualBox。Innotek 以 GNU General Public License (GPL) 释出 VirtualBox,并提供二进制版本及 OSE 版本的代码。使用者可以在VirtualBox上安装并且执行Solaris、Windows、DOS、Linux、OS/2 Warp、BSD等系统作为客户端操作系统。已由甲骨文公司进行开发,是甲骨文公司xVM虚拟化平台技术的一部份。VirtualBox号称是最强的免费虚拟机软件,它不仅具有丰富的特色,而且性能也很优异!它简单易用,可虚拟的系统包括Windows(从Windows 3.1到Windows 10、Windows Server 2012,所有的Windows系统都支持)、Mac OS X、Linux、OpenBSD、Solaris、IBM OS2甚至Android等操作系统!使用者可以在VirtualBox上安装并且运行上述的这些操作系统! 与同性质的VMware及Virtual PC比较下,VirtualBox独到之处包括远端桌面协定(RDP)、iSCSI及USB的支持,VirtualBox在客户端操作系统上已可以支持USB 3.0的硬件装置,不过要安装 VirtualBox Extension Pack。
简单来说:开源、免费、简单、性能高、功能独到。
2、如何安装
官网下载地址:https://www.oracle.com/cn/virtualization/technologies/vm/downloads/virtualbox-downloads.html

如果官网下载太慢,可以用这个:
链接:https://pan.baidu.com/s/13xDWCJ23K5fxKZ3HZLfpxw
提取码:xnz5

然后安装即可!

二、利用vagrant 在virtualBox中安装centos/7
1、vagrant是什么?
Vagrant是一个基于Ruby的工具,用于创建和部署虚拟化开发环境。它 使用Oracle的开源VirtualBox虚拟化系统,使用 Chef创建自动化虚拟环境。
Vagrant的运行,需要依赖某项具体的虚拟化技术,最常见的有VirtualBox以及VMWare两款,早期,Vagrant只支持VirtualBox,后来才加入了VMWare的支持。
2、为什么要使用vagrant?
因为它有跨平台、可移动、自动化部署无需人工参与等优点。
3、如何安装?
下载地址:https://www.vagrantup.com/downloads.html
安装过程依旧没什么难的,跟着提示一步一步next(最后需要重启电脑)。
如果下载速度慢,试试这个:链接:https://pan.baidu.com/s/1IGugswoWo0WPoOzq5SbiOw
提取码:uri3

4、利用vagrant 在VirtualBox中安装centos7


这一步会比较慢,启动centos虚拟机。。。。。。
解决vagrant up过慢的问题:
进入 https://app.vagrantup.com/boxes/search

或者使用百度网盘下载:链接:https://pan.baidu.com/s/1vD2xUmN-dOMsImPXA3fojQ
提取码:v32c
下载完成,然后:
cd 到下载好的文件目录
vagrant box add --name centos/7 CentOS-7-x86_64-Vagrant-2004_01.VirtualBox.box

重新加载镜像
vagrant up
报错:

原因分析:
在使用vagrant init命令初始化配置文件的时候未指定虚拟机名称,也就是命令:vagrant box add BoxName boxpath中的BoxName。
1.再来一遍,重新生成Vagrantfile配置文件
vagrant init BoxName
2.修改Vagrantfile文件中config.vm.box参数:
config.vm.box = "base"
将base修改为你的虚拟机名称,重新vagrant up。


安装完成后,输入
vagrant ssh

连接成功!