Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Vagrant
Search
Tom J Nowell
March 19, 2014
Technology
1
500
Vagrant
Using vagrant to host WordPress locally
Tom J Nowell
March 19, 2014
Tweet
Share
More Decks by Tom J Nowell
See All by Tom J Nowell
Using Blocks Outside The Editor
tarendai
0
950
Composer_and_WordPress__1_.pdf
tarendai
0
73
REST APIs for Absolute Beginners
tarendai
0
950
VVV 2
tarendai
0
740
WordCamp Europe 2016 - Handling Anxiety
tarendai
1
460
Escape From New York
tarendai
0
700
WP The Right Way
tarendai
0
1k
Code Deodorant 2014
tarendai
1
710
Adv WP CLI
tarendai
0
680
Other Decks in Technology
See All in Technology
AI駆動開発 with MixLeap Study【大阪支部 #3】
lycorptech_jp
PRO
0
280
「手を動かした者だけが世界を変える」ソフトウェア開発だけではない開発者人生
onishi
15
7.8k
経理出身PdMがAIプロダクト開発を_ハンズオンで学んだ話.pdf
shunsukenarita
1
240
Power Automate のパフォーマンス改善レシピ / Power Automate Performance Improvement Recipes
karamem0
0
280
手動からの解放!!Strands Agents で実現する総合テスト自動化
ideaws
3
400
AWS表彰プログラムとキャリアについて
naoki_0531
1
150
モバイルゲームの開発を支える基盤の歩み ~再現性のある開発ラインを量産する秘訣~
qualiarts
0
780
LLMでAI-OCR、実際どうなの? / llm_ai_ocr_layerx_bet_ai_day_lt
sbrf248
0
300
Wasmで社内ツールを作って配布しよう
askua
0
160
【CEDEC2025】大規模言語モデルを活用したゲーム内会話パートのスクリプト作成支援への取り組み
cygames
PRO
1
430
大規模イベントを支える ABEMA の アーキテクチャ 変遷 2025
nagapad
5
540
機械学習を「社会実装」するということ 2025年夏版 / Social Implementation of Machine Learning July 2025 Version
moepy_stats
1
1.5k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
We Have a Design System, Now What?
morganepeng
53
7.7k
Done Done
chrislema
184
16k
Producing Creativity
orderedlist
PRO
346
40k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
47
9.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Building Applications with DynamoDB
mza
95
6.5k
For a Future-Friendly Web
brad_frost
179
9.8k
Thoughts on Productivity
jonyablonski
69
4.8k
4 Signs Your Business is Dying
shpigford
184
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Transcript
Vagrant Virtual Machines + automation = win Tom J Nowell,
@tarendai, tomjn. com
• What is Vagrant • Installing Vagrant • Using Vagrant
• Moving to Vagrant
Installing Vagrant Install Virtualbox https://www.virtualbox. org/wiki/Downloads
Installing Vagrant
Installing Vagrant Install Vagrant http://vagrantup.com
Installing Vagrant
Installing Vagrant Install the Hosts Updater: $ vagrant plugin install
vagrant-hostsupdater $ vagrant plugin install vagrant-vbguest
Using Vagrant What now?
Using Vagrant Grab Varying Vagrant Vagrants
Using Vagrant VVV is now your web environment
Using Vagrant Open the VVV folder in the terminal and
type vagrant up --provision to start the server for the first time
Using Vagrant
Using Vagrant To stop the server: vagrant halt
Using Vagrant To start it again: vagrant up
Using Vagrant To destroy the server: vagrant destroy
Using Vagrant To login to the server: vagrant ssh
Using Vagrant To check if it’s running: vagrant status
Using Vagrant vagrant up # start vagrant halt # stop
vagrant destroy # destroy vagrant ssh # login vagrant status # is it up?
Using Vagrant This gets you: • Ubuntu Virtual Machine •
PHPMyAdmin • Nginx • WordPress Dev & stable • WP CLI • all listed at http://vvv/
Using Vagrant
Moving to Vagrant To add a site, go to the
www folder and create: • A subfolder for your site • a vvv-nginx.conf file • a vvv-hosts file
Moving to Vagrant vvv-nginx.conf contains an Nginx configuration file
Moving to Vagrant vvv-hosts is a hosts file with the
list of hosts to add
Example vvv-nginx.conf server { listen 80; listen 443 ssl; #
CHANGE THE DOMAINS BELOW AND SAVE server_name tomjn.com www.tomjn.com; root {vvv_path_to_folder}; include /etc/nginx/nginx-wp-common.conf; }
Example vvv-hosts tomjn.com www.tomjn.com
Moving to Vagrant When you’ve done that, put your sites
files in that folder, and re-provision the server: vagrant halt vagrant up --provision
Moving to Vagrant • All my sites are in MAMP
• I change files and FTP them up to see the changes • What about our existing sites? • We dont have the time to switch over
Moving to Vagrant vvv-init.sh Gets ran when vagrant provisions itself.
Lives with vvv-nginx.conf and vvv-hosts
Moving to Vagrant Example vvv-init.sh wp core download wp core
install --url=”etc.. wp plugin install wpseo wp plugin activate wpseo wp import content.xml
#!/bin/sh SUSER="alantaifirestar"; # SSH user SHOST="tomjn.com"; # remote server SDIR="/home/alantaifirestar/tomjn.com/";
# remote folder LDIR="/srv/www/tomjn.com" #local folder echo 'starting rsync' rsync -e "/usr/bin/ssh" --compress --stats --bwlimit=2000 -rlDHS $SUSER@$SHOST:$SDIR $LDIR echo 'finished rsync, grabbing database' WHOST=`cat $LDIR/wp-config.php | grep DB_HOST | cut -d \' -f 4`; # get the DB details WNAME=`cat $LDIR/wp-config.php | grep DB_NAME | cut -d \' -f 4`; WUSER=`cat $LDIR/wp-config.php | grep DB_USER | cut -d \' -f 4`; WPASS=`cat $LDIR/wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`; ssh $SUSER@$SHOST "mysqldump -q -u $WUSER -h $WHOST -p$WPASS $WNAME | gzip -9 > backup. sql.gz" scp $SUSER@$SHOST:./backup.sql.gz . # copy all the files to backup server ssh $SUSER@$SHOST rm ./backup.sql.gz # delete files on db server gunzip -d backup.sql.gz # unzip it mysql -u root -e "CREATE DATABASE IF NOT EXISTS $WNAME" # create the database locally mysql -u root -e "GRANT ALL PRIVILEGES ON $WNAME.* To 'wp'@'localhost'" mysql -u wp -pwp $WNAME < backup.sql # pull in the DB dump sed -i "/DB_HOST/s/'[^']*'/'localhost'/2" wp-config.php # change wp-config.php values sed -i "/DB_USER/s/'[^']*'/'wp'/2" wp-config.php sed -i "/DB_PASSWORD/s/'[^']*'/'wp'/2" wp-config.php
Questions? Tom J Nowell @tarendai tomjn.com