# 当我们想要体验体验不同类型的Linux的使用技巧,节省个人开销,可以在Windows系统上创建其他系统的虚拟机,可以创建虚拟机常用的应用有:
- VMware Station
- VirtualBox
此篇文章使用VirtualBox,结合Vagrant来实现Linux虚拟机的创建。使用这两种应用结合的方法,相对于使用VMware Station创建虚拟机来可以节省时间,加快效率,减少了等待系统安装的漫长等待。
涉及的应用:Vagrant 下载路径:Install | Vagrant | HashiCorp Developer
VirtualBox 下载路径:Downloads – Oracle VM VirtualBox
一. Vagrant+VirtualBox安装
下载Vagrant和VirtualBox完成后,安装两个应用。由于VirtualBox和Vagrant的安装过程均是图形化界面安装,直接下一步,安装路径可以自行选择(记住自己选的路径),安装顺序没有前后顺序,安装完成后可以检查以下:
(1)在Windows系统下,使用快捷键“Win + R”打开运行窗口,在其中输入“cmd”,在命令行窗口中输入vagrant ,如下:
C:\Users\Administrator>vagrant Usage: vagrant [options] <command> [<args>] -h, --help Print this help. Common commands: autocomplete manages autocomplete installation on host box manages boxes: installation, removal, etc. cloud manages everything related to Vagrant Cloud destroy stops and deletes all traces of the vagrant machine global-status outputs status Vagrant environments for this user halt stops the vagrant machine help shows the help for a subcommand init initializes a new Vagrant environment by creating a Vagrantfile login package packages a running vagrant environment into a box plugin manages plugins: install, uninstall, update, etc. port displays information about guest port mappings powershell connects to machine via powershell remoting provision provisions the vagrant machine push deploys code in this environment to a configured destination rdp connects to machine via RDP reload restarts vagrant machine, loads new Vagrantfile configuration resume resume a suspended vagrant machine serve start Vagrant server snapshot manages snapshots: saving, restoring, etc. ssh connects to machine via SSH ssh-config outputs OpenSSH valid configuration to connect to the machine status outputs status of the vagrant machine suspend suspends the machine up starts and provisions the vagrant environment upload upload to machine via communicator validate validates the Vagrantfile version prints current and latest Vagrant version winrm executes commands on a machine via WinRM winrm-config outputs WinRM configuration to connect to the machine For help on any individual command run `vagrant COMMAND -h` Additional subcommands are available, but are either more advanced or not commonly used. To see all subcommands, run the command `vagrant list-commands`. --[no-]color Enable or disable color output --machine-readable Enable machine readable output -v, --version Display Vagrant version --debug Enable debug output --timestamp Enable timestamps on log output --debug-timestamp Enable debug output with timestamps --no-tty Enable non-interactive output C:\Users\Administrator>
出现如上的内容,表示Vagrant安装成功!
(2)VirtualBox安装完成后,会是一个普通的应用程序,直接点击对应图标打开,就是如下的界面(应用刚安装,无以下的虚拟系统列表):
到此,VirtualBox安装完成。
二. Linux虚拟机安装
现在,使用现有的环境,创建一个版本为 Centos 7 的虚拟机,安装开始。
(1)在Windows系统下,使用快捷键“Win + R”打开运行窗口,在其中输入“cmd”,打开命令行窗口,输入如下内容:
在windows的F盘下创建一个虚拟机总目录:F:\vrbox
C:\Users\Administrator>F: F:\>mkdir vrbox
F:\>dir
驱动器 F 中的卷没有标签。
F:\ 的目录
2023/08/01 22:21 <DIR> vrbox
0 个文件 0 字节
1 个目录 92,429,574,144 可用字节
在F:\vrbox的路径下,创建Centos 7 虚拟机的文件目录:F:\vrbox\vcentos:
F:\vrbox>mkdir vcentos F:\vrbox>cd vcentos F:\vrbox\vcentos>
(2) 在F:\vrbox\vcentos目录下打开命令行窗口,输入如下命令:
下载创建虚拟机:
F:\vrbox\vcentos>