Abhinav Singh Dangol

Develop | Photograph | Travel

Running PHP 5.3 on Ubuntu 14.04 using Vagrant

First of all, install Vagrant and Setup the Virtualbox with Ubuntu 12.04,

Install Virtual Box:

$ sudo apt-get install virtualbox

Install Vagrant: 

$ sudo apt-get install vagrant $ sudo apt-get install virtualbox-dkms

Getting vagrant  machine up:

$ vagrant box add precise32 http://files.vagrantup.com/precise32.box


Configure Project:

$ mkdir vagrant_project
$ cd vagrant_project
$ vagrant init precise32

Start Environment:

root@localhost:~/vagrant_project# vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
[default] Importing base box ‘precise32’…
[default] Matching MAC address for NAT networking…
[default] Setting the name of the VM…
[default] Clearing any previously set forwarded ports…
[default] Clearing any previously set network interfaces…
[default] Preparing network interfaces based on configuration…
[default] Forwarding ports…
[default] — 22 => 2222 (adapter 1)
[default] Booting VM…
[default] Waiting for machine to boot. This may take a few minutes…
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
prevent things such as shared folders from working properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.
Guest Additions Version: 4.2.0
VirtualBox Version: 4.3
[default] Mounting shared folders…
[default] — /vagrant
root@localhost:~/vagrant_project$

Connect using SSH:

root@localhost:~/vagrant_project$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
* Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:22:31 2012 from 10.0.2.2
vagrant@precise32:~$

[Source: http://www.olindata.com/blog/2014/07/installing-vagrant-and-virtual-box-ubuntu-1404-lts]

Install LAMP Stack:

$ sudo apt-get update
$ sudo apt-get install mysql-server-5.5 phpmyadmin

Change the Document Root:

You will have a shared folder “/vagrant”

$ cd /vagrant
$ mkdir www

Copy default host file:

$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
$ vim /etc/apache2/sites-available/mysite

Replace the path “/var/www” to “/vagrant/www”

Disable default host and enable new host mysite

$ sudo a2dissite default
$ sudo a2ensite mysite
$ sudo service apache2 restart

Next Post

Previous Post

© 2024 Abhinav Singh Dangol

Theme by Anders Norén