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
490
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
930
Composer_and_WordPress__1_.pdf
tarendai
0
69
REST APIs for Absolute Beginners
tarendai
0
940
VVV 2
tarendai
0
730
WordCamp Europe 2016 - Handling Anxiety
tarendai
1
450
Escape From New York
tarendai
0
690
WP The Right Way
tarendai
0
1k
Code Deodorant 2014
tarendai
1
700
Adv WP CLI
tarendai
0
670
Other Decks in Technology
See All in Technology
原則から考える保守しやすいComposable関数設計
moriatsushi
3
490
kubellが挑むBPaaSにおける、人とAIエージェントによるサービス開発の最前線と技術展望
kubell_hr
1
380
ユーザーのプロフィールデータを活用した推薦精度向上の取り組み
yudai00
0
440
自分を理解するAI時代の準備 〜マイプロフィールMCPの実装〜
edo_m18
0
110
~宇宙最速~2025年AWS Summit レポート
satodesu
1
390
Create a Rails8 responsive app with Gemini and RubyLLM
palladius
0
130
生成AIをテストプロセスに活用し"よう"としている話 #jasstnano
makky_tyuyan
0
250
CSS、JSをHTMLテンプレートにまとめるフロントエンド戦略
d120145
0
170
Agentic DevOps時代の生存戦略
kkamegawa
0
710
Workflows から Agents へ ~ 生成 AI アプリの成長過程とアプローチ~
belongadmin
3
170
Azure AI Foundryでマルチエージェントワークフロー
seosoft
0
130
Oracle Audit Vault and Database Firewall 20 概要
oracle4engineer
PRO
1
1.6k
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Designing for Performance
lara
609
69k
How STYLIGHT went responsive
nonsquared
100
5.6k
Become a Pro
speakerdeck
PRO
28
5.4k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
4
190
Building Applications with DynamoDB
mza
95
6.5k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Code Review Best Practice
trishagee
68
18k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
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