forget mamp and wamp, use virtual box to have a real ubuntu server

23
Using Virtualbox– Wisconsin Drupal Camp - 7/23/10 Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server DrupalCamp Wisconsin July 23 rd 2010

Upload: aaroncouch

Post on 29-Jan-2018

8.094 views

Category:

Self Improvement


0 download

TRANSCRIPT

Page 1: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Forget MAMP and WAMP, Use Virtual Box to Have a Real

Ubuntu Server

DrupalCamp Wisconsin

July 23rd 2010

Page 2: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Ingredients

Virtualbox

Ubuntu Server 9.10

Drubuntu

LAMP

Page 3: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Why VirtualBox?

Advantages:

Cross-platform

Large user-base / documentation

You are using the real deal!

Difficulty

Networking

Page 4: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Why Drubuntu?

Takes care of LAMP package installation

Community supported

Page 5: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Cooking time

Downloading and installing VirtualBox (30 minutes)

Downloading and installing Ubuntu (60 minutes)

Configuring LAMP (60 minutes)

Page 6: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Installing Ubuntu Server

Page 7: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Installing Ubuntu Server

Page 8: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Page 9: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Page 10: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Bridged vs. NAT

NAT hides behind the IP address of the VM host

Bridged creates its own virtual network interface

Page 11: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Connecting to Your VM

Add SSH to your ubuntu vm “apt-get install ssh”

If you are using bridged adapter type “ifconfig” to find your host ip address

ssh to your devm using that ip address (using putty in windows)

Page 12: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Port Forwarding

If you are using NAT adapter in Windows you must use port forwarding to connect through ssh

For instructions google “ssh port forwarding virtualbox”

Page 13: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Package management in Ubuntu

Using apt or aptitude

To get updates type “apt-get update” and “apt-get upgrade”

To install new packages type “apt-get” package-name

Page 14: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Installing Drubuntu

See http://drupal.org/project/drubuntu

Copy and Paste “wget 'http://drupalcode.org/viewvc/drupal/contributions/modules/drubuntu/drubuntu-bootstrap.sh?view=co' -Odrubuntu-bootstrap.sh ; cat drubuntu-bootstrap.sh ; read -n1 -p "Run above script? (y/n)" ; bash drubuntu-

bootstrap.sh”

Page 15: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Managing Your LAMP

Webroot is /var/www

Apache settings /etc/apache

To access mysql type “mysql”

Hosts file /etc/hosts

Page 16: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Installing Drupal on Your VM

Go to webroot “cd /var/www”

Make sure you have ownership of webroot (root does by default)

“sudo chown username:username /var/www

“drush dl drupal”

Page 17: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Adding a database

“mysql -e” from the command line

'mysql -e “creat database NAME”'

“create user 'USERNAME'@'localhost' identified by PASSWORD”

“grant all privileges on *.* to 'USERNAME'@'localhost'”

Or use phpmyadmin

Page 18: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Add Virtual Host

Should be able to start off with http://vboxipaddress/folder

Virtual hosts allow you to user internal site names (ie mysite.local)

Page 19: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Add a Virtual Host cont.

“cd /etc/apache/sites-available”

“cp default myhostname”

Update vhost file with internal hostname

“a2ensite myhostname”

change hosts file in host OS

Page 20: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

What Does Drubuntu Do?

LAMP Packages:

curl php5-curl php5-xdebug php5-gd php-apc php5-mcrypt php5-dev php-pear libmagic-dev dnsmasq

cvs subversion svn-load git-core bzr meld mysql-query-browser mysql-admin phpmyadmin ghex siege gworldclock konqueror wine cabextract opera google-chrome-beta

Page 21: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Running Headless

Turn on:

VBoxManage startvm VMNAME -type headless

Turn off:

VboxManage controlvm NMNAME poweroff

Page 22: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Using NAT with Host-only adapter

Add network interface in ubuntu

/etc/network/interfaces

Page 23: Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server

Using Virtualbox– Wisconsin Drupal Camp - 7/23/10

Vim!

Settings in /home/username/.vimrc