vagrant安装laravel

vagrant box add homestead ./homestead.box
vagrant init homestead
vagrant up
vagrant       --version 1.9.1
virtual-box   --version 5.1.14
homestead     --version 0.2.6  --link https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.6/providers/virtualbox.box

修改配置

Vagrant.configure("2") do |config|
 config.vm.box = "homestead"
  config.vm.hostname = "homestead"
  config.vm.synced_folder  "E:/wamp/www/laravel", "/var/www/html"
  config.vm.network :private_network, ip: "192.168.3.138"
  config.vm.provider "virtualbox" do |vb|
     vb.memory = "1024"
     vb.cpus = 2
     vb.name = "homestead_vm"
 end

修改composer中国镜像
方法一: 修改 composer 的全局配置文件(推荐方式)

打开命令行窗口(windows用户)或控制台(Linux、Mac 用户)并执行如下命令:
composer config -g repo.packagist composer https://packagist.phpcomposer.com

方法二: 修改当前项目的 composer.json 配置文件:

打开命令行窗口(windows用户)或控制台(Linux、Mac 用户),进入你的项目的根目录(也就是 composer.json 文件所在目录),执行如下命令:

composer config repo.packagist composer https://packagist.phpcomposer.com
上述命令将会在当前项目中的 composer.json 文件的末尾自动添加镜像的配置信息(你也可以自己手工添加):

"repositories": {
    "packagist": {
        "type": "composer",
        "url": "https://packagist.phpcomposer.com"
    }
}

以 laravel 项目的 composer.json 配置文件为例,执行上述命令后如下所示(注意最后几行):

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*"
    },
    "config": {
        "preferred-install": "dist"
    },
    "repositories": {
        "packagist": {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    }
}

OK,一切搞定!试一下 composer install 来体验飞一般的速度吧!

你可能感兴趣的:(vagrant安装laravel)