イントロダクションIntroduction
Laravelはローカル開発環境を含め、PHP開発体験全体を楽しいものにするよう努めています。Laravel Homesteadは、PHP、Webサーバ、その他のサーバソフトウェアをローカルマシンにインストールしなくても、すばらしい開発環境を提供する公式のパッケージ済みVagrantボックスです。Laravel strives to make the entire PHP development experience delightful, including your local development environment. Laravel Homestead[https://github.com/laravel/homestead] is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, or any other server software on your local machine.
Vagrantは、仮想マシンを管理およびプロビジョニングするためのシンプルでエレガントな方法を提供しています。Vagrantボックスは完全に使い捨てです。何か問題が発生した場合は、数分でボックスを破棄して再作成できます。Vagrant[https://www.vagrantup.com] provides a simple, elegant way to manage and provision Virtual Machines. Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
Homesteadは、Windows、macOS、Linuxシステムで実行でき、Nginx、PHP、MySQL、PostgreSQL、Redis、Memcached、Node、その他すばらしいLaravelアプリケーションの開発に必要なすべてのソフトウェアを含んでいます。Homestead runs on any Windows, macOS, or Linux system and includes Nginx, PHP, MySQL, PostgreSQL, Redis, Memcached, Node, and all of the other software you need to develop amazing Laravel applications.
[!WARNING]
Warning! Windowsを使用している場合は、ハードウェア仮想化(VT-x)を有効にする必要があります。通常、BIOSにより有効にできます。UEFI system上のHyper-Vを使用している場合は、VT-xへアクセスするため、さらにHyper-Vを無効にする必要があります。
If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS. If you are using Hyper-V on a UEFI system you may additionally need to disable Hyper-V in order to access VT-x.
含んでいるソフトウェアIncluded Software
- Ubuntu 22.04Ubuntu 22.04
- GitGit
- PHP 8.3PHP 8.3
- PHP 8.2PHP 8.2
- PHP 8.1PHP 8.1
- PHP 8.0PHP 8.0
- PHP 7.4PHP 7.4
- PHP 7.3PHP 7.3
- PHP 7.2PHP 7.2
- PHP 7.1PHP 7.1
- PHP 7.0PHP 7.0
- PHP 5.6PHP 5.6
- NginxNginx
- MySQL 8.0MySQL 8.0
- lmmlmm
- Sqlite3Sqlite3
- PostgreSQL 15PostgreSQL 15
- ComposerComposer
- DockerDocker
- Node (Yarn、Bower、Bower、Grunt、Gulpを含む)Node (With Yarn, Bower, Grunt, and Gulp)
- RedisRedis
- MemcachedMemcached
- BeanstalkdBeanstalkd
- MailpitMailpit
- avahiavahi
- ngrokngrok
- XdebugXdebug
- XHProf / Tideways / XHGuiXHProf / Tideways / XHGui
- wp-cliwp-cli
オプションのソフトウェアOptional Software
- ApacheApache
- BlackfireBlackfire
- CassandraCassandra
- ChronografChronograf
- CouchDBCouchDB
- CrystalとLuckyフレームワークCrystal & Lucky Framework
- ElasticsearchElasticsearch
- EventStoreDBEventStoreDB
- FlywayFlyway
- GearmanGearman
- GoGo
- GrafanaGrafana
- InfluxDBInfluxDB
- LogstashLogstash
- MariaDBMariaDB
- MeilisearchMeilisearch
- MinIOMinIO
- MongoDBMongoDB
- Neo4jNeo4j
- Oh My ZshOh My Zsh
- Open RestyOpen Resty
- PM2PM2
- PythonPython
- RR
- RabbitMQRabbitMQ
- RustRust
- RVM(Rubyバージョンマネージャ)RVM (Ruby Version Manager)
- SolrSolr
- TimescaleDBTimescaleDB
- Trader(PHP拡張)Trader (PHP extension)
- WebdriverとLaravel DuskユーティリティWebdriver & Laravel Dusk Utilities
インストールと設定Installation and Setup
最初の段階First Steps
Homestead環境を起動する前に、Vagrantと、サポートいている以下のプロバイダのいずれかをインストールする必要があります。Before launching your Homestead environment, you must install Vagrant[https://developer.hashicorp.com/vagrant/downloads] as well as one of the following supported providers:
- VirtualBox 6.1.xVirtualBox 6.1.x[https://www.virtualbox.org/wiki/Download_Old_Builds_6_1]
- ParallelsParallels[https://www.parallels.com/products/desktop/]
これらすべてのソフトウェアパッケージは、人気のあるすべてのオペレーティングシステムへ使いやすいビジュアルインストーラを提供します。All of these software packages provide easy-to-use visual installers for all popular operating systems.
Parallelsプロバイダを使用するには、Parallels Vagrantプラグインをインストールする必要があります。これは無料です。To use the Parallels provider, you will need to install Parallels Vagrant plug-in[https://github.com/Parallels/vagrant-parallels]. It is free of charge.
HomesteadのインストールInstalling Homestead
ホストマシンへリポジトリをクローンし、Homesteadをインストールできます。自分の「ホーム」ディレクトリの中のHomestead
フォルダへリポジトリをクローンするのことは、自分の全LaravelアプリケーションをホストしておくHomestead仮想マシンを用意するのだと考えてください。当ドキュメントでは、このディレクトリを「Homesteadディレクトリ」と呼びます。You
may
install
Homestead
by
cloning
the
Homestead
repository
onto
your
host
machine.
Consider
cloning
the
repository
into
a
Homestead
folder
within
your
"home"
directory,
as
the
Homestead
virtual
machine
will
serve
as
the
host
to
all
of
your
Laravel
applications.
Throughout
this
documentation,
we
will
refer
to
this
directory
as
your
"Homestead
directory":
git clone https://github.com/laravel/homestead.git ~/Homestead
Laravel
Homesteadリポジトリのクローンを作成したら、release
ブランチをチェックアウトする必要があります。このブランチには、Homesteadの最新の安定版リリースが常に含まれます。After
cloning
the
Laravel
Homestead
repository,
you
should
checkout
the
release
branch.
This
branch
always
contains
the
latest
stable
release
of
Homestead:
cd ~/Homestead
git checkout release
次に、Homesteadディレクトリでbash
init.sh
コマンドを実行し、Homestead.yaml
設定ファイルを作成します。Homestead.yaml
ファイルは、Homesteadインストールのすべてを設定する場所です。このファイルは、Homesteadディレクトリに配置されます。Next,
execute
the
bash
init.sh
command
from
the
Homestead
directory
to
create
the
Homestead.yaml
configuration
file.
The
Homestead.yaml
file
is
where
you
will
configure
all
of
the
settings
for
your
Homestead
installation.
This
file
will
be
placed
in
the
Homestead
directory:
# macOS/Linux
bash init.sh
# Windows
init.bat
Homestead設定Configuring Homestead
プロバイダの設定Setting Your Provider
Homestead.yaml
ファイル中のprovider
キーは、Vagrantのプロバイダとして、virtualbox
、parallels
のどちらを使用するかを指定します。The
provider
key
in
your
Homestead.yaml
file
indicates
which
Vagrant
provider
should
be
used:
virtualbox
or
parallels
:
provider: virtualbox
[!WARNING]
Warning! Apple Siliconを使用する場合は、Parallelsプロバイダが必要です。
If you are using Apple Silicon the Parallels provider is required.
共有フォルダの設定Configuring Shared Folders
Homestead.yaml
ファイルのfolders
プロパティには、Homestead環境と共有したい全フォルダがリストされています。これらのフォルダの中のファイルが変更されると、ローカルマシンとHomestead仮想環境との間で同期されます。必要なだけ共有フォルダを設定してください!The
folders
property
of
the
Homestead.yaml
file
lists
all
of
the
folders
you
wish
to
share
with
your
Homestead
environment.
As
files
within
these
folders
are
changed,
they
will
be
kept
in
sync
between
your
local
machine
and
the
Homestead
virtual
environment.
You
may
configure
as
many
shared
folders
as
necessary:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
Warning! Windowsユーザーはパスを
~/
記法を使わず、代わりにたとえばC:\Users\user\Code\project1
のように、プロジェクトのフルパスを使ってください。[!WARNING]
Windows users should not use the~/
path syntax and instead should use the full path to their project, such asC:\Users\user\Code\project1
.
すべてのアプリケーションを含む単一の大きなディレクトリをマッピングするのではなく、常に個々のアプリケーションを独自のフォルダマッピングにマッピングする必要があります。フォルダをマップするとき、仮想マシンはフォルダ内のすべてのファイルのすべてのディスクIOを追跡する必要があります。フォルダ内に多数のファイルがある場合、パフォーマンスの下する可能性があります。You should always map individual applications to their own folder mapping instead of mapping a single large directory that contains all of your applications. When you map a folder, the virtual machine must keep track of all disk IO for every file in the folder. You may experience reduced performance if you have a large number of files in a folder:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
- map: ~/code/project2
to: /home/vagrant/project2
Warning! Homesteadを使用する場合、
.
(カレントディレクトリ)をマウントしないでください。そうすると、Vagrantはカレントフォルダを/vagrant
へマップしない状況が起き、オプションの機能が壊れ、プロビジョン中に予期せぬ結果が起きます。[!WARNING]
You should never mount.
(the current directory) when using Homestead. This causes Vagrant to not map the current folder to/vagrant
and will break optional features and cause unexpected results while provisioning.
NFSを有効にするには、フォルダのマッピングでtype
オプションを付けます。To
enable
NFS[https://developer.hashicorp.com/vagrant/docs/synced-folders/nfs],
you
may
add
a
type
option
to
your
folder
mapping:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
type: "nfs"
vagrant-winnfsdプラグインのインストールを考慮すべきでしょう。このプラグインは、Homestead仮想マシン下のファイルとディレクトリのユーザー/グループパーミッションを正しく維持します。[!WARNING]
Warning! Windows上でNFSを使用する場合は、
When using NFS on Windows, you should consider installing the vagrant-winnfsd[https://github.com/winnfsd/vagrant-winnfsd] plug-in. This plug-in will maintain the correct user / group permissions for files and directories within the Homestead virtual machine.
さらに、Vagrantの同期フォルダでサポートされている任意のオプションを、options
キーの下に列挙して渡すことができます。You
may
also
pass
any
options
supported
by
Vagrant's
Synced
Folders[https://developer.hashicorp.com/vagrant/docs/synced-folders/basic_usage]
by
listing
them
under
the
options
key:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
type: "rsync"
options:
rsync__args: ["--verbose", "--archive", "--delete", "-zz"]
rsync__exclude: ["node_modules"]
Nginxサイトの設定Configuring Nginx Sites
Nginxには詳しくない?
問題ありません。Homestead.yaml
ファイルのsites
プロパティでHomestead環境上のフォルダと「ドメイン」を簡単にマップできます。サイト設定のサンプルは、Homestead.yaml
ファイルに含まれています。これも必要に応じ、Homestead環境へサイトを好きなだけ追加してください。便利に使えるよう、Homesteadは皆さんが作業するすべてのLaravelアプリケーションの仮想環境を提供します。Not
familiar
with
Nginx?
No
problem.
Your
Homestead.yaml
file's
sites
property
allows
you
to
easily
map
a
"domain"
to
a
folder
on
your
Homestead
environment.
A
sample
site
configuration
is
included
in
the
Homestead.yaml
file.
Again,
you
may
add
as
many
sites
to
your
Homestead
environment
as
necessary.
Homestead
can
serve
as
a
convenient,
virtualized
environment
for
every
Laravel
application
you
are
working
on:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
sites
プロパティをHomestead仮想環境のプロビジョニング後に変更した場合、仮想マシンのNginx設定を更新するため、vagrant
reload
--provision
をターミナルで実行する必要があります。If
you
change
the
sites
property
after
provisioning
the
Homestead
virtual
machine,
you
should
execute
the
vagrant
reload
--provision
command
in
your
terminal
to
update
the
Nginx
configuration
on
the
virtual
machine.
Warning! Homesteadのスクリプトは可能な限り冪等性を保つように組まれています。しかしながら、プロビジョニング中に問題が起きたら、
vagrant destroy && vagrant up
コマンドを実行し、マシンを壊してから、再構築してください。[!WARNING]
Homestead scripts are built to be as idempotent as possible. However, if you are experiencing issues while provisioning you should destroy and rebuild the machine by executing thevagrant destroy && vagrant up
command.
ホスト名の解決Hostname Resolution
Homesteadは、自動ホスト解決のためにmDNS
を使用してホスト名を公開します。Homestead.yaml
ファイルでhostname:
homestead
を設定すると、ホストはhomestead.local
で利用できるようになります。macOS、iOS、およびLinuxデスクトップディストリビューションには、デフォルトで「mDNS」サポートが含まれています。Windowsを使用している場合は、Bonjour
Print
Services
for
Windowsをインストールする必要があります。Homestead
publishes
hostnames
using
mDNS
for
automatic
host
resolution.
If
you
set
hostname:
homestead
in
your
Homestead.yaml
file,
the
host
will
be
available
at
homestead.local
.
macOS,
iOS,
and
Linux
desktop
distributions
include
mDNS
support
by
default.
If
you
are
using
Windows,
you
must
install
Bonjour
Print
Services
for
Windows[https://support.apple.com/kb/DL999?viewlocale=en_US&locale=en_US].
自動ホスト名の使用は、Homesteadのプロジェクトごとのインストールに最適です。1つのHomesteadインスタンスで複数のサイトをホストしている場合は、Webサイトの「ドメイン」をマシンのhosts
ファイルに追加できます。hosts
ファイルは、HomesteadサイトへのリクエストをHomestead仮想マシンにリダイレクトします。macOSおよびLinuxでは、このファイルは/etc/hosts
にあります。Windowsでは、C:\Windows\System32\drivers\etc\hosts
にあります。このファイルに追加する行は次のようになります。Using
automatic
hostnames
works
best
for
per
project
installations[#per-project-installation]
of
Homestead.
If
you
host
multiple
sites
on
a
single
Homestead
instance,
you
may
add
the
"domains"
for
your
web
sites
to
the
hosts
file
on
your
machine.
The
hosts
file
will
redirect
requests
for
your
Homestead
sites
into
your
Homestead
virtual
machine.
On
macOS
and
Linux,
this
file
is
located
at
/etc/hosts
.
On
Windows,
it
is
located
at
C:\Windows\System32\drivers\etc\hosts
.
The
lines
you
add
to
this
file
will
look
like
the
following:
192.168.56.56 homestead.test
設定するIPアドレスにはHomestead.yaml
ファイルの中の値を確実に指定してください。ドメインをhosts
ファイルへ追加したら、Webブラウザでサイトにアクセスできます。Make
sure
the
IP
address
listed
is
the
one
set
in
your
Homestead.yaml
file.
Once
you
have
added
the
domain
to
your
hosts
file
and
launched
the
Vagrant
box
you
will
be
able
to
access
the
site
via
your
web
browser:
http://homestead.test
サービスの設定Configuring Services
Homesteadはデフォルトでいくつかのサービスを開始します。ただし、プロビジョニング中に有効/無効にするサービスをカスタマイズできます。たとえば、Homestead.yaml
ファイル内のservices
オプションを変更することで、PostgreSQLを有効にし、MySQLを無効にできます。Homestead
starts
several
services
by
default;
however,
you
may
customize
which
services
are
enabled
or
disabled
during
provisioning.
For
example,
you
may
enable
PostgreSQL
and
disable
MySQL
by
modifying
the
services
option
within
your
Homestead.yaml
file:
services:
- enabled:
- "postgresql"
- disabled:
- "mysql"
指定したサービスは、enabled
およびdisabled
ディレクティブの順序に基づいて開始または停止されます。The
specified
services
will
be
started
or
stopped
based
on
their
order
in
the
enabled
and
disabled
directives.
Launching the Vagrant BoxLaunching the Vagrant Box
Homestead.yaml
のリンクを編集終えたら、Homesteadディレクトリでvagrant
up
コマンドを実行してください。Vagrantは仮想マシンを起動し、共有フォルダとNginxサイトを自動的に設定します。Once
you
have
edited
the
Homestead.yaml
to
your
liking,
run
the
vagrant
up
command
from
your
Homestead
directory.
Vagrant
will
boot
the
virtual
machine
and
automatically
configure
your
shared
folders
and
Nginx
sites.
仮想マシンを破壊するには、vagrant
destroy
コマンドを使用します。To
destroy
the
machine,
you
may
use
the
vagrant
destroy
command.
プロジェクトごとにインストールPer Project Installation
Homesteadをグローバルにインストールし、全プロジェクトで同じHomestead仮想環境を共有する代わりに、Homesteadインスタンスを管理下のプロジェクトごとに設定することもできます。プロジェクトごとにHomesteadをインストールする利点は、Vagrantfile
をプロジェクトに用意すれば、プロジェクトに参加している他の人達も、プロジェクトのリポジトリをクローンしたあとにvagrant
up
ですぐに仕事にとりかかれることです。Instead
of
installing
Homestead
globally
and
sharing
the
same
Homestead
virtual
machine
across
all
of
your
projects,
you
may
instead
configure
a
Homestead
instance
for
each
project
you
manage.
Installing
Homestead
per
project
may
be
beneficial
if
you
wish
to
ship
a
Vagrantfile
with
your
project,
allowing
others
working
on
the
project
to
vagrant
up
immediately
after
cloning
the
project's
repository.
Composerパッケージマネージャを使用して、Homesteadをプロジェクトにインストールできます。You may install Homestead into your project using the Composer package manager:
composer require laravel/homestead --dev
Homesteadをインストールしたら、Homesteadのmake
コマンドを呼び出して、プロジェクトのVagrantfile
ファイルとHomestead.yaml
ファイルを生成します。これらのファイルは、プロジェクトのルートに配置されます。make
コマンドは、Homestead.yaml
ファイルのsites
およびfolders
ディレクティブを自動的に構成します。Once
Homestead
has
been
installed,
invoke
Homestead's
make
command
to
generate
the
Vagrantfile
and
Homestead.yaml
file
for
your
project.
These
files
will
be
placed
in
the
root
of
your
project.
The
make
command
will
automatically
configure
the
sites
and
folders
directives
in
the
Homestead.yaml
file:
# macOS/Linux
php vendor/bin/homestead make
# Windows
vendor\\bin\\homestead make
次にvagrant
up
コマンドを端末で実行し、ブラウザでhttp://homestead.test
のプロジェクトへアクセスしてください。自動ホスト名解決を使わない場合は、/etc/hosts
ファイルにhomestead.test
か、自分で選んだドメインのエントリーを追加する必要があることを忘れないでください。Next,
run
the
vagrant
up
command
in
your
terminal
and
access
your
project
at
http://homestead.test
in
your
browser.
Remember,
you
will
still
need
to
add
an
/etc/hosts
file
entry
for
homestead.test
or
the
domain
of
your
choice
if
you
are
not
using
automatic
hostname
resolution[#hostname-resolution].
オプション機能のインストールInstalling Optional Features
オプションのソフトウェアは、Homestead.yaml
ファイル内のfeatures
オプションを使用してインストールします。ほとんどの機能は論理値で有効/無効にしますが、一部の機能は複数の構成オプションを使用できます。Optional
software
is
installed
using
the
features
option
within
your
Homestead.yaml
file.
Most
features
can
be
enabled
or
disabled
with
a
boolean
value,
while
some
features
allow
multiple
configuration
options:
features:
- blackfire:
server_id: "server_id"
server_token: "server_value"
client_id: "client_id"
client_token: "client_value"
- cassandra: true
- chronograf: true
- couchdb: true
- crystal: true
- dragonflydb: true
- elasticsearch:
version: 7.9.0
- eventstore: true
version: 21.2.0
- flyway: true
- gearman: true
- golang: true
- grafana: true
- influxdb: true
- logstash: true
- mariadb: true
- meilisearch: true
- minio: true
- mongodb: true
- neo4j: true
- ohmyzsh: true
- openresty: true
- pm2: true
- python: true
- r-base: true
- rabbitmq: true
- rustc: true
- rvm: true
- solr: true
- timescaledb: true
- trader: true
- webdriver: true
ElasticsearchElasticsearch
サポートしているElasticsearchのバージョンを指定できます。これは、正確なバージョン番号(major.minor.patch)である必要があります。デフォルトのインストールでは、homestead
という名前のクラスターを作成します。Elasticsearchにオペレーティングシステムのメモリの半分以上を割り当てないでください。そのため、Homestead仮想マシンでElasticsearchの割り当てが最低2倍あることを確認してください。You
may
specify
a
supported
version
of
Elasticsearch,
which
must
be
an
exact
version
number
(major.minor.patch).
The
default
installation
will
create
a
cluster
named
'homestead'.
You
should
never
give
Elasticsearch
more
than
half
of
the
operating
system's
memory,
so
make
sure
your
Homestead
virtual
machine
has
at
least
twice
the
Elasticsearch
allocation.
Elasticsearchドキュメントをチェックして、設定をカスタマイズする方法を確認してください。[!NOTE]
Note:
Check out the Elasticsearch documentation[https://www.elastic.co/guide/en/elasticsearch/reference/current] to learn how to customize your configuration.
MariaDBMariaDB
MariaDBを有効にすると、MySQLを削除してMariaDBをインストールします。MariaDBはMySQLのそのまま置き換え可能な代替機能として通常動作します。そのため、アプリケーションのデータベース設定では、mysql
データベースドライバをそのまま使ってください。Enabling
MariaDB
will
remove
MySQL
and
install
MariaDB.
MariaDB
typically
serves
as
a
drop-in
replacement
for
MySQL,
so
you
should
still
use
the
mysql
database
driver
in
your
application's
database
configuration.
MongoDBMongoDB
デフォルト状態のMongoDBでは、データベースのユーザー名をhomestead
、パスワードをsecret
に設定します。The
default
MongoDB
installation
will
set
the
database
username
to
homestead
and
the
corresponding
password
to
secret
.
Neo4jNeo4j
デフォルト状態のNeo4jでは、データベースのユーザー名をhomestead
、パスワードをsecret
として設定します。Neo4jブラウザにアクセスするには、Webブラウザでhttp://homestead.test:7474
にアクセスしてください。Neo4jクライアントのために、7687
(Bolt)、7474
(HTTP)、7473
(HTTPS)ポートが用意されています。The
default
Neo4j
installation
will
set
the
database
username
to
homestead
and
the
corresponding
password
to
secret
.
To
access
the
Neo4j
browser,
visit
http://homestead.test:7474
via
your
web
browser.
The
ports
7687
(Bolt),
7474
(HTTP),
and
7473
(HTTPS)
are
ready
to
serve
requests
from
the
Neo4j
client.
エイリアスAliases
Homestead仮想マシンでBashのエイリアスを指定するには、Homesteadディレクトリにある
aliases
ファイルを編集します。You
may
add
Bash
aliases
to
your
Homestead
virtual
machine
by
modifying
the
aliases
file
within
your
Homestead
directory:
alias c='clear'
alias ..='cd ..'
aliases
ファイルを更新した後、vagrant
reload
--provision
コマンドを使用してHomestead仮想マシンを再プロビジョニングする必要があります。これにより、新しいエイリアスがマシンで使用できるようになります。After
you
have
updated
the
aliases
file,
you
should
re-provision
the
Homestead
virtual
machine
using
the
vagrant
reload
--provision
command.
This
will
ensure
that
your
new
aliases
are
available
on
the
machine.
HomesteadのアップデートUpdating Homestead
Homesteadのアップデートを開始する前に、Homesteadディレクトリで以下のコマンドを実行して、現在の仮想マシンを確実に削除してください。Before you begin updating Homestead you should ensure you have removed your current virtual machine by running the following command in your Homestead directory:
vagrant destroy
次に、Homesteadソースコードを更新する必要があります。リポジトリのクローンを作成した場合は、最初にリポジトリのクローンを作成した場所で次のコマンドを実行できます。Next, you need to update the Homestead source code. If you cloned the repository, you can execute the following commands at the location you originally cloned the repository:
git fetch
git pull origin release
これらのコマンドは、GitHubリポジトリから最新のHomesteadコードをプルし、最新のタグをフェッチしてから、最新のタグ付きリリースをチェックアウトします。最新の安定版リリースバージョンは、HomesteadのGitHubリリースページにあります。These commands pull the latest Homestead code from the GitHub repository, fetch the latest tags, and then check out the latest tagged release. You can find the latest stable release version on Homestead's GitHub releases page[https://github.com/laravel/homestead/releases].
プロジェクトのcomposer.json
ファイルを介してHomesteadをインストールした場合は、composer.json
ファイルに"laravel/homestead"
:
"^12"
が含まれていることを確認し、依存関係を更新する必要があります。If
you
have
installed
Homestead
via
your
project's
composer.json
file,
you
should
ensure
your
composer.json
file
contains
"laravel/homestead":
"^12"
and
update
your
dependencies:
composer update
次に、vagrant
box
update
コマンドを使用してVagrantボックスを更新する必要があります。Next,
you
should
update
the
Vagrant
box
using
the
vagrant
box
update
command:
vagrant box update
Vagrantボックスを更新した後、Homesteadの追加の設定ファイルを更新するために、Homesteadディレクトリからbashinit.sh
コマンドを実行する必要があります。既存のHomestead.yaml
、after.sh
、aliases
ファイルを上書きするかどうか尋ねられます。After
updating
the
Vagrant
box,
you
should
run
the
bash
init.sh
command
from
the
Homestead
directory
in
order
to
update
Homestead's
additional
configuration
files.
You
will
be
asked
whether
you
wish
to
overwrite
your
existing
Homestead.yaml
,
after.sh
,
and
aliases
files:
# macOS/Linux
bash init.sh
# Windows
init.bat
最後に、最新のVagrantインストールを利用するため、Homestead仮想マシンを再生成します。Finally, you will need to regenerate your Homestead virtual machine to utilize the latest Vagrant installation:
vagrant up
日常の使用方法Daily Usage
SSH接続Connecting via SSH
Homesteadディレクトリからvagrant
ssh
ターミナルコマンドを実行することにより、仮想マシンにSSH接続できます。You
can
SSH
into
your
virtual
machine
by
executing
the
vagrant
ssh
terminal
command
from
your
Homestead
directory.
サイトの追加Adding Additional Sites
Homestead環境をプロビジョニングし、実働した後に、LaravelプロジェクトをNginxサイトへ追加したいこともあるでしょう。希望するだけのLaravelプロジェクトを一つのHomestead環境上で実行できます。新しいサイトを追加するには、Homestead.yaml
ファイルへ追加します。Once
your
Homestead
environment
is
provisioned
and
running,
you
may
want
to
add
additional
Nginx
sites
for
your
other
Laravel
projects.
You
can
run
as
many
Laravel
projects
as
you
wish
on
a
single
Homestead
environment.
To
add
an
additional
site,
add
the
site
to
your
Homestead.yaml
file.
sites:
- map: homestead.test
to: /home/vagrant/project1/public
- map: another.test
to: /home/vagrant/project2/public
フォルダマッピングを確実に設定してください。[!WARNING]
Warning! サイトを追加する前に、プロジェクトのディレクトリに
You should ensure that you have configured a folder mapping[#configuring-shared-folders] for the project's directory before adding the site.
Vagrantが"hosts"ファイルを自動的に管理しない場合は、新しいサイトを追加する必要があります。このファイルはmacOSとLinuxでは、/etc/hosts
にあります。Windowsでは、C:\Windows\System32\drivers\etc\hosts
に位置します。If
Vagrant
is
not
automatically
managing
your
"hosts"
file,
you
may
need
to
add
the
new
site
to
that
file
as
well.
On
macOS
and
Linux,
this
file
is
located
at
/etc/hosts
.
On
Windows,
it
is
located
at
C:\Windows\System32\drivers\etc\hosts
:
192.168.56.56 homestead.test
192.168.56.56 another.test
サイトを追加したら、vagrant
reload
--provision
ターミナルコマンドをHomesteadディレクトリで実行します。Once
the
site
has
been
added,
execute
the
vagrant
reload
--provision
terminal
command
from
your
Homestead
directory.
サイトタイプSite Types
Laravelベースではないプロジェクトも簡単に実行できるようにするため、Homesteadはさまざまなタイプのサイトをサポートしています。たとえば、statamic
サイトタイプを使えば、HomesteadにStatamicアプリケーションを簡単に追加できます。Homestead
supports
several
"types"
of
sites
which
allow
you
to
easily
run
projects
that
are
not
based
on
Laravel.
For
example,
we
may
easily
add
a
Statamic
application
to
Homestead
using
the
statamic
site
type:
sites:
- map: statamic.test
to: /home/vagrant/my-symfony-project/web
type: "statamic"
指定できるサイトタイプはapache
、apache-proxy
、apigility
、expressive
、laravel
(デフォルト)、proxy(nginx用)
、silverstripe
、statamic
、symfony2
、symfony4
、zf
です。The
available
site
types
are:
apache
,
apache-proxy
,
apigility
,
expressive
,
laravel
(the
default),
proxy
(for
nginx),
silverstripe
,
statamic
,
symfony2
,
symfony4
,
and
zf
.
サイトパラメータSite Parameters
params
サイトディレクティブを使用し、Nginxのfastcgi_param
値を追加できます。You
may
add
additional
Nginx
fastcgi_param
values
to
your
site
via
the
params
site
directive:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
params:
- key: FOO
value: BAR
環境変数Environment Variables
グローバルな環境変数は、Homestead.yaml
ファイルで追加定義できます。You
can
define
global
environment
variables
by
adding
them
to
your
Homestead.yaml
file:
variables:
- key: APP_ENV
value: local
- key: FOO
value: bar
Homestead.yaml
ファイルを更新した後、必ずvagrant
reload
--provision
コマンドを実行してマシンを再プロビジョニングしてください。これにより、インストールしているすべてのPHPバージョンのPHP-FPM構成が更新され、vagrant
ユーザーの環境も更新されます。After
updating
the
Homestead.yaml
file,
be
sure
to
re-provision
the
machine
by
executing
the
vagrant
reload
--provision
command.
This
will
update
the
PHP-FPM
configuration
for
all
of
the
installed
PHP
versions
and
also
update
the
environment
for
the
vagrant
user.
ポートPorts
以下のポートが、Homestead環境へポートフォワードされています。By default, the following ports are forwarded to your Homestead environment:
- HTTP: 8000 → フォワード先 80HTTP: 8000 → Forwards To 80
- HTTPS: 44300 → フォワード先 443HTTPS: 44300 → Forwards To 443
追加のフォワードポートForwarding Additional Ports
必要に応じて、Homestead.yaml
ファイル内でports
設定エントリを定義することにより、追加のポートをVagrantボックスに転送できます。Homestead.yaml
ファイルを更新した後は、必ずvagrant
reload
--provision
コマンドを実行してマシンを再プロビジョニングしてください。If
you
wish,
you
may
forward
additional
ports
to
the
Vagrant
box
by
defining
a
ports
configuration
entry
within
your
Homestead.yaml
file.
After
updating
the
Homestead.yaml
file,
be
sure
to
re-provision
the
machine
by
executing
the
vagrant
reload
--provision
command:
ports:
- send: 50000
to: 5000
- send: 7777
to: 777
protocol: udp
以下は、ホストマシンからVagrantボックスへマップする、Homesteadサービス追加ポートのリストです。Below is a list of additional Homestead service ports that you may wish to map from your host machine to your Vagrant box:
- SSH: 2222 → フォワード先 22SSH: 2222 → To 22
- ngrok UI: 4040 → フォワード先 4040ngrok UI: 4040 → To 4040
- MySQL: 33060 → フォワード先 3306MySQL: 33060 → To 3306
- PostgreSQL: 54320 → フォワード先 5432PostgreSQL: 54320 → To 5432
- MongoDB: 27017 → フォワード先 27017MongoDB: 27017 → To 27017
- Mailpit: 8025 → フォワード先 8025Mailpit: 8025 → To 8025
- Minio: 9600 → フォワード先 9600Minio: 9600 → To 9600
PHPバージョンPHP Versions
Homesteadは、同じ仮想マシンで複数のバージョンのPHPを実行するためサポートしています。Homestead.yaml
ファイル内の特定のサイトに使用するPHPのバージョンを指定できます。使用可能なPHPバージョンは、"5.6",
"7.0",
"7.1",
"7.2",
"7.3",
"7.4"、"8.0"、"8.1"、"8.2"、"8.3"(デフォルト)です。Homestead
supports
running
multiple
versions
of
PHP
on
the
same
virtual
machine.
You
may
specify
which
version
of
PHP
to
use
for
a
given
site
within
your
Homestead.yaml
file.
The
available
PHP
versions
are:
"5.6",
"7.0",
"7.1",
"7.2",
"7.3",
"7.4",
"8.0",
"8.1",
"8.2",
and
"8.3",
(the
default):
sites:
- map: homestead.test
to: /home/vagrant/project1/public
php: "7.1"
Homestead仮想マシン内では、以下のようにCLIでサポートしているPHPバージョンのどれでも使用できます。Within your Homestead virtual machine[#connecting-via-ssh], you may use any of the supported PHP versions via the CLI:
php5.6 artisan list
php7.0 artisan list
php7.1 artisan list
php7.2 artisan list
php7.3 artisan list
php7.4 artisan list
php8.0 artisan list
php8.1 artisan list
php8.2 artisan list
php8.3 artisan list
Homestead仮想マシン内から以下のコマンドを実行すれば、CLIで使用するPHPのデフォルトバージョンを変更できます。You may change the default version of PHP used by the CLI by issuing the following commands from within your Homestead virtual machine:
php56
php70
php71
php72
php73
php74
php80
php81
php82
php83
データベースへの接続Connecting to Databases
homestead
データベースは、MySQLとPostgreSQLの両方へすぐに設定できます。ホストマシンのデータベースクライアントからMySQLまたはPostgreSQLデータベースに接続するには、ポート33060
(MySQL)または54320
(PostgreSQL)で127.0.0.1
へ接続してください。両方のデータベースのユーザー名とパスワードはhomestead
/secret
です。A
homestead
database
is
configured
for
both
MySQL
and
PostgreSQL
out
of
the
box.
To
connect
to
your
MySQL
or
PostgreSQL
database
from
your
host
machine's
database
client,
you
should
connect
to
127.0.0.1
on
port
33060
(MySQL)
or
54320
(PostgreSQL).
The
username
and
password
for
both
databases
is
homestead
/
secret
.
Warning! ホストマシンからデータベースに接続する場合にのみ、これらの非標準ポートを使用する必要があります。Laravelは仮想マシン内で実行するため、Laravelアプリケーションの
database
設定ファイルではデフォルトの3306ポートと5432ポートを使用しています。[!WARNING]
You should only use these non-standard ports when connecting to the databases from your host machine. You will use the default 3306 and 5432 ports in your Laravel application'sdatabase
configuration file since Laravel is running within the virtual machine.
データベースのバックアップDatabase Backups
Homesteadは、Homestead仮想マシンが破壊されたときに、データベースを自動的にバックアップできます。この機能を利用するには、Vagrant2.1.0以降を使用している必要があります。古いバージョンのVagrantを使用している場合は、vagrant-triggers
プラグインをインストールする必要があります。データベースの自動バックアップを有効にするには、Homestead.yaml
ファイルに次の行を追加します。Homestead
can
automatically
backup
your
database
when
your
Homestead
virtual
machine
is
destroyed.
To
utilize
this
feature,
you
must
be
using
Vagrant
2.1.0
or
greater.
Or,
if
you
are
using
an
older
version
of
Vagrant,
you
must
install
the
vagrant-triggers
plug-in.
To
enable
automatic
database
backups,
add
the
following
line
to
your
Homestead.yaml
file:
backup: true
設定が完了すると、Homesteadは、vagrant
destroy
コマンドの実行時に、データベースを.backup/mysql_backup
もしくは.backup/postgres_backup
ディレクトリにエクスポートします。これらのディレクトリは、Homesteadをインストールしたフォルダ、またはプロジェクトごとのインストールメソッドを使用している場合はプロジェクトのルートにできます。Once
configured,
Homestead
will
export
your
databases
to
.backup/mysql_backup
and
.backup/postgres_backup
directories
when
the
vagrant
destroy
command
is
executed.
These
directories
can
be
found
in
the
folder
where
you
installed
Homestead
or
in
the
root
of
your
project
if
you
are
using
the
per
project
installation[#per-project-installation]
method.
cronスケジュールの設定Configuring Cron Schedules
Laravelは、schedule:run
Artisanコマンドを1分毎に実行するスケジュールをすることで、cronジョブのスケジュールを行う便利な方法を提供しています。schedule:run
コマンドは、routes/console.php
ファイルで定義済みのジョブスケジュールを調べ、実行するスケジュールタスクを決定します。Laravel
provides
a
convenient
way
to
schedule
cron
jobs[/docs/{{version}}/scheduling]
by
scheduling
a
single
schedule:run
Artisan
command
to
run
every
minute.
The
schedule:run
command
will
examine
the
job
schedule
defined
in
your
routes/console.php
file
to
determine
which
scheduled
tasks
to
run.
Homesteadサイトに対してschedule:run
コマンドを実行する場合は、サイトを定義するときにschedule
オプションをtrue
に設定します。If
you
would
like
the
schedule:run
command
to
be
run
for
a
Homestead
site,
you
may
set
the
schedule
option
to
true
when
defining
the
site:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
schedule: true
サイトのcronジョブは、Homestead仮想マシンの/etc/cron.d
ディレクトリで定義します。The
cron
job
for
the
site
will
be
defined
in
the
/etc/cron.d
directory
of
the
Homestead
virtual
machine.
Mailpitの設定Configuring Mailpit
Mailpitを使用すると、実際に受信者にメールを送信しなくても、送信メールを傍受して調査できます。使用するには、以下のメール設定を使用するためアプリケーションの.env
ファイルを更新します。Mailpit[https://github.com/axllent/mailpit]
allows
you
to
intercept
your
outgoing
email
and
examine
it
without
actually
sending
the
mail
to
its
recipients.
To
get
started,
update
your
application's
.env
file
to
use
the
following
mail
settings:
MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Mailpitを設定したら、http://localhost:8025
にある、Mailpitダッシュボードにアクセスできます。Once
Mailpit
has
been
configured,
you
may
access
the
Mailpit
dashboard
at
http://localhost:8025
.
Minioの設定Configuring Minio
Minioは、Amazon
S3互換のAPIを備えたオープンソースのオブジェクトストレージサーバです。Minioをインストールするには、Homestead.yaml
ファイルのオプション機能セクションで以下の設定オプションへ変更してください。Minio[https://github.com/minio/minio]
is
an
open
source
object
storage
server
with
an
Amazon
S3
compatible
API.
To
install
Minio,
update
your
Homestead.yaml
file
with
the
following
configuration
option
in
the
features[#installing-optional-features]
section:
minio: true
デフォルトでは、Minioはポート9600で使用できます。http://localhost:9600
にアクセスし、Minioコントロールパネルを表示できます。デフォルトのアクセスキーはhomestead
、秘密キーはsecretkey
です。Minioにアクセスするときは、常にリージョンus-east-1
を使用する必要があります。By
default,
Minio
is
available
on
port
9600.
You
may
access
the
Minio
control
panel
by
visiting
http://localhost:9600
.
The
default
access
key
is
homestead
,
while
the
default
secret
key
is
secretkey
.
When
accessing
Minio,
you
should
always
use
region
us-east-1
.
Minioを使用するには、.env
ファイルに以下のオプション確実に用意してください。In
order
to
use
Minio,
ensure
your
.env
file
has
the
following
options:
AWS_USE_PATH_STYLE_ENDPOINT=true
AWS_ENDPOINT=http://localhost:9600
AWS_ACCESS_KEY_ID=homestead
AWS_SECRET_ACCESS_KEY=secretkey
AWS_DEFAULT_REGION=us-east-1
Minioを利用した「S3」バケットをプロビジョニングするには、Homestead.yaml
ファイルにbuckets
ディレクティブを追加します。バケットを定義したら、ターミナルでvagrant
reload
--provision
コマンドを実行する必要があります。To
provision
Minio
powered
"S3"
buckets,
add
a
buckets
directive
to
your
Homestead.yaml
file.
After
defining
your
buckets,
you
should
execute
the
vagrant
reload
--provision
command
in
your
terminal:
buckets:
- name: your-bucket
policy: public
- name: your-private-bucket
policy: none
サポートしているpolicy
値は、none
、download
、upload
、public
です。Supported
policy
values
include:
none
,
download
,
upload
,
and
public
.
Laravel DuskLaravel Dusk
Homestead内でLaravelDuskテストを実行するには、Homestead設定でwebdriver
機能を有効にする必要があります。In
order
to
run
Laravel
Dusk[/docs/{{version}}/dusk]
tests
within
Homestead,
you
should
enable
the
webdriver
feature[#installing-optional-features]
in
your
Homestead
configuration:
features:
- webdriver: true
webdriver
機能を有効にした後は、ターミナルでvagrant
reload
--provision
コマンドを実行する必要があります。After
enabling
the
webdriver
feature,
you
should
execute
the
vagrant
reload
--provision
command
in
your
terminal.
環境の共有Sharing Your Environment
現在取り組んでいるものを同僚やクライアントと共有したい場合があります。Vagrantには、vagrant
share
コマンドを介したこれに対する組み込みのサポートがあります。ただし、Homestead.yaml
ファイルで複数のサイトを構成している場合には機能しません。Sometimes
you
may
wish
to
share
what
you're
currently
working
on
with
coworkers
or
a
client.
Vagrant
has
built-in
support
for
this
via
the
vagrant
share
command;
however,
this
will
not
work
if
you
have
multiple
sites
configured
in
your
Homestead.yaml
file.
この問題を解決するため、Homesteadは独自のshare
コマンドを用意しています。使い始めるには、vagrant
ssh
によりHomestead仮想マシンへSSH接続し、share
homestead.test
コマンドを実行します。このコマンドは、Homestead.yaml
構成ファイルのhomestead.test
サイトを共有します。homestead.test
の代わりに他の設定済みサイトを使用できます。To
solve
this
problem,
Homestead
includes
its
own
share
command.
To
get
started,
SSH
into
your
Homestead
virtual
machine[#connecting-via-ssh]
via
vagrant
ssh
and
execute
the
share
homestead.test
command.
This
command
will
share
the
homestead.test
site
from
your
Homestead.yaml
configuration
file.
You
may
substitute
any
of
your
other
configured
sites
for
homestead.test
:
share homestead.test
コマンドを実行すると、アクティビティログと共有サイトの一般公開されているURLを含むNgrok画面が表示されます。カスタムリージョン、サブドメイン、またはその他のNgrokランタイムオプションを指定する場合は、それらをshare
コマンドへ追加できます。After
running
the
command,
you
will
see
an
Ngrok
screen
appear
which
contains
the
activity
log
and
the
publicly
accessible
URLs
for
the
shared
site.
If
you
would
like
to
specify
a
custom
region,
subdomain,
or
other
Ngrok
runtime
option,
you
may
add
them
to
your
share
command:
share homestead.test -region=eu -subdomain=laravel
HTTPではなくHTTPSでコンテンツを共有する必要がある場合は、share
の代わりにsshare
コマンドを使用すれば可能です。If
you
need
to
share
content
over
HTTPS
rather
than
HTTP,
using
the
sshare
command
instead
of
share
will
enable
you
to
do
so.
Warning! Vagrantは本質的に安全ではなく、
share
コマンドを実行するときに仮想マシンをインターネットに公開していることを忘れないでください。[!WARNING]
Remember, Vagrant is inherently insecure and you are exposing your virtual machine to the Internet when running theshare
command.
デバッグとプロファイリングDebugging and Profiling
Xdebugを使用したWebリクエストのデバッグDebugging Web Requests With Xdebug
Homesteadは、Xdebugを使用したステップデバッグのサポートを用意しています。たとえば、ブラウザでページにアクセスすると、PHPがIDEに接続し、実行中のコードを検査および変更できるようになります。Homestead includes support for step debugging using Xdebug[https://xdebug.org]. For example, you can access a page in your browser and PHP will connect to your IDE to allow inspection and modification of the running code.
Xdebugはデフォルトではじめから実行しており、接続を受け付ける準備ができています。CLIでXdebugを有効にする必要がある場合は、Homestead仮想マシン内でsudo
php
enmod
xdebug
コマンドを実行します。次に、IDEの指示に従ってデバッグを有効にします。最後に、拡張機能またはブックマークレットを使用してXdebugをトリガーするようにブラウザを構成します。By
default,
Xdebug
is
already
running
and
ready
to
accept
connections.
If
you
need
to
enable
Xdebug
on
the
CLI,
execute
the
sudo
phpenmod
xdebug
command
within
your
Homestead
virtual
machine.
Next,
follow
your
IDE's
instructions
to
enable
debugging.
Finally,
configure
your
browser
to
trigger
Xdebug
with
an
extension
or
bookmarklet[https://www.jetbrains.com/phpstorm/marklets/].
Warning! Xdebugを使用すると、PHPの実行速度が大幅に低下します。Xdebugを無効にするには、Homestead仮想マシン内で
sudo phpdismod xdebug
を実行し、それからFPMサービスを再起動します。[!WARNING]
Xdebug causes PHP to run significantly slower. To disable Xdebug, runsudo phpdismod xdebug
within your Homestead virtual machine and restart the FPM service.
Xdebugの自動起動Autostarting Xdebug
Webサーバにリクエストを送る機能テストをデバッグする場合、カスタムヘッダまたはCookieを用いデバッグをトリガーするようテストを変更するよりも、デバッグを自動開始する方が簡単です。Xdebugを強制的に自動で開始するには、Homestead仮想マシン内の/etc/php/7.x/fpm/conf.d/20-xdebug.ini
ファイルを変更し、次の構成を追加します。When
debugging
functional
tests
that
make
requests
to
the
web
server,
it
is
easier
to
autostart
debugging
rather
than
modifying
tests
to
pass
through
a
custom
header
or
cookie
to
trigger
debugging.
To
force
Xdebug
to
start
automatically,
modify
the
/etc/php/7.x/fpm/conf.d/20-xdebug.ini
file
inside
your
Homestead
virtual
machine
and
add
the
following
configuration:
; Homestead.yamlでIPアドレスの異なるサブネットを指定している場合、このアドレスは異なるでしょう
xdebug.client_host = 192.168.10.1
xdebug.mode = debug
xdebug.start_with_request = yes
CLIアプリケーションのデバッグDebugging CLI Applications
PHP
CLIアプリケーションをデバッグするには、Homestead仮想マシン内でxphp
シェルエイリアスを使用します。To
debug
a
PHP
CLI
application,
use
the
xphp
shell
alias
inside
your
Homestead
virtual
machine:
xphp /path/to/script
Blackfireを使用したアプリケーションのプロファイリングProfiling Applications With Blackfire
Blackfireは、WebリクエストとCLIアプリケーションをプロファイリングするサービスです。コールグラフとタイムラインでプロファイルデータを表示するインタラクティブなユーザーインターフェイスを提供しています。開発、ステージング、および本番環境で使用するために構築されており、エンドユーザーのオーバーヘッドはありません。加えてBlackfireは、コードとphp.ini
設定のパフォーマンス、品質、およびセキュリティチェックも提供してくれます。Blackfire[https://blackfire.io/docs/introduction]
is
a
service
for
profiling
web
requests
and
CLI
applications.
It
offers
an
interactive
user
interface
which
displays
profile
data
in
call-graphs
and
timelines.
It
is
built
for
use
in
development,
staging,
and
production,
with
no
overhead
for
end
users.
In
addition,
Blackfire
provides
performance,
quality,
and
security
checks
on
code
and
php.ini
configuration
settings.
Blackfire Playerは、プロファイリングシナリオをスクリプト化するために、Blackfireと連携して動作できるオープンソースのWebクロール、Webテスト、およびWebスクレイピングアプリケーションです。The Blackfire Player[https://blackfire.io/docs/player/index] is an open-source Web Crawling, Web Testing, and Web Scraping application which can work jointly with Blackfire in order to script profiling scenarios.
Blackfireを有効にするには、Homestead設定ファイルの「機能(features)」設定を使用します。To enable Blackfire, use the "features" setting in your Homestead configuration file:
features:
- blackfire:
server_id: "server_id"
server_token: "server_value"
client_id: "client_id"
client_token: "client_value"
Blackfireサーバの接続情報とクライアントの接続情報がBlackfireアカウントで要求されます。Blackfireには、CLIツールやブラウザ拡張機能など、アプリケーションをプロファイリングするためのさまざまなオプションが用意されています。詳細については、Blackfireのドキュメントを確認してください。Blackfire server credentials and client credentials require a Blackfire account[https://blackfire.io/signup]. Blackfire offers various options to profile an application, including a CLI tool and browser extension. Please review the Blackfire documentation for more details[https://blackfire.io/docs/php/integrations/laravel/index].
ネットワークインターフェイスNetwork Interfaces
Homestead.yaml
ファイルのnetworks
プロパティは、Homestead仮想マシンのネットワークインターフェイスを設定します。必要な数のインターフェイスを構成できます。The
networks
property
of
the
Homestead.yaml
file
configures
network
interfaces
for
your
Homestead
virtual
machine.
You
may
configure
as
many
interfaces
as
necessary:
networks:
- type: "private_network"
ip: "192.168.10.20"
bridgedインターフェイスを有効にするには、ネットワークのbridge
設定を構成し、ネットワークタイプをpublic_network
へ変更します。To
enable
a
bridged[https://developer.hashicorp.com/vagrant/docs/networking/public_network]
interface,
configure
a
bridge
setting
for
the
network
and
change
the
network
type
to
public_network
:
networks:
- type: "public_network"
ip: "192.168.10.20"
bridge: "en1: Wi-Fi (AirPort)"
DHCPを有効にするには、設定からip
オプションを削除するだけです。To
enable
DHCP[https://developer.hashicorp.com/vagrant/docs/networking/public_network#dhcp],
just
remove
the
ip
option
from
your
configuration:
networks:
- type: "public_network"
bridge: "en1: Wi-Fi (AirPort)"
ネットワークで使用するデバイスを更新するには、ネットワークの設定へdev
オプションを追加します。デフォルトのdev
値はeth0
です。To
update
what
device
the
network
is
using,
you
may
add
a
dev
option
to
the
network's
configuration.
The
default
dev
value
is
eth0
:
networks:
- type: "public_network"
ip: "192.168.10.20"
bridge: "en1: Wi-Fi (AirPort)"
dev: "enp2s0"
Homesteadの拡張Extending Homestead
Homesteadディレクトリのルートにあるafter.sh
スクリプトを使用して、Homesteadを拡張できます。このファイル内に、仮想マシンを適切に構成およびカスタマイズするために必要なシェルコマンドを追加します。You
may
extend
Homestead
using
the
after.sh
script
in
the
root
of
your
Homestead
directory.
Within
this
file,
you
may
add
any
shell
commands
that
are
necessary
to
properly
configure
and
customize
your
virtual
machine.
Homesteadをカスタマイズするときに、Ubuntuは、パッケージの元の構成を保持するか、新しい構成ファイルで上書きするかを尋ねる場合があります。これを回避するには、パッケージをインストールするときに以下のコマンドを使用して、Homesteadによって以前に作成された構成が上書きされないようにする必要があります。When customizing Homestead, Ubuntu may ask you if you would like to keep a package's original configuration or overwrite it with a new configuration file. To avoid this, you should use the following command when installing packages in order to avoid overwriting any configuration previously written by Homestead:
sudo apt-get -y \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold" \
install package-name
ユーザーのカスタマイズUser Customizations
チームでHomesteadを使用するときは、Homesteadを微調整して、個人の開発スタイルに合わせて調整するのを推奨します。このためには、Homesteadディレクトリ(Homestead.yaml
ファイルを含む同じディレクトリ)のルートにuser-customizations.sh
ファイルを作成します。このファイル内で、必要なカスタマイズを行うことができます。ただし、user-customizations.sh
をバージョン管理してはいけません。When
using
Homestead
with
your
team,
you
may
want
to
tweak
Homestead
to
better
fit
your
personal
development
style.
To
accomplish
this,
you
may
create
a
user-customizations.sh
file
in
the
root
of
your
Homestead
directory
(the
same
directory
containing
your
Homestead.yaml
file).
Within
this
file,
you
may
make
any
customization
you
would
like;
however,
the
user-customizations.sh
should
not
be
version
controlled.
プロパイダ固有の設定Provider Specific Settings
VirtualBoxVirtualBox
natdnshostresolver
natdnshostresolver
Homesteadはnatdnshostresolver
設定をデフォルトでon
に設定します。これにより、HomesteadはホストオペレーティングシステムのDNS設定を使用できるようになります。この動作をオーバーライドする場合は、次の構成オプションをHomestead.yaml
ファイルに追加します。By
default,
Homestead
configures
the
natdnshostresolver
setting
to
on
.
This
allows
Homestead
to
use
your
host
operating
system's
DNS
settings.
If
you
would
like
to
override
this
behavior,
add
the
following
configuration
options
to
your
Homestead.yaml
file:
provider: virtualbox
natdnshostresolver: 'off'