VirtualBox+Vagrant安装linux

一、VirtualBox安装

VirtualBox官网:Oracle VM VirtualBox

这里采用VirtualBox--7.0.0 版本 

二、Vagrant安装

Vagrant官网:Vagrant by HashiCorp

Vagrant镜像仓库:Discover Vagrant Boxes - Vagrant Cloud

这里采用Vagrant--2.4.1版本

在cmd命令窗口输入 vagrant 命令弹出如下内容表示 vagrant 安装成功

  

三、安装linux 

1.安装镜像并启动

通过Vagrant安装虚拟机:

  • 创建一个空的目录,cmd切换到该目录中,然后执行 vagrant init centos/7 会创建Vagrantfile文件

  • 执行 vagrant up 第一次执行的时候会远程下相关的镜像文件,并启动虚拟机。

  • 连接虚拟机通过 vagrant ssh 连接

如果安装过程过慢可以把地址复制到浏览器进行安装 

- 下载完成后  得到一个名为  xxxxx.xxxx.box文件

- 将这个box添加到vagrant中

- 然后启动 vagrant up 进行启动

# 将box添加到vagrant中--在新创建的空文件夹中cmd进入命令行窗口name-可自定义   box目录 
vagrant box add centos/7 D:\VirtualBox.box  
# 初始化 
vagrant init centos/7
# 启动
vagrant up

2.virtualBox 中就可以看到了

3.配置本机连接虚拟机 公共网络

4.配置磁盘

# 要安装磁盘插件
vagrant plugin install vagrant-disksize

5.配置内存以及Cpu数量

# -*- mode: ruby -*-
# vi: set ft=ruby :# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|# The most common configuration options are documented and commented below.# For a complete reference, please see the online documentation at# https://docs.vagrantup.com.# Every Vagrant development environment requires a box. You can search for# boxes at https://vagrantcloud.com/search.# iso镜像名称config.vm.box = "yueluo"# 磁盘大小config.disksize.size = "40GB"# Disable automatic box update checking. If you disable this, then# boxes will only be checked for updates when the user runs# `vagrant box outdated`. This is not recommended.# config.vm.box_check_update = false# Create a forwarded port mapping which allows access to a specific port# within the machine from a port on the host machine. In the example below,# accessing "localhost:8080" will access port 80 on the guest machine.# NOTE: This will enable public access to the opened port# config.vm.network "forwarded_port", guest: 80, host: 8080# Create a forwarded port mapping which allows access to a specific port# within the machine from a port on the host machine and only allow access# via 127.0.0.1 to disable public access# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"# Create a private network, which allows host-only access to the machine# using a specific IP.# 本机与虚拟机进行连接config.vm.network "private_network", ip: "192.168.56.100"# Create a public network, which generally matched to bridged network.# Bridged networks make the machine appear as another physical device on# your network.# 分配网络config.vm.network "public_network"# Share an additional folder to the guest VM. The first argument is# the path on the host to the actual folder. The second argument is# the path on the guest to mount the folder. And the optional third# argument is a set of non-required options.# config.vm.synced_folder "../data", "/vagrant_data"# Disable the default share of the current code directory. Doing this# provides improved isolation between the vagrant box and your host# by making sure your Vagrantfile isn't accessible to the vagrant box.# If you use this you may want to enable additional shared subfolders as# shown above.# config.vm.synced_folder ".", "/vagrant", disabled: true# Provider-specific configuration so you can fine-tune various# backing providers for Vagrant. These expose provider-specific options.# Example for VirtualBox:#config.vm.provider "virtualbox" do |vb|# Display the VirtualBox GUI when booting the machinevb.gui = true# Customize the amount of memory on the VM:vb.memory = "4096"vb.cpus = 2end## View the documentation for the provider you are using for more# information on available options.# Enable provisioning with a shell script. Additional provisioners such as# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the# documentation for more information about their specific syntax and use.# config.vm.provision "shell", inline: <<-SHELL#   apt-get update#   apt-get install -y apache2# SHELL
end

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/493155.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

JAVA学习笔记11

1.标识符 1.1 标识符的命名规则和规范 1.1.1 标识符概念 ​ 1.Java对各种变量、方法和类等命名时使用的字符序列称为标识符 ​ 2.凡是自己可以起名字的地方都叫标识符 int num1 90。 1.1.2 标识符的命名规则&#xff08;必须遵守&#xff09; ​ 1.由26个英文字母、数字…

Jeecg项目部署

说明&#xff1a;Jeecg是一款低代码开发平台&#xff0c;简单说是一款现成的项目&#xff0c;该项目集成了许多功能&#xff0c;我们可以在这个项目之上开发自己的业务代码。 本文介绍Jeecg项目的部署&#xff0c;包括后端jeecg-boot项目、前端vue3项目。前端项目在本地Window…

从专业到大众:Sora如何颠覆传统视频制作模式

随着科技的飞速进步&#xff0c;人工智能(AI)技术正逐渐渗透到我们生活的方方面面。在视频制作领域&#xff0c;OpenAI推出的Sora模型为这一传统行业带来了前所未有的变革。Sora不仅改变了视频制作的技术门槛&#xff0c;更将视频制作从专业人士的手中解放出来&#xff0c;推向…

Linux信号详解

文章目录 一、Linux信号1. 信号的概念2. 信号的定义3. 系统定义的信号 二、信号产生的方式1.通过键盘产生2. 通过系统调用3. 软件条件4. 硬件异常 三、信号处理函数1. OS发送信号的实质2. 指令发送信号3. signal()4. sigaction() 四、信号屏蔽机制1. 信号处理方式2.信号集操作函…

数据分析-Pandas数据如何图示规律

数据分析-Pandas数据如何图示规律 数据分析和处理中&#xff0c;难免会遇到各种数据&#xff0c;那么数据呈现怎样的规律呢&#xff1f;不管金融数据&#xff0c;风控数据&#xff0c;营销数据等等&#xff0c;莫不如此。如何通过图示展示数据的规律&#xff1f; 数据表&…

通过二叉树例题深入理解递归问题

目录 引入&#xff1a; 例1&#xff1a;二叉树的前序遍历&#xff1a; 例2&#xff1a; N叉树的前序遍历&#xff1a; 例3&#xff1a;二叉树的最大深度&#xff1a; 例4&#xff1a;二叉树的最小深度 例5&#xff1a;N叉树的最大深度&#xff1a; 例6&#xff1a;左叶子…

FPGA IO命名与Bank划分

文章目录 IO的命名IO物理命名IO功能命名 Bank简介FPGA器件功能命名与Bank划分查找XILINXIntelLATTICE IO的命名 IO物理命名 FPGA的IO物理命名规则&#xff0c;也就是我们做管脚约束时候的命名。芯片通常是长方体或者正方体&#xff0c;所以命名通常采用字母数字组合的方式&am…

如何使用Axure RP制作web页面并实现无公网ip远程访问——“cpolar内网穿透”

文章目录 前言1.在AxureRP中生成HTML文件2.配置IIS服务3.添加防火墙安全策略4.使用cpolar内网穿透实现公网访问4.1 登录cpolar web ui管理界面4.2 启动website隧道4.3 获取公网URL地址4.4. 公网远程访问内网web站点4.5 配置固定二级子域名公网访问内网web站点4.5.1创建一条固定…

Numpy 数组添加行

参考&#xff1a;Add Row to Numpy Array 在机器学习和数据分析中&#xff0c;经常需要处理大型数据集。Numpy是Python中一个非常有用的库&#xff0c;它提供了高性能的多维数组对象以及用于处理这些数组的函数。在Numpy中&#xff0c;可以使用numpy.append()函数来添加行到一…

Go语言必知必会100问题-05 接口污染

接口污染 在Go语言中&#xff0c;接口是我们设计和编写代码的基石。然而&#xff0c;像很多概念一样&#xff0c;滥用它是不好的。接口污染是指用不必要的抽象来编写代码&#xff08;刻意使用接口&#xff09;&#xff0c;使得代码更难以理解。这是具有不同习惯&#xff0c;特…

【Java程序设计】【C00313】基于Springboot的物业管理系统(有论文)

基于Springboot的物业管理系统&#xff08;有论文&#xff09; 项目简介项目获取开发环境项目技术运行截图 项目简介 这是一个基于Springboot的物业管理系统&#xff0c;本系统有管理员、物业、业主以及维修员四种角色权限&#xff1b; 管理员进入主页面&#xff0c;主要功能包…

设计模式(七)装饰模式

相关文章设计模式系列 1.装饰模式简介 装饰模式介绍 装饰模式是结构型设计模式之一&#xff0c;不必改变类文件和使用继承的情况下&#xff0c;动态地扩展一个对象的功能&#xff0c;是继承的替代方案之一。它是通过创建一个包装对象&#xff0c;也就是装饰来包裹真实的对象…