Install Laravel Homestead on Linux

Like the former post, download the virtualbox.box file first.

However, when I use the way in the former post, it always ask me to download the box file, like this:

~/Homestead (9bb1241 ✘)✭ ᐅ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Box 'laravel/homestead' could not be found. Attempting to find and install...
    homestead-7: Box Provider: virtualbox
    homestead-7: Box Version: >= 3.0.0
==> homestead-7: Loading metadata for box 'laravel/homestead'
    homestead-7: URL: https://atlas.hashicorp.com/laravel/homestead
==> homestead-7: Adding box 'laravel/homestead' (v3.0.0) for provider: virtualbox
    homestead-7: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/3.0.0/providers/virtualbox.box
    homestead-7: Progress: 0% (Rate: 14005/s, Estimated time remaining: 45:34:08    homestead-7: Progress: 0% (Rate: 14199/s, Estimated time remaining: 39:15:35
    homestead-7: Progress: 0% (Rate: 21602/s, Estimated time remaining: 29:48:16    homestead-7: Progress: 0% (Rate: 30755/s, Estimated time remaining: 22:46:15
    homestead-7: Progress: 0% (Rate: 36054/s, Estimated time remaining: 18:52:17    homestead-7: Progress: 0% (Rate: 44464/s, Estimated time remaining: 16:00:44
    homestead-7: Progress: 0% (Rate: 69422/s, Estimated time remaining: 11:01:37    homestead-7: Progress: 0% (Rate: 35891/s, Estimated time remaining: 4:38:54)
    ^C
    ==> homestead-7: Waiting for cleanup before exiting...

Trouble Shooting

I guess it is the box version problem, but I cannot override the vagrant version certification logic this time (Maybe due to the updated version).

Solution

So I change a way to do it.

First, create a file named metadata.json in the virtualbox.box directory.

Edit metadata.json file like the following code:

{
    "name": "laravel/homestead",
    "versions": [{
        "version": "3.0.0", // Should be replaced by your correct verison!
        "providers": [{
            "name": "virtualbox",
            "url": "file:///path/to/your/virualbox.box"
        }]
    }]
}

Execute vagrant box add metadata.json

==> box: Loading metadata for box 'metadata.json'
    box: URL: file:///home/triplez/Homestead/metadata.json
==> box: Adding box 'laravel/homestead' (v3.0.0) for provider: virtualbox
    box: Unpacking necessary files from: file:///home/triplez/Homestead/virualbox.box
==> box: Successfully added box 'laravel/homestead' (v3.0.0) for 'virtualbox'!

Congratulations! You configure the homestead successfully in Liunx!

Then,

$ vagrant up
$ vagrant ssh

Enjoy 🙂

Connect to Homestead Database

Connect to Vagrant VM

In fact, you can view all the vagrant information after you execute vagrant up.

==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 8000 (host) (adapter 1)
    homestead-7: 443 (guest) => 44300 (host) (adapter 1)
    homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
    homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
    homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
    homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
    homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2222
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key

If you need to connect to homestead from the outside through SSH, you must have the SSH public key file.

Use this command vagrant ssh-config, then you can find out where is your SSH public key file.

~/Homestead (9bb1241 ✘)✹✭ ᐅ vagrant ssh-config
Host homestead-7
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/triplez/Homestead/.vagrant/machines/homestead-7/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

Connect to Homestead DB

Variable Value
MySQL HostName 127.0.0.1
MySQL ServerPort 3306
UserName homestead
Password secret

You can use MySQL Workbench or Sequel Pro to connect to this DB and use GUI to manage your data.

    分享到:
分类: LinuxWeb Dev

发表评论

电子邮件地址不会被公开。 必填项已用*标注

验证码 *