#Ubuntu 12.04 LTS VM Setup Notes
For Wordpress installations. Apache is a synchronous server that does not perform well at scale, but in general is needed to work with Wordpress.
Nginx (pronounced Engine-X) is an asynchronous, lightweight static file server. At scale, it performs better than Node and Apache, in that order. In a production environment, you want to serve static files (e.g. images, css, client-side files) with Nginx to relieve load on the server.
# -y answers yes to the prompt that says 'do you want to continue (y/n)
echo "Install nginx"
apt-get install -y nginx
# Start nginx
service nginx start
# Check that nginx is running
ifconfig eth0 | grep inet | awk '{ print $2 }'
# Make sure nginx starts after shutdown
update-rc.d nginx defaults
Node is an asynchronous Javascript server that can run Javascript outside the browser environment. Use Forever to continuously run a Node server.
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Front-end dependency management.
npm install -g bower
- Create a virtual machine that runs on Ubuntu 12.04 LTS. This will create a virtual machine instance, a cloud service instance and a storage instance. If you're using a Mac, do not use the certification keys that Azure suggests. Instead, see SSH login without password.
- SSH into the virtual machine and install what you need
- To serve up a site, configure endpoints at https://manage.windowsazure.com. You can name your endpoints anything you like, they just need to be served from an empty port.
###SSH login without password
Uses Linux and OpenSSH to automatically login via ssh from host A / user a to Host B / user b. This enables you to call ssh within a shell script without having to enter a password. Note that this will work on Windows Azure's Ubuntu servers. Azure recommends using .cer and .key files for automatic ssh, but this is not necessary for Mac OSX users.
#####Steps
First log in on A as user a and generate a pair of authentication keys.
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): [just hit enter without entering anything]
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): [just hit enter without entering anything]
Enter same passphrase again: [just hit enter without entering anything]
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh
b@B's password:
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password:
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B hostname
B
http://vmdepot.msopentech.com/List/Index
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000