-
Notifications
You must be signed in to change notification settings - Fork 13
Setting Up
Follow these instructions to setup Laravel Homestead:
Terminal/git commands will look like this
, type them into terminal/git to proceed
Make sure you have the following programs downloaded:
- Vagrant
- Virtualbox -Gitbash (no need to download if you have a mac)
Step 2
Open up gitbash or terminal
vagrant box add laravel/homestead
(wait for this to finish downloading)
cd ~
(cd means change directory. cd ~ takes you to your home directory, where homestead will be)
git clone https://github.com/laravel/homestead.git Homestead
(wait for this to finish downloading)
cd Homestead
bash init.sh
- You should have a homestead folder on your computer now. You can create a shortcut on your desktop for easy access.
- Make sure your homstead folder has a file called "Homestead.yaml"
- Edit your homestead.yaml file to look like the example at the bottom of this channel
Step 3 Find your host files For windows enter C:\Windows\System32\drivers\etc\hosts For Macs open Finder and, in Finder’s menu bar, select Go > Go to Folder and enter /private/etc/hosts Then add "192.168.10.10 homestead.test" to the bottom of the file (without quotation marks). Make sure to open the host files with a text editing tool like Notepad but be sure to open the Notepad as an administrator first. Save the file when you're done. (edited)
Carl Dungca [3:00 PM]
Step 4
ssh-keygen -t rsa -C "youremailhere"
Do this step if you've never done this before
Replace "youremailhere" with your email
A dialogue box will open up. Leave everything blank.
Now, check if your virtual machine works:
cd ~/Homestead
(changes directory to homestead)
vagrant up
(brings your virtual machine online, wait for this to finish. A $ sign will be in the command line when its does)
vagrant ssh
(secure shell into your virtual machine)
exit
(closes connection to your virtual machine)
vagrant halt
(This will turn off your virtual machine, allowing you to close git/terminal)
Step 5 (Edit 7/2/18: changed this step) Go to C:/users/username in your computer Make a new folder called "Code" in your computer
Before proceeding, exit
and vagrant halt
vagrant up
vagrant ssh
ls
(this will list all the files in the current directory. If "Code" shows up, then the last step was successful)
cd Code
git clone https://github.com/ucsdcirclek/konnection.git
ls
(Check to make sure konnection is inside the Code directory)
cd konnection
(Go to C:/users/user/code/konnection in your computer and check if there are files inside. This is where you will access the project)
Step 6
npm install --no-bin-links
(if you have a mac, run the following command instead: npm install
)
(If npm ERR! pops up, run sudo yarn install --no-bin-links
instead) (EDIT 7/8/18: added this alternate step)
Do not progress past this step if you are getting red error text
Step 7
composer install
Step 8
mv .env.example .env
(this renames the file ".env.example" to ".env")
git checkout -- .env.example
(this ensures that .env.example doesn't get deleted remotely when you push things)
Step 9
cd config
vim app.php
(this will let you edit app.php)
(vim commands open up files to edit. Note the following commands to use vim: -Arrow keys navigate through the file -ins button brings you into edit mode
- You can type and backspace in edit mode -esc brings you out of edit mode
-
:q
quits without saving changes (only works out of edit mode):wq
saves changes and quits (only works out of edit mode)
Do the following when editing app.php
- Scroll down to line 95 (you can see what line you're on at the bottom of git/terminal)
- Change line 95 to 'cipher' => 'AES-256-CBC', (EDIT 5/6/18: Remember the comma at the end of this!)
- Quit and save changes
-
cd ../
(this will take you one directory back, you should be back in the konnection directory) (edited)
Carl Dungca [3:32 PM]
Step 10
php artisan key:generate
php artisan jwt:generate
- Use vim .env to update app_key and jwt_secret in your .env file. Save changes
- Make changes to ensure that .env looks like this (except your app_key and jwt_secret): (edited)
.env
APP_ENV=local
APP_DEBUG=true
APP_KEY=KCkfaaOrJv4bSfTWOoe5gUG78SpcyUgH
DB_HOST=localhost
IMPORTANT: If you ever have to make correctional edits to .env after this step, you must run
vagrant destroy
, then boot up your virtual machine again, then start over form step 6.
Step 11 Open a browser and type homestead.test (You should be getting an SQLSTATE table not found error)
Step 12
php71
(the following steps won't work unless php is downgraded back to 7.1)
php artisan migrate
(migrates database tables)
php artisan db:seed
(EDIT: 5/6/19 no space between db: and seed)
(seeds the database with dummy values)
gulp
(compiles scss and js assets)
Step 13
git checkout -- config/jwt.php
(Prevents changes to jwt.php from being committed)
git update-index --assume-unchanged config/app.php
(Ensures that this file stays the way it is locally)
Step 14 Open homestead.test in a browser
If the circle k website shows up, congrats! You have completed setup.
You can now make changes in phpStorm to the test website files. The changes will be shown in real time on homestead.test.
If you are still having trouble, see the troubleshooting steps below: (edited)