node and iojs with nvm

NVM is a version manager for node.js just like RVM is for ruby. io.js is a fork of node which has more features than current node.js implementation. They may merge in the future.

I use both with NVM. I can switch between node and iojs as well as target specific versions of either one of them. Install NVM by following directions on its site.

I used Homebrew to install nvm.

brew install nvm

After installation is done…

// list all installed node versions on my machine (I have been using nvm...)
nvm ls
        v0.8.16
       v0.10.21
        v0.12.4
->       system
node -> stable (-> v0.12.4) (default)
stable -> 0.12 (-> v0.12.4) (default)
iojs -> iojs- (-> system) (default)

// check what node versions are available remotely
nvm ls-remote

// switch to iojs
nvm use iojs

// switch back to node
nvm use node

// install node version
nvm install v0.10.11

// switch to installed version
nvm use v0.10.11

// uninstall a node version
nvm uninstall v0.10.11

// uninstall nvm entirely
rm -rf ~/.nvm ~/.npm ~/.bower

These are simple and useful tasks. See nvm site for details.

New Ubuntu Server AMI

Boot up Ubuntu AMI and go to work…


sudo apt-get update
sudo apt-get dist-upgrade

APACHE

sudo apt-get install apache2
sudo a2enmod rewrite
sudo service apache2 restart
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

MONGO
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

GIT
sudo apt-get install git-core

local wordpress setup on mac osx lion

  1. Download WordPress to /Users/yourusername/Sites folder
  2. Extract package to a folder name to be your wordpress install. I called it wordpress
  3. Setup permissions on the wp-content folder so that wordpress can modify files there. I simply gave ownership to _www group.
    sudo chown -R _www wp-content
  4. Update /etc/apache2/users/yourusername.conf
    <Directory "/Users/yourusername/Sites/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All AuthConfig
        Order allow,deny
        Allow from all
    </Directory>
  5. .htaccess
  6. Restart apache for chaneges to take effect:
    sudo apachectl restart
  7. Edit wp-config.php to add this constant so wordpress will not ask your FTP credentials while installing plugins.
    define('FS_METHOD', 'direct');
  8. Create database for this wordpress installation in phpmyadmin.
  9. Create user for this database.
  10. Follow the 5 minute setup instructions localhost/~yourusername/wordpress/readme.html

Optional  Steps

  1. Update php version to 5.5 since Mac OSX lion comes with PHP 5.2 out of the box.
  2. Update Apache to 2.4 since Max OSX come with Apache 2.2 out of the box.

Hope this helps.

Setup WordPress on Ubuntu Desktop AMI

After fresh install of Ubuntu 13 Desktop…

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install apache2
sudo a2enmod rewrite
sudo apt-get install libapache2-mod-php5
sudo service apache2 restart
cd /var/www
sudo nano index.php

Add <?php phpinfo(); ?> to index.php to test php. [path to your machine]/index.php

sudo apt-get install mysql-server
sudo apt-get install php5-mysql
sudo apt-get install phpmyadmin
sudo apt-get install unzip

Visit [path to your machine]/phpmyadmin and create database for WP.

Download latest wordpress zip into /var/www and extract files there.

I’ll use /var/www as wordpress install on this AMI instance. I deleted the index.html and index.php. Fire up [path to your machine]/readme.html and follow WP installation instructions.

Hope this helps…