LoginSignup
6
6

More than 5 years have passed since last update.

Laravel5.1のインストール方法

Last updated at Posted at 2015-07-13

※ハンズオン系の勉強会に行く前にインストールを済ませとこうという趣旨の記事です。

ほぼ本家の和訳です。

Homestead

本家配布のhomesteadを利用します。
Windows環境の方は、GitBashを推奨します。

Composerの準備

Composer環境の準備は、割愛します。
以下のリンクからDLすればとりあえず動きます。

Composer公式サイト

Vagrantの準備

Vagrant環境の準備は、割愛します。
以下のリンクからDLすればとりあえず動きます。
Vagrant公式サイト
VirtualBox公式サイト

vagrant box add laravel/homestead を叩きます。

==> box: Loading metadata for box 'laravel/homestead'
    box: URL: https://atlas.hashicorp.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) virtualbox
2) vmware_desktop

Enter your choice:

1 -> Enter を押して次にすすみましょう。

インストールに失敗した場合は、
vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead
を叩いてください。

この段階では、まだvagrant upしません!!

インストールが完了すると、以下の環境が手に入ります。

  • Ubuntu 14.04
  • PHP 5.6
  • HHVM
  • Nginx
  • MySQL
  • Postgres
  • Node (With PM2, Bower, Grunt, and Gulp)
  • Redis
  • Memcached
  • Beanstalkd
  • Laravel Envoy
  • Blackfire Profiler

Gitの準備

こちらもGit環境の準備は割愛します。

以下のコマンドを叩いて、Homestead環境をダウンロードします。
git clone https://github.com/laravel/homestead.git Homestead

叩いたディレクトリ直下にHomesteadディレクトリが作成されます。

まだvagrant upはしません!!!

Laravel5.1の準備

Laravelのソースをダウンロードしましょう。
さくっとComposerでやっちゃいます。
アプリケーションを配置したいディレクトリで以下のコマンドを叩いてください。

composer create-project laravel/laravel --prefer-dist

Homesteadの準備

環境が手に入ったので、続けてHomesteadの環境を整えていきます。
作成されたHomesteadディレクトリに移動し、初期化用シェルを叩きます。
cd Homestead
sh init.sh
init.sh が完了すると、ユーザーディレクトリ直下に.homesteadディレクトリが作成されます。

Vagrantの共有フォルダを設定します。

folders:
- map: ~/{Laravel5.1をcloneしたディレクトリ}
to: /home/vagrant/Code

続いて、hostsを書き換えます。

  • Macの場合
    • /etc/hosts192.168.10.10 homestead.appを追記します。
  • Windowsの場合
    • C:\Windows\System32\drivers\etc\hosts192.168.10.10 homestead.appを追記します。

この設定により、vagrant up後にhttp://homestead.appにアクセスすることでLaravelアプリケーションにアクセスさせることができます。

Vagrantの起動

おまたせしました!
vagrant upを叩いて、http://homestead.appにアクセスしましょう。
灰色のLaravel画面がでてきたら、準備完了です!

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6