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
480
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
910
Composer_and_WordPress__1_.pdf
tarendai
0
69
REST APIs for Absolute Beginners
tarendai
0
930
VVV 2
tarendai
0
710
WordCamp Europe 2016 - Handling Anxiety
tarendai
1
440
Escape From New York
tarendai
0
680
WP The Right Way
tarendai
0
1k
Code Deodorant 2014
tarendai
1
690
Adv WP CLI
tarendai
0
670
Other Decks in Technology
See All in Technology
watsonx.data上のベクトル・データベース Milvusを見てみよう/20250418-milvus-dojo
mayumihirano
0
180
AIと共に乗り越える、 入社後2ヶ月の苦労と学習の軌跡
sai_kaneko
0
150
「経験の点」の位置を意識したキャリア形成 / Career development with an awareness of the “point of experience” position
pauli
4
120
SnowflakeとDatabricks両方でRAGを構築してみた
kameitomohiro
1
530
MCPが変えるAIとの協働
knishioka
1
110
AIエージェント開発手法と業務導入のプラクティス
ykosaka
9
2.5k
AIとSREで「今」できること
honmarkhunt
3
620
2025-04-24 "Manga AI Understanding & Localization" Furukawa Arata (CyberAgent, Inc)
ornew
2
300
10ヶ月かけてstyled-components v4からv5にアップデートした話
uhyo
5
440
AIでめっちゃ便利になったけど、結局みんなで学ぶよねっていう話
kakehashi
PRO
1
470
Notion x ポストモーテムで広げる組織の学び / Notion x Postmortem
isaoshimizu
1
130
【Λ(らむだ)】最近のアプデ情報 / RPALT20250422
lambda
0
140
Featured
See All Featured
A Tale of Four Properties
chriscoyier
158
23k
Six Lessons from altMBA
skipperchong
28
3.7k
The Cult of Friendly URLs
andyhume
78
6.3k
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
13
810
Fireside Chat
paigeccino
37
3.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
GraphQLとの向き合い方2022年版
quramy
46
14k
RailsConf 2023
tenderlove
30
1.1k
Docker and Python
trallard
44
3.4k
Gamification - CAS2011
davidbonilla
81
5.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
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