携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第18天,点击查看活动详情
目录
【快速创建 linux 虚拟机,详细介绍】
我们先要安装一个 Linux 虚拟机来简化开发,
比如 redis、mysql、rabbitMQ 等等,我们后端项目开发真实环境,都是装在 Linux 里面的。
二、VirtualBox 里边安装虚拟的 Linux系统
1、vagrant镜像仓库、vagrant下载
但如果我们想要给我们 VirtualBox 里面新建一个 Linux 虚拟机,那我们需要呢先在网上下载Linux相关的镜像,
然后点击新建,根据这个创建向导来一步一步的创建虚拟机,这样呢太麻烦了,
我们呢推荐大家使用我们一个新的技术叫 vagrant
app.vagrantup.com/boxes/searc… Vagrant 官方镜像仓库
vagrant 呢,只要我们装了VirtualBox ,vagrant可以帮我们快速地创建出一个虚拟机。
其实呢,Vagrant官方有一个叫镜像仓库,在这个镜像仓库里边呢,官方有好多,已经做好的镜像,比如centos、ubuntu等等等等,
我们只需要用 vagrant 就能连接 VirtualBox ,快速的从官方镜像里边创建出一个虚拟机。那好,我们接下来就使用vagrant,我们来先来搜索vagrant,
然后呢来到他的官方网站。他这一块儿呢,有一个下载页面,我们点进他的下载页面,注意下载我们 windows64位版本,当然我的系统呢是64位,
www.vagrantup.com/downloads.h… Vagrant 下载
2、vagrant 安装、验证
好我们双击安装好下一步,好同意协议下一步,然后呢,我们一般推荐呢,都把它安装在其他盘好来下一步。
我们进行安装。好,Vagrant安装就完成了,然后我们来验证一下他是否安装成功,但是他安装完成以后呢,我们要重启一下我们的系统。
我们再来验证一下是否安装完成,打开我们的 cmd 窗口,然后呢,我们来敲一个命令,vagrant,如果他有 vagrant 的命令提示,那我们就相当于安装成功了。
C:\Users\yyh>vagrant
Usage: vagrant [options] []-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
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 machineFor 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