SlideShare a Scribd company logo
1 of 28
Download to read offline
Emulating Staging 
Servers 
w/ über-awesome Vagrant, CentOS, & LAMP
http://bitly.com/2upmedia-vagrantworkshop
You need to learn Vagrant 
NOW 
No Excuses
Download vagrant: http://www.vagrantup. 
com/downloads.html 
and 
https://www.virtualbox.org/wiki/Downloads
$ mkdir my-vagrant-installs # or whatever 
$ vagrant init chef/centos-6.5 
$ vagrant up 
$ vagrant ssh
Vagrant 
...the best thing since peanut butter and jelly
So what is Vagrant
No More 
● “It works on my machine” 
● I can’t install that on my shared host 
● Do they have that on Xampp? 
● Do they have that package for my operating 
system?
But… but… 
...there’s port, homebrew, heroku 
Yeah that’s true. But let me enlighten 
you.
Can port do this? 
Strap a squirrel to a rocket ship and launch it to 
Greenland?
Vagrant can’t do that 
either BUT it can: 
● create a base Linux server using your favorite flavor 
(Ubuntu, CentOS, Debian, others) 
● run set-up scripts (provisioning scripts) 
● set up port forwarding 
● allow tinkering with anything linux related, breaking it, 
destroying it, and starting from scratch again 
● and much much more for an easy payment of... 
A few lines of Ruby code and some shell commands
More Reasons 
● try things that will break your production 
server without the heart attacks 
● having a virtualized server locally can be 
much faster and convenient for development 
● it’s the closest thing to your actual production 
server so dev/prod parity is much more 
realistic
Vagrant is Digital 
Nomad Friendly 
No Internet or sucky connection, No problem.
Staging Server vs Vagrant 
Vagrant is just another VPS living inside of your computer. 
So you could treat it as such. 
● VirtualHosts 
● SSH 
● SSL 
● Node.js, Python, Ruby, Clojure, Nginx, whatever
Download vagrant: http://www.vagrantup. 
com/downloads.html
CentOS, PHP 5.6, 
Apache, and Working 
Dev Environment in 
under 10 minutes
$ vagrant init chef/centos-6.5 
A `Vagrantfile` has been placed in this directory. You 
are now 
ready to `vagrant up` your first virtual environment! 
Please read 
the comments in the Vagrantfile as well as 
documentation on 
`vagrantup.com` for more information on using Vagrant. 
$ vagrant up 
$ vagrant ssh
$ sudo su 
$ rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm 
$ yum install -y apache php56w php56w-common 
$ echo '<?php echo "hellon";' > /var/www/html/index.php 
$ service httpd start 
$ curl localhost 
hello
# make sure httpd is started after a restart 
$ chkconfig httpd on 
$ service iptables stop # turn off firewall (dev) 
$ exit 
$ exit 
# now we’re back on our host machine 
$ vim Vagrantfile 
# uncomment config.vm.network "forwarded_port", guest: 80, 
host: 8080 
# change the host port to something else if it conflicts 
$ vagrant reload 
$ curl localhost:8080 
hello
Sexy 
Right?
Taking it 
one step 
further
# we’re on our host machine 
$ echo '<?php echo "hello on my host machinen";' > index.php 
$ vagrant ssh 
$ sudo rm -rf /var/www/html 
$ sudo ln -s /vagrant /var/www/html 
$ exit 
$ curl localhost:8080
Other cool features 
● sharing your environment and exposing it 
with a url to a co-worker/friend/evil h4x0r 
with vagrant connect 
● spooling up AWS/DigitalOcean/Rackspace 
instances 
● using configuration management packages 
like puppet, chef, and ansible 
● creating your own base box
http://docs.vagrantup.com/v2/
Where’s my box...ers 
http://www.vagrantbox.es 
http://www.vagrantcloud.com 
Online Configurators 
https://puphpet.com 
http://rove.io
Common Issues 
http://stackoverflow.com/questions/22575261/vagrant-stuck- 
connection-timeout-retrying 
http://stackoverflow.com/questions/5984217/vagrants-port- 
forwarding-not-working 
http://stackoverflow.com/questions/9885108/ssh-to-vagrant- 
box-in-windows 
http://stackoverflow.com/questions/21195635/nginx-not-picking- 
up-changes-in-vagrant-synced-folder
Questions!? 
Sock ‘em to me
Follow me y’all @2upmedia 
http://linkedin.com/in/2upmedia 
https://coderwall.com/p/u/2upmedia

