当前位置: 首页 > news >正文

徐州建站网站模板唐山玉田网站建设

徐州建站网站模板,唐山玉田网站建设,设计素材网站哪个好用,郑州专门做网站的公司有哪些文章目录概述软件安装安装VirtualBox安装Vagrant配置环境用Vagrant创建一个VMVagrantfile文件配置常用命令概述 Vagrant是一个创建虚拟机的技术#xff0c;是用来创建和管理虚拟机的工具#xff0c;本身自己并不能创建管理虚拟机。创建和管理虚拟机必须依赖于其他的虚拟化技… 文章目录概述软件安装安装VirtualBox安装Vagrant配置环境用Vagrant创建一个VMVagrantfile文件配置常用命令概述 Vagrant是一个创建虚拟机的技术是用来创建和管理虚拟机的工具本身自己并不能创建管理虚拟机。创建和管理虚拟机必须依赖于其他的虚拟化技术的产品例如Virtualbox、AWS、Docker等。可以更方便的创建虚拟机对虚拟机进行管理。 软件安装 安装VirtualBox VirtualBox是一款开源虚拟机软件。使用者可以在 VirtualBox 上安装并且执行 Solaris、Windows、DOS、Linux、OS/2 Warp、BSD 等系统作为客户端操作系统。 VirtualBox下载链接 安装Vagrant Vagrant 是一款虚拟机管理工具Vagrant 支持管理多种虚拟化管理工具的虚拟机。可以帮助用户快速启动和配置 VirtualBoxVMware Workstation 等虚拟化工具的虚拟机实例。 Vagrant下载 找到自己对应的系统版本下载安装即可 配置环境 如果你的系统盘的磁盘空间不够大最好在安装完成 Vagrant 后更改Vagrant 的虚拟机镜像存放目录和更改VirtualBox的虚拟机存放路径 配置Vagrant 找到电脑的环境变量设置将默认的vagrant镜像文件路径改为其他盘默认的文件夹为C:\Users\xxx\.vagrant.d.在用户变量或系统变量下选择新建。 用户变量只在本用户生效系统变量在整个系统中生效全部用户 这里我指定的是D:.vagrant.d 配置VirtualBox 启动 VirtualBox 后通过菜单 管理 - 全局设定或者按下快捷键 Ctrl g在全局设定对话框中修改默认虚拟电脑位置指定一个容量较大的磁盘。 用Vagrant创建一个VM 使用 Vagrant 创建虚机时需要指定一个镜像也就是 box。开始这个 box 不存在所以 Vagrant 会先从网上下载然后缓存在本地目录中。 也可以用其他操作系统 在 Vagrant Cloud上有各种虚拟机镜像可以下载。这里以Ubuntu Server 20.04作为演示其他镜像也就是box操作原理相同 启动 PowerShell寻找合适的位置新建文件夹用来存放box的配置文件Vagrantfile 初始Vagrant配置文件 执行vagrant init初始化配置生成Vagrantfile文件 vagrant init peru/ubuntu-20.04-server-amd64其中的peru/ubuntu-20.04-server-amd64就是我们要使用的box名字init指令之后会从网上拉取镜像如果下载过慢可以使用国内镜像站点清华开源软件镜像站 使用以下指令vagrant box add [box名] 文件路径|url|中央仓库镜像 Vagrant初始化时默认创建的虚拟机的网卡使用 NAT 方式。要想能够获得一个本地局域网的动态 IP 地址在初始化box的文件夹中执行 notepad .\Vagrantfile文件内容如下 # -- mode ruby -- # vi set ftruby # All Vagrant configuration is done below. The 2 in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please dont change it unless you know what # youre 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.config.vm.box peru/ubuntu-20.04-server-amd64# 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.33.10# 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# 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 machine# vb.gui true## # Customize the amount of memory on the VM:# vb.memory 1024# end## 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将上图所标注的代码注释取消 启动 Ubuntu Sever 20.04 VM在存放box对于的配置文件目录下执行 vagrant up下图表示启动成功. 账户密码默认为vagrant Vagrantfile文件配置 config.vm.box该名称为box系统镜像名 config.vm.hostname配置虚拟机主机名 config.vm.network这是配置虚拟机网络由于比较复杂我们其后单独讨论 config.vm.synced_folder除了默认的目录绑定外还可以手动指定绑定 config.ssh.username默认的用户是vagrant从官方下载的box往往使用的是这个用户名。如果是自定制的box所使用的用户名可能会有所不同通过这个配置设定所用的用户名。 config.vm.provision我们可以通过这个配置在虚拟机第一次启动的时候进行一些安装配置 常用命令 查看Vagrant版本 vagrant --version查看虚机的状态 vagrant status指定目录下通过ssh连接虚拟机 vagrant ssh关闭虚拟机 直接在 VirtualBox 上关闭虚机或者直接在虚机内部执行 poweroff 命令也都是可以的。 vagrant halt暂停虚拟机 vagrant suspend恢复虚拟机 vagrant resume重载虚拟机 执行下面的命令会重启虚机并且重新加载 Vagrantfile 中的配置信息 vagrant reload删除虚拟机 vagrant destroy查看vagrant下所有box列表box名) vagrant box list删除相应的box vagrant box remove box名初始化box的操作会生成vagrant的配置文件Vagrantfile vagrant init box名通过ssh登录本地环境所在虚拟机前提是已经开启 vagrant ssh [box名]输出用于 ssh 连接的一些信息 vagrant ssh-config
http://www.w-s-a.com/news/606834/

相关文章:

  • 个人网站模板html下载餐饮vi设计案例欣赏
  • 高端网站建设wanghess网站开发售后服务承诺
  • 江西网站建设费用企业网站推广的方法有( )
  • 中国十大网站开发公司企业网站建设的要素有哪些
  • 网站防站做网站吉林
  • 嘉定区网站建设公司企业信息公示查询系统官网
  • 一个具体网站的seo优化产品介绍网站模板下载地址
  • 怎么做网站在网上能搜到你哈尔滨网站建立公司
  • 做家旅游的视频网站上海百度公司总部
  • 微信小程序公司网站怎么制作区块链平台定制开发
  • 网站资质优化ip地址域名解析
  • 如何搭建个人网站ps做网站首页怎么运用起来
  • 中小企业商务网站建设wordpress 安全加固
  • asp网站开发设计文档php建设网站怎么用
  • 服装公司网站建设需求分析报告seo搜索引擎优化实战
  • wordpress 扒站最近最新新闻
  • 手机wap网站开发与设计wordpress域名无法访问
  • 百度收录网站收费吗做网站用vs还是dw
  • 维度网络专业做网站嘉兴网站建设方案服务
  • 成品电影网站建设中国最顶尖设计师
  • 网站建设报价清单明细视频网站如何做营销
  • 建设农业网站的论文做国外网站有哪些
  • 怎么做网页 网站制作张家港网站制作哪家好
  • 创世网站建设公司书籍封面设计网站
  • 国外优秀网站设计欣赏小程序推广赚佣金
  • 徐州人才网官方网站邯郸seo优化公司
  • 海南响应式网站建设哪里好瑞安电影城网站建设
  • wordpress widgetkit济南优化网站厂家
  • 麦片网站建设佛山短视频推广渠道
  • 免费自助建网站销售的网络建设