Mac下vagrant从安装到体验,spring框架教程笔记

Mac下vagrant从安装到体验,spring框架教程笔记,第1张

Mac下vagrant从安装到体验,spring框架教程笔记

base) zhaoqindeMBP:18 zhaoqin$ vagrant init centos/7

A Vagrantfile has been placed in this directory. You are now

ready to vagrant up your first virtual environment! Please read

the comments in the Vagrantfile as well as documentation on

vagrantup.com for more information on using Vagrant.

  1. 打开Vagrantfile看看,如下图,只有少量信息,看来主要用的都是默认配置:

  1. 执行命令启动虚拟机,接下来需要等待10分钟左右,控制台输出以下信息表示启动虚拟机成功:

(base) zhaoqindeMBP:18 zhaoqin$ vagrant up

Bringing machine ‘default’ up with ‘virtualbox’ provider…

==> default: Box ‘centos/7’ could not be found. Attempting to find and install…

default: Box Provider: virtualbox

default: Box Version: >= 0

==> default: Loading metadata for box ‘centos/7’

default: URL: https://vagrantcloud.com/centos/7

==> default: Adding box ‘centos/7’ (v1905.1) for provider: virtualbox

default: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1905.1/providers/virtualbox.box

default: Download redirected to host: cloud.centos.org

==> default: Successfully added box ‘centos/7’ (v1905.1) for ‘virtualbox’!

==> default: importing base box ‘centos/7’…

==> default: Matching MAC address for NAT networking…

==> default: Checking if box ‘centos/7’ version ‘1905.1’ is up to date…

==> default: Setting the name of the VM: 18_default_1566103400563_66799

==> default: Clearing any previously set network interfaces…

==> default: Preparing network interfaces based on configuration…

default: Adapter 1: nat

==> default: Forwarding ports…

default: 22 (guest) => 2222 (host) (adapter 1)

==> default: Booting VM…

==> default: Waiting for machine to boot. This may take a few minutes…

default: SSH address: 127.0.0.1:2222

default: SSH username: vagrant

default: SSH auth method: private key

default:

default: Vagrant insecure key detected. Vagrant will automatica

《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》

【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享

lly replace

default: this with a newly generated keypair for better security.

default:

default: Inserting generated public key within guest…

default: Removing insecure key from the guest if it’s present…

default: Key inserted! Disconnecting and reconnecting using new SSH key…

==> default: Machine booted and ready!

==> default: Checking for guest additions in VM…

default: No guest additions were detected on the base box for this VM! Guest

default: additions are required for forwarded ports, shared folders, host only

default: networking, and more. If SSH fails on this machine, please install

default: the guest additions and repackage the box to continue.

default:

default: This is not an error message; everything may continue to work properly,

default: in which case you may ignore this message.

==> default: Rsyncing folder: /Users/zhaoqin/temp/201908/18/ => /vagrant

  1. ssh登录:

vagrant ssh

  1. 登录成功后,查看虚拟机 *** 作系统版本,可见是centos7.6:

[vagrant@localhost ~]$ cat /etc/redhat-release

CentOS Linux release 7.6.1810 (Core)

  1. 退出ssh,回到控制台:

exit

基本命令
  1. 关闭虚拟机:

vagrant halt

  1. 启动虚拟机:

vagrant up

  1. 重启虚拟机:

vagrant reload

  1. 删除虚拟机:

vagrant destroy

修改配置
  1. 接下来尝试修改虚拟机的配置文件Vagrantfile,在Vagrantfile中添加如下图红框中的内容,作用是将虚拟机内存设置为2G:

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5620013.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存