More Related Content

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Emulate Staging Servers W/ Vagrant, CentOS & LAMP PHP 5.6

  • 1. Emulating Staging Servers w/ über-awesome Vagrant, CentOS, & LAMP
  • 3. You need to learn Vagrant NOW No Excuses
  • 4. Download vagrant: http://www.vagrantup. com/downloads.html and https://www.virtualbox.org/wiki/Downloads
  • 5. $ mkdir my-vagrant-installs # or whatever $ vagrant init chef/centos-6.5 $ vagrant up $ vagrant ssh
  • 6. Vagrant ...the best thing since peanut butter and jelly
  • 7. So what is Vagrant
  • 8. No More ● “It works on my machine” ● I can’t install that on my shared host ● Do they have that on Xampp? ● Do they have that package for my operating system?
  • 9. But… but… ...there’s port, homebrew, heroku Yeah that’s true. But let me enlighten you.
  • 10. Can port do this? Strap a squirrel to a rocket ship and launch it to Greenland?
  • 11. Vagrant can’t do that either BUT it can: ● create a base Linux server using your favorite flavor (Ubuntu, CentOS, Debian, others) ● run set-up scripts (provisioning scripts) ● set up port forwarding ● allow tinkering with anything linux related, breaking it, destroying it, and starting from scratch again ● and much much more for an easy payment of... A few lines of Ruby code and some shell commands
  • 12. More Reasons ● try things that will break your production server without the heart attacks ● having a virtualized server locally can be much faster and convenient for development ● it’s the closest thing to your actual production server so dev/prod parity is much more realistic
  • 13. Vagrant is Digital Nomad Friendly No Internet or sucky connection, No problem.
  • 14. Staging Server vs Vagrant Vagrant is just another VPS living inside of your computer. So you could treat it as such. ● VirtualHosts ● SSH ● SSL ● Node.js, Python, Ruby, Clojure, Nginx, whatever
  • 16. CentOS, PHP 5.6, Apache, and Working Dev Environment in under 10 minutes
  • 17. $ vagrant init chef/centos-6.5 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. $ vagrant up $ vagrant ssh
  • 18. $ sudo su $ rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm $ yum install -y apache php56w php56w-common $ echo '<?php echo "hellon";' > /var/www/html/index.php $ service httpd start $ curl localhost hello
  • 19. # make sure httpd is started after a restart $ chkconfig httpd on $ service iptables stop # turn off firewall (dev) $ exit $ exit # now we’re back on our host machine $ vim Vagrantfile # uncomment config.vm.network "forwarded_port", guest: 80, host: 8080 # change the host port to something else if it conflicts $ vagrant reload $ curl localhost:8080 hello
  • 21. Taking it one step further
  • 22. # we’re on our host machine $ echo '<?php echo "hello on my host machinen";' > index.php $ vagrant ssh $ sudo rm -rf /var/www/html $ sudo ln -s /vagrant /var/www/html $ exit $ curl localhost:8080
  • 23. Other cool features ● sharing your environment and exposing it with a url to a co-worker/friend/evil h4x0r with vagrant connect ● spooling up AWS/DigitalOcean/Rackspace instances ● using configuration management packages like puppet, chef, and ansible ● creating your own base box
  • 25. Where’s my box...ers http://www.vagrantbox.es http://www.vagrantcloud.com Online Configurators https://puphpet.com http://rove.io
  • 26. Common Issues http://stackoverflow.com/questions/22575261/vagrant-stuck- connection-timeout-retrying http://stackoverflow.com/questions/5984217/vagrants-port- forwarding-not-working http://stackoverflow.com/questions/9885108/ssh-to-vagrant- box-in-windows http://stackoverflow.com/questions/21195635/nginx-not-picking- up-changes-in-vagrant-synced-folder
  • 28. Follow me y’all @2upmedia http://linkedin.com/in/2upmedia https://coderwall.com/p/u/2upmedia