【ElasticSearch从零开始第00章】-环境准备部署centos7

安装说明

和大家说明一下,我们的目的仅仅是要安装一个centos7,然后在centos7上部署ElasticSearch
如果搞不定vagrant+virtualbox的方式,可以直接使用VM搭建一个centos7或者使用一台云服务器安装centos7
我们的目的只是为了得到一个centos7的机器,所以不必花太多精力在这个环境问题上折腾

我使用的环境是
【
    win11 64位
    VirtualBox-6.1.32-149290-Win
    vagrant_2.2.19_x86_64.msi
    virtualbox.box
】

环境软件网盘地址
链接:https://pan.baidu.com/s/1GZPqufc3g9Mv7KqaiL4rgQ?pwd=sxz4 
提取码:sxz4 

安装步骤

安装centos7

01 创建centos7文件夹,并进入其中[目录全路径不要有中文字符],我的目录是D:\centos7

02 将virtualbox.box文件添加到vagrant管理的镜像中
	(1)下载网盘中的virtualbox.box文件
    (2)保存到磁盘的某个目录,比如D:\centos7\virtualbox.box
    (3)添加镜像并起名叫centos/7:vagrant box add centos/7 D:\centos7\virtualbox.box
    (4)vagrant box list  查看本地的box[这时候可以看到centos/7]

03 在此目录下打开cmd,运行vagrant init centos/7
   此时会在当前目录下生成Vagrantfile,同时指定使用的镜像为centos/7
    
04 centos/7镜像有了,根据Vagrantfile文件启动创建虚拟机【Vagrantfile脚本见下面】
	来到centos7文件夹,在此目录打开cmd窗口,执行vagrant up [打开virtual box观察,可以发现centos7创建成功]
	
05 以后大家操作虚拟机,还是要在centos文件夹打开cmd窗口操作
	vagrant halt   优雅关闭
	vagrant up     正常启动
	
06 vagrant常用命令
	(1)vagrant ssh    
    	进入刚才创建的centos7中
    (2)vagrant status
    	查看centos7的状态
    (3)vagrant halt
    	停止/关闭centos7
    (4)vagrant destroy
    	删除centos7
    (5)vagrant status
    	查看当前vagrant创建的虚拟机
    (6)Vagrantfile中也可以写脚本命令,使得centos7更加丰富
    	但是要注意,修改了Vagrantfile,要想使正常运行的centos7生效,必须使用vagrant reload

修改Vagrantfile文件

单个虚拟机

# -*- 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.
  config.vm.box = "centos/7"

  # 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 ma
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值