search
HomeBackend DevelopmentPHP TutorialHomestead 安装需要知道的一些信息

本文经授权转自 PHPHub 社区

链接

  • Homestead 环境部署脚本 - 使用此脚本来构造 Homestead box 的
  • Homestead 主项目 repo - Homestea 是一个 Vagrant 项目
  • Homestead 文档
  • Vagrant 的盒子相关操作文档
  • Homestead 所有版本列表
  • 百度盘 Homestead 主要版本下载

Homestead Box 版本

默认使用命令:

vagrant box add laravel/homestead

安装的盒子是最新版本,如当前最新版本的 Homestead 为 v0.4.4。

Laravel 社区对新技术保持比较开放的姿态,所以 Homestead 的最新版一般都使用比较新的软件,如 PHP7,推崇 HHVM,MYSQL 5.7 等。

如果你因特殊原因,想使用老版本的话,如项目需要使用 PHP5.6(v0.3.3 版本)。

Homestead 的所有 box 版本信息:https://atlas.hashicorp.com/laravel/boxes/homestead/

下载指定版本的命令:

$ vagrant box add laravel/homestead --box-version=0.3.3$ vagrant box add laravel/homestead --box-version=0.2.7

file

上面的几个版本可前往百度盘下载:http://pan.baidu.com/s/1hrN55w4

下载加速

国内因为网络的原因,默认的盒子安装命令 vagrant box add laravel/homestead 变得不适用。

你可以使用以下方法来加速下载和添加盒子。

1. 下载链接

首先获取盒子最终下载链接:

然后就可以使用第三方多线程,支持断点续传的工具进行下载了。

注意,请勿使用迅雷离线下载,亲测下载后的文件会损坏。

我把目前几个大版本下载上传到百度盘,可前往下载 -> http://pan.baidu.com/s/1o7KB2ZK 。

附上文件的 CheckSum:

➜  Boxes openssl sha1 homestead-virtualbox-0.2.7.boxSHA1(homestead-virtualbox-0.2.7.box)= 76e67b203a39f77d617ad9ed00d2aec0c79e7680➜  Boxes openssl sha1 homestead-virtualbox-0.4.4.boxSHA1(homestead-virtualbox-0.4.4.box)= 059821e503c5441e9243edd687e061e5ce0a1bec➜  Boxes openssl sha1 homestead-virtualbox-0.3.3.boxSHA1(homestead-virtualbox-0.3.3.box)= 41967c26e7fd8b0fae84c3ecbd0e4058c0ab2bb1

2. 导入盒子

下载下来的 .box 文件,可以使用以下方法导入:

在 .box 的同文件夹下创建一个 metadata.json 文件,内容为以下

{    "name": "laravel/homestead",    "versions":     [        {            "version": "0.4.4",            "providers": [                {                  "name": "virtualbox",                  "url": "homestead-virtualbox-0.4.4.box"                }            ]        }    ]}

字段说明

  • version - 可以指定当前盒子导入的版本标示;
  • url - 支持 绝对文件路径相对文件路径

运行以下命令导入:

vagrant box add metadata.json

运行 list 命令查看是否添加成功:

vagrant box list

操作截图:

file

感谢 @solarhell 提供的此方法,他的博文 - 使用Homestead搭建开发环境。

Homestead 版本

所有的 homestead 历史版本可以在这里看到:https://github.com/laravel/homestead/releases 。

使用以下命令可查看 homestead 版本:

$ homestead -versionLaravel Homestead version 2.2.1

安装 homestead 特定版本:

$ composer global require "laravel/homestead:~2.2.0"

删除 homestead 之前的版本,然后使用最新版本:

$ composer global remove laravel/homestead$ composer global clear-cache$ composer global require laravel/homestead$ vagrant destroy && vagrant up
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Dependency Injection in PHP: Avoiding Common PitfallsDependency Injection in PHP: Avoiding Common PitfallsMay 16, 2025 am 12:17 AM

DependencyInjection(DI)inPHPenhancescodeflexibilityandtestabilitybydecouplingdependencycreationfromusage.ToimplementDIeffectively:1)UseDIcontainersjudiciouslytoavoidover-engineering.2)Avoidconstructoroverloadbylimitingdependenciestothreeorfour.3)Adhe

How to Speed Up Your PHP Website: Performance TuningHow to Speed Up Your PHP Website: Performance TuningMay 16, 2025 am 12:12 AM

ToimproveyourPHPwebsite'sperformance,usethesestrategies:1)ImplementopcodecachingwithOPcachetospeedupscriptinterpretation.2)Optimizedatabasequeriesbyselectingonlynecessaryfields.3)UsecachingsystemslikeRedisorMemcachedtoreducedatabaseload.4)Applyasynch

Sending Mass Emails with PHP: Is it Possible?Sending Mass Emails with PHP: Is it Possible?May 16, 2025 am 12:10 AM

Yes,itispossibletosendmassemailswithPHP.1)UselibrarieslikePHPMailerorSwiftMailerforefficientemailsending.2)Implementdelaysbetweenemailstoavoidspamflags.3)Personalizeemailsusingdynamiccontenttoimproveengagement.4)UsequeuesystemslikeRabbitMQorRedisforb

What is the purpose of Dependency Injection in PHP?What is the purpose of Dependency Injection in PHP?May 16, 2025 am 12:10 AM

DependencyInjection(DI)inPHPisadesignpatternthatachievesInversionofControl(IoC)byallowingdependenciestobeinjectedintoclasses,enhancingmodularity,testability,andflexibility.DIdecouplesclassesfromspecificimplementations,makingcodemoremanageableandadapt

How to send an email using PHP?How to send an email using PHP?May 16, 2025 am 12:03 AM

The best ways to send emails using PHP include: 1. Use PHP's mail() function to basic sending; 2. Use PHPMailer library to send more complex HTML mail; 3. Use transactional mail services such as SendGrid to improve reliability and analysis capabilities. With these methods, you can ensure that emails not only reach the inbox, but also attract recipients.

How to calculate the total number of elements in a PHP multidimensional array?How to calculate the total number of elements in a PHP multidimensional array?May 15, 2025 pm 09:00 PM

Calculating the total number of elements in a PHP multidimensional array can be done using recursive or iterative methods. 1. The recursive method counts by traversing the array and recursively processing nested arrays. 2. The iterative method uses the stack to simulate recursion to avoid depth problems. 3. The array_walk_recursive function can also be implemented, but it requires manual counting.

What are the characteristics of do-while loops in PHP?What are the characteristics of do-while loops in PHP?May 15, 2025 pm 08:57 PM

In PHP, the characteristic of a do-while loop is to ensure that the loop body is executed at least once, and then decide whether to continue the loop based on the conditions. 1) It executes the loop body before conditional checking, suitable for scenarios where operations need to be performed at least once, such as user input verification and menu systems. 2) However, the syntax of the do-while loop can cause confusion among newbies and may add unnecessary performance overhead.

How to hash strings in PHP?How to hash strings in PHP?May 15, 2025 pm 08:54 PM

Efficient hashing strings in PHP can use the following methods: 1. Use the md5 function for fast hashing, but is not suitable for password storage. 2. Use the sha256 function to improve security. 3. Use the password_hash function to process passwords to provide the highest security and convenience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.