You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用Packer构建Homestead(Vagrant) Box?求后续步骤及替代方案

Step-by-Step Guide to Finish Building Laravel Homestead Box & Faster Alternatives

Finishing the Packer Build Process

You’ve already knocked out the first three key steps—here’s how to wrap up the Packer build smoothly:

  1. Switch to the bento directory
    From your Laravel Settler folder, navigate to the cloned chef/bento repository you set up earlier:

    cd ../bento
    
  2. Run the Packer build command
    Kick off the build using the modified Ubuntu 18.04 config file you edited:

    packer build ubuntu/ubuntu-18.04-amd64.json
    
    • Heads up: This will take 30+ minutes (depending on your internet speed) because it downloads the base Ubuntu image, runs all Homestead setup scripts, and packages the final box.
    • If you hit permission errors, double-check that scripts/homestead.sh (copied via copy-to-bento.sh) has executable permissions. Fix it quickly with:
      chmod +x scripts/homestead.sh
      
    • If the build fails mid-process, check the terminal logs for specific errors—common issues include flaky network connections or missing dependencies in the setup script.
  3. Add the finished box to Vagrant
    Once the build succeeds, you’ll see a .box file in the bento directory. Add it to your local Vagrant setup with:

    vagrant box add laravel/homestead path/to/your/generated.box
    

Faster Alternatives to Slow Vagrant Box Downloads

If building from source feels too tedious, here are simpler ways to get the Homestead box up quickly:

  • Use a local pre-built box file
    Find a trusted community mirror, download the .box file directly to your computer, then add it to Vagrant using the same command above (pointing to your local file path).

  • Add the box via a custom mirror URL
    Skip the default slow source by specifying a fast mirror URL when adding the box:

    vagrant box add laravel/homestead <fast-mirror-url>
    

    Just ensure the mirror hosts the correct Homestead box version for your project.

  • Leverage regional cloud provider images
    Many domestic cloud platforms host localized mirrors of popular Vagrant boxes. Search for "Laravel Homestead Vagrant mirror [your region]" to find a speedier option tailored to your location.

内容的提问来源于stack exchange,提问作者Dendi Handian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:14:04