zoukankan      html  css  js  c++  java
  • centos7上vagrant的安装及使用

    1、安装vagrant

    需要vagrant、virtualbox及vagrant需要使用的centos7.box(我这边需要用vagrant创建centos故下载了centos7.box)

    下载地址:

    #virtualbox
    https://www.virtualbox.org/wiki/Linux_Downloads
    
    #vagrant
    https://www.vagrantup.com/downloads.html
    
    #centos7.box
    http://cloud.centos.org/centos/7/vagrant/x86_64/images/

    2、安装

    从上边网站下载后的文件为:

    [root@k8s vagrant]# ls
    CentOS-7.box  vagrant_2.2.4_x86_64.rpm  VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm
    [root@k8s vagrant]# yum  -y  localinstall vagrant_2.2.4_x86_64.rpm  VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm

    安装依赖:

    vagrant依赖kernel-devel gcc make perl,启动kernel-devel最好按照vagrant的提示进行安装和正在使用内核版本一直的库(我这里通过uname -a查看内核版本,应该安装kernel-devel-3.10.0-957.el7.x86_64)

    [root@k8s vagrant]# yum install kernel-devel gcc make perl -y
    [root@k8s vagrant]# uname -a
    Linux k8s 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    [root@k8s vagrant]# yum install kernel-devel-3.10.0-957.el7.x86_64 -y

    3、使用

    #添加box文件,添加侯可以到处使用
    vagrant  box add  CentOS-7.box --name centos7
    #创建配置文件
    vagrant init centos7 #启动 vagrant up
    #进入虚拟机
    vagrant ssh

    tips:

    1、网络

    vagrant有三种网络模式,详见百度。使用私有网络和共有网络可以直接通过ssh+ip方式远程,但是必须要把下面的选项打开。

    2、新建的虚拟机通过私有网络ssh报错,无法登录

    因为sshd服务没有开启root允许和密码认证选项,在/etc/ssh/sshd_config中修改

    #允许root登录
    PermitRootLogin yes
    #允许密码登录
    PasswordAuthentication yes
  • 相关阅读:
    使用策略模式减少if else
    php 向二维数组中追加元素
    svn update 产生Node remains in conflict的问题
    php对ip地址的处理
    php 对比两个数组中的值是否相等
    jquery 通过attr获取属性只有一个值的解决
    php 一维数组去重
    调整ceph的pg数(pg_num, pgp_num)
    linux-Centos 7下bond与vlan技术的结合[推荐]
    centos 配置vlan
  • 原文地址:https://www.cnblogs.com/MakeInstall/p/11063523.html
Copyright © 2011-2022 走看看