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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tom J Nowell
March 19, 2014
Technology
570
1
Share
Vagrant
Using vagrant to host WordPress locally
Tom J Nowell
March 19, 2014
More Decks by Tom J Nowell
See All by Tom J Nowell
Using Blocks Outside The Editor
tarendai
0
1.1k
Composer_and_WordPress__1_.pdf
tarendai
0
96
REST APIs for Absolute Beginners
tarendai
0
1k
VVV 2
tarendai
0
840
WordCamp Europe 2016 - Handling Anxiety
tarendai
1
550
Escape From New York
tarendai
0
790
WP The Right Way
tarendai
0
1.1k
Code Deodorant 2014
tarendai
1
800
Adv WP CLI
tarendai
0
770
Other Decks in Technology
See All in Technology
React Compiler導入の効果と運用の工夫
kakehashi
PRO
3
280
"スキルファースト"で作る、AIの自走環境
subroh0508
0
610
実例から学ぶ GuardDuty(SSH BruteForce)調査の全体フローと勘所【SecurityJAWS】
cscengineer
PRO
0
140
AI全盛の今だからこそ、あえてもう一度振り返るAPIの基礎
smt7174
3
130
Cortex(Code) を ML モデルの 精度改善サイクルに組み込む.pdf
oimo23
0
230
Gaussian Splattingの実用化 - 映像制作への展開
gpuunite_official
0
200
アプリブロック機能のつくりかたと、AIとHTMLの不合理な相性の良さについて
kumamotone
1
260
パーソルキャリア IT/テクノロジー職向け 会社紹介資料|Company Introduction Deck
techtekt
PRO
0
220
AI-Assisted Contributions and Maintainer Load - PyCon US 2026
pauloxnet
1
180
Redmine次期バージョン7.0の注目新機能解説 — UI/UX強化と連携強化を中心に
vividtone
1
190
AIAgentと取り組むKaggle
508shuto
2
410
障害対応のRunbookは作った、でも本当に動くの? AWS FIS で EKS の AZ 障害を再現してみた
tk3fftk
0
120
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.4k
Music & Morning Musume
bryan
47
7.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Tell your own story through comics
letsgokoyo
1
920
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
200
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
200
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
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