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.mzph.cn/news/700354.shtml

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

相关文章

神经网络系列---权重初始化方法

文章目录 权重初始化方法Xavier初始化&#xff08;Xavier initialization&#xff09;Kaiming初始化&#xff0c;也称为He初始化LeCun 初始化正态分布与均匀分布Orthogonal InitializationSparse Initializationn_in和n_out代码实现 权重初始化方法 Xavier初始化&#xff08;X…

关于uniapp H5应用无法在触摸屏正常显示的处理办法

关于uniapp H5应用无法在触摸屏正常显示的处理办法 1、问题2、处理3、建议 1、问题 前几天&#xff0c; 客户反馈在安卓触摸大屏上无法正确打开web系统&#xff08;uni-app vue3开发的h5 应用&#xff09;&#xff0c;有些页面显示不出内容。该应用在 pc 端和手机端都可以正常…

【递归版】归并排序算法(1)

目录 MergeSort归并排序 整体思想 图解分析 代码实现 时间复杂度 递归&归并排序VS快速排序 MergeSort归并排序 归并排序&#xff08;MERGE-SORT&#xff09;是建立在归并操作上的一种有效的排序算法&#xff0c;该算法是采用分治法&#xff08;Divide and Conquer&a…

元宇宙与大模型的关系

元宇宙与大模型之间存在密切的关系&#xff0c;它们可以相辅相成&#xff0c;共同构建一个更加复杂、真实和全面的虚拟世界。 元宇宙的概念&#xff1a;元宇宙是一个包容性的虚拟世界&#xff0c;涵盖了虚拟现实、增强现实和混合现实等多种技术&#xff0c;以及人工智能、区块…

Golang性能分析神器:pprof与火焰图实战揭秘

文章目录 性能分析的重要性性能分析的维度 pprof简介pprof的作用pprof的工作原理 使用pprof进行性能分析采样方式数据分析实战案例火焰图 深入理解pprof的采样机制CPU采样如何启动CPU采样 Goroutine采样如何启动Goroutine采样 内存采样如何启动内存采样 阻塞和锁竞争采样如何启…

Linux第65步_学习“Makefie”

学习“Makefie”&#xff0c;为后期学习linux驱动开发做铺垫。 1、在“/home/zgq/linux/atk-mp1”创建一个“Test_MakeFile”目录用于学习“Makefie”。 打开终端 输入“cd /home/zgq/linux/回车”&#xff0c;切换到“/home/zgq/linux/”目录 输入“mkdir Linux_Drivers回…

window: C++ 获取自己写的dll的地址

我自己用C写了一个插件,插件是dll形式的,我的插件式在dll的目录下有个config文件夹,里面是我用json写的插件配置文件,当插件运行的时候我需要读取到json配置文件,所有最重要的就是如何获取dll的路径. 大概就是这么个结构, 我自己封装了一个函数.只适用于window编程,因为里面用…

node 之 fs文件系统模块

1.什么是fs文件系统模块 fs模块是Node.js官方提供的、用来操作文件的模块。它提供了一系列的方法和属性&#xff0c;用来满足用户对文件的操作需求 fs.readFile(),用来读取制定文件中的内容 fs.writeFile(),用来向制定的文件中写入内容 如果要在JavaScript代码中&#xff0c;使…

论文是怎么一回事

最近找到女朋友了&#xff0c;她还挺关心我毕业和论文的事情&#xff0c;我开始着手弄论文了~ 说来惭愧&#xff0c;我一直以为读研就是做东西当作工作来完成&#xff0c;结果一直陷入如何实现的问题&#xff0c;结果要论文时不知道怎么弄创新点&#xff0c;这才转过头来弄论文…

Python实现歌曲下载程序, 打包exe应用程序

嗨喽~大家好呀&#xff0c;这里是魔王呐 ❤ ~! python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取 环境使用: Python 3.10 Pycharm 模块使用: import requests >>> pip install requests import parsel >>> pip install parsel import pr…

Vue30 自定义指令 函数式 对象式

实例 <!DOCTYPE html> <html><head><meta charset"UTF-8" /><title>自定义指令</title><script type"text/javascript" src"../js/vue.js"></script></head><body><!-- 需求1&…

使用向量数据库pinecone构建应用06:日志系统异常检测 Anomaly Detection

Building Applications with Vector Databases 下面是这门课的学习笔记&#xff1a;https://www.deeplearning.ai/short-courses/building-applications-vector-databases/ Learn to create six exciting applications of vector databases and implement them using Pinecon…

spring.factories 和@ComponentScan的使用小结

spring.factories和ComponentScan是Spring框架中两个不同的概念&#xff0c;它们在功能和作用上有一些区别。 spring.factories&#xff1a;通过SPI机制扫描META-INF/spring.factories文件中配置加载组件 spring.factories是Spring Boot项目中的一个特殊文件&#xff0c;用于自…

excel文件数据上传到MySQL数据库

方法1&#xff1a;使用MySQL的LOAD DATA语句 如果Excel文件已经保存为CSV格式&#xff0c;可以使用MySQL的LOAD DATA INFILE语句将数据导入表中。例如&#xff1a; LOAD DATA LOCAL INFILE path/to/your/file.csv INTO TABLE your_table_name FIELDS TERMINATED BY , …

1004: 【C1】【一维数组】【入门】输出奇数和偶数

题目描述 输入n个整数&#xff0c;将其中的奇数和偶数分别显示出来&#xff08;1 < n < 30&#xff09; 输入 第一行&#xff1a;一个整数n。第二行&#xff1a;n个空格隔开的整数。 输出 第一行&#xff1a;若干个奇数。第二行&#xff1a;若干个偶数。&#xff08…

Javaweb之SpringBootWeb案例之配置优先级的详细解析

1. 配置优先级 在我们前面的课程当中&#xff0c;我们已经讲解了SpringBoot项目当中支持的三类配置文件&#xff1a; application.properties application.yml application.yaml 在SpringBoot项目当中&#xff0c;我们要想配置一个属性&#xff0c;可以通过这三种方式当中…

强化学习入门到不想放弃-3

第三节我们主要讲一下SARSA模型 上节课的链接:强化学习入门到不想放弃-2 (qq.com) 有模型的概念:简单理解,上节课我讲的就是有模型,就是可以开上帝视角,知道全局地图 无模型的概念: 打CS,但是看不到地图的情况,全凭自己探索 今天的讲解环境还是和上节课一样,如下…

vue 项目打包图片没有打包进去问题解决

问题 vue 项目打包&#xff0c;项目中引用了的图片没有被打进包里&#xff0c;导致打包后的项目图片缺失。 解决方法 1、在导入图片的文件中通过 import 引入图片 这种方法只适合图片少的情况 <template><img :srctestImg/> </template><script>i…

yml配置文件中常见的配置及含义

1.数据库连接的相关配置 项目名称:datasource:driver-class-name: com.mysql.cj.jdbc.Driverhost: localhostport: 3306database: 数据库名username: 用户名password: 密码 springboot配置文件,用于配置数据库源连接信息 数据库驱动类型为com.mysql.cj.jdbc.Driver,这是数据…

redis的搭建 RabbitMq搭建 Elasticsearch 搭建

官网 Download | Redis wget https://github.com/redis/redis/archive/7.2.4.tar.gz 编译安装 yum install gcc g tar -zxvf redis-7.2.4.tar.gz -C /usr/localcd /usr/local/redis make && make install 常见报错 zmalloc.h:50:10: fatal error: jemalloc/jemal…