Web Design and Search Engine Optimisation FreeLancer




Laravel Homestead Setup on Windows 10 Step by Step

Category : Laravel · by Dec 5th, 2015

Step 1: install VirtualBox, Vagrant, git

Step 2: in windows cmd.exe, type in vagrant box add laravel/homestead. If failed, you may have an old version of Vagrant that requires the full URL: vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead

Step 3: in windows cmd.exe, navigate to the folder that you wish to save homestead. Then type in git clone https://github.com/laravel/homestead.git Homestead.
My environment will be D:/Private/Homestead/, so I CD to D:/Private, then run git clone https://github.com/laravel/homestead.git Homestead, it will then creates a folder “Homestead”.

Step 4: in windows cmd.exe, CD to folder d:/Private/Homestead/, then type bash init.sh. After you do this, Homestead.yaml file will be placed in your ~/.homestead directory.
In this case, I found the file under C:\Users\MY_LOGIN_USERNAME_TO_PC\.homestead. MY_LOGIN_USERNAME_TO_PC is actually the logged in user name.

Step 5: ssh-keygen -t rsa -C “yourname@homestead_key”, this generates the key so after vagrant starts to run you can use command “vagrant ssh” to ssh to the server

Step 6: configure homestead.yaml file, I found that Laravel’s installation notes is a bit hard to understand. So I put something together below.

Assume my folder structure on D:/ like this
D:/Private/
D:/Private/Homestead/
D:/Private/temp.app/

My target is to set up http://temnp.app as a local website


ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.homestead/homestead_key.pub

keys:
- ~/.homestead/homestead_key

folders:
- map: d:/Private/demo.app/
to: /home/vagrant/Code

sites:
- map: demo.app
to: /home/vagrant/Code/Laravel/public

databases:
- homestead

variables:
- key: APP_ENV
value: local

Step 7: After saving the file above. CD to D:/Private/Homestead/ in CMD.exe, then
vagrant ssh If everything went well, you will get a server now.

If you want to use Putty to connect to the server, you will need a key file, use below command
User “vagrant ssh-config” under D:/Private/Homestead/ folder will give you the path to the private key. Then get puttykeygen to create putty auth file .ppk

While you use that auth file, when login, use username “vagrant”, and leave password empty will let you in.

Tips: if you see “no input file specified.” You may be only one step away. First make sure vagrant up is already done and vm is running, then type vagrant provision
It should bring the page up.

To install phpmyadmin, simply create a new app and drop the files in to your folder shall do. Or

Option 1:
This will install the latest version of PhpMyAdmin from a shell script I’ve written. You are welcome to check it out on Github.

Run the following command from your code/projects directory:

curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | sh
Option 2:
This will install PhpMyAdmin (not the latest version) from Ubuntu’s repositories. Assuming that your projects live in /home/vagrant/Code :

sudo apt-get install phpmyadmin Do not select apache2 nor lighttpd when prompted. Just hit tab and enter.

sudo ln -s /usr/share/phpmyadmin/ /home/vagrant/Code/phpmyadmin

cd ~/Code && serve phpmyadmin.app /home/vagrant/Code/phpmyadmin

Note: If you encounter issues creating the symbolic link on step 2, try the first option or see Lyndon Watkins’ answer below.
————————————————————————————————————————————

While install phpmyadmin, if you have problem save config.inc.php’s permission to read only, Simply doing it on the host machine instead of the virtual machine fixed it.

SHARE :