zoukankan      html  css  js  c++  java
  • 通过Vagrant搭建PHP环境(一) Vagrant box添加配置

    系统Windows10

    Vagrant 1.8.1

    VirtualBox 5.0.20


    vagrant box下载地址:http://cloud.centos.org/centos/7/vagrant/x86_64/images/


    第一、添加vagrant box

    命令:vagrant box add 名称  box地址

    说明:box我放在了,f:/vagrant下所以cmd进入到f:/vagrant下,执行 vagrant box add centos7-x86_64-php7 ./CentOS-7-x86_64-Vagrant-1708_01.VirtualBox.box

    第二、执行初始化

    命令 vagrant init,这时会生成一个Vagrantfile文件,打开编辑下

    第三、启动vagrant

    命令 vagrant up

    可能会出现的问题

    1)"rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH.

    解决办法:打开C:UsersAdministrator.vagrant.doxescentos-6.7-x86_64-php7virtualboxVagrantfile

    Vagrant.configure("2") do |config|
      config.vm.base_mac = "5254007a695a"
      config.vm.synced_folder ".", "/vagrant", type: "rsync"
    end

    修改为:

    Vagrant.configure("2") do |config|
      config.vm.base_mac = "5254007a695a"
      config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
    end

    2)Failed to mount folders in Linux guest. This is usually because
    the "vboxsf" file system is not available. Please verify that
    the guest additions are properly installed in the guest and
    can work properly. The command attempted was:


    mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
    mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant


    The error output from the last command was:


    mount: unknown filesystem type 'vboxsf'

    解决办法:vagrant plugin install vagrant-vbguest

    到此,算是完成了vagrant box的安装。接下来就是配置开发环境了


    设置yum 源为阿里云

    由于默认的centos里面没有wget,所以先yum install wget

    第一步:备份你的原镜像文件,以免出错后可以恢复。

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

    第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/


    CentOS 5
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo


    CentOS 6
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


    CentOS 7

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


    更改CentOS-Media.repo使其为不生效:
    enabled=0


    第三步:运行yum makecache生成缓存
    yum clean all
    yum makecache



    原文:https://blog.csdn.net/sobeautiy/article/details/78020962

  • 相关阅读:
    2019牛客暑期多校训练营(第二场)
    2019牛客暑期多校训练营(第一场)
    JOISC2014 挂饰("01"背包)
    UPC 2019年第二阶段我要变强个人训练赛第十六场
    UPC个人训练赛第十五场(AtCoder Grand Contest 031)
    Wannafly挑战赛15 C“出队”(约瑟夫环类问题)
    UVA 133“The Dole Queue”(循环报数处理技巧)
    洛谷P1169 [ZJOI2007]棋盘制作 悬线法 动态规划
    洛谷P1273 有线电视网 树上分组背包DP
    CF1097D Makoto and a Blackboard 质因数分解 DP
  • 原文地址:https://www.cnblogs.com/lxwphp/p/11111816.html
Copyright © 2011-2022 走看看