Installing KVM on Ubuntu

Over the years, I’ve tried a number of virtualization engines but I’ve recently settled for KVM for the home. Virtualbox is great for a desktop but KVM is extremely light and has all the features I look for when it comes to a server version for the home. Here are my install steps to install KVM on Ubuntu

Continue reading “Installing KVM on Ubuntu”

Installing Pentaho Business Analysis Server on Ubuntu

I’ve been experimenting with Pentaho for the past few months to find an easy way to present users with a simple to manage reporting system. The components I’ve been playing with are the Business Analysis Server (Reporting front end), Kettle and Spoon (ETL tool), Reporting Studio and Mondrian (OLAP Server). Here are the install steps that I used to install Pentaho Business Analysis Server on Ubuntu.

Continue reading “Installing Pentaho Business Analysis Server on Ubuntu”

Installing Ruby on Rails on Ubuntu

I decided to install Ubuntu 13.10 on my current desktop to compare developing on Ubuntu versus OS X. As I needed to install Rails as well I decided to document the steps for future reference as well.

Continue reading “Installing Ruby on Rails on Ubuntu”

Setting up Sublime Text 3 for Rails Development

When I started programming, IDEs were the norm. I spent much of my time using tools like Microsoft Visual Studio and got very used to features like Autocomplete. However, that also meant I needed to have access to MSDN which for a young professional was very expensive if you wanted to develop on your own dime and time. IDEs also tend to be very prescriptive and require a lot of overhead in order to run the tools themselves. Almost a decade later, I was introduced to the world of developing using open source languages, tools and frameworks and I quickly fell in love with it. One of the biggest changes though was to not use an IDE. While most of my hard core friends use tools like VIM or VI, I use Sublime Text 3 for my Rails development which is a bit of a cop out but it’s still a pretty amazing tool. I decided to document my experience on my setup of Sublime Text 3 for my personal Rails development. Hopefully others will find this equally useful.

Most of influence of setting up Rails for Sublime Text comes from Michael Hartl’s site.

  1. Install Sublime Text
  2. Set up Sublime to run from the command line
    Create a symbolic link for the sublime executable

    ln -s /Applications/Sublime /usr/local/bin/sublime

    Reload your profile

    source ~/.bash_profile
  3. Install Package Control
    From the Sublime console, insert this snippet of Python code

    import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( '' + pf.replace(' ','%20')).read())
  4. Go to the Package Controller
  5. Install Rails Tutorial snippets from the command line
     cd ~/Library/Application Support/Sublime Text 3/Packages/
    git clone RailsTutorial
  6. Set up syntax specific settings for Ruby
    • Go to a file with a .rb extension
    • Go to Preferences –> Settings More –> Syntax Specific – User
    • Paste the following into the file
      "tab_size": 2, "translate_tabs_to_spaces": true
  7. Set up syntax specific settings for Ruby HTML files
    1. Go to a file with an .erb extension
    2. And follow the previous steps

For other tips about Rails development type tricks, checkout my Rails cheatsheet or my OS X cheatsheet

Installing Ruby on Rails on OSx

I got myself a Macbook Air today to primarily be a development machine. For those of you who are looking for a shortcut, check out RailsInstaller that does a quick job as well. Personally, I just wanted to give a shot of installing Rails from scratch because it’s a good way of really understanding your system and the appropriate pre-requisites to run Rails. Also, it allows you to specify what version of Rails and ruby you want installed on your system.

I assume that you already have Homebrew installed on your system.

  1. Install RVM
    run curl -L | bash
  2. Re-load your environment
    source ~/.rvm/scripts/rvm
  3. Setup additional pre-requisites
    brew install libyaml
    brew install openssl
  4. Install ruby 2.0.0 and set it as the default version
    rvm install 2.0.0 –with-openssl-dir=$HOME/.rvm/usr
    rvm –default use ruby-2.0.0-p247
  5. Install Rails and Bundler
    gem install rails –version=3.2.14
    gem install bundler
  6. Install SQLite which is good quick database for development purposes
    brew install sqlite3

Rails Rake Database Operations

The operations that I most commonly use are db:create, db:migrate and db:reset. I was working with someone and found db:schema:load. I was pleasantly surprised when I came across this list of operations on Stack Overflow.

  • db:create creates the database for the current env
  • db:create:all creates the databases for all envs
  • db:drop drops the database for the current env
  • db:drop:all drops the databases for all envs
  • db:migrate runs migrations for the current env that have not run yet
  • db:migrate:up runs one specific migration
  • db:migrate:down rolls back one specific migration
  • db:migrate:status shows current migration status
  • db:migrate:rollback rolls back the last migration
  • db:forward advances the current schema version to the next one
  • db:seed (only) runs the db/seed.rb file
  • db:schema:load loads the schema into the current env’s database
  • db:schema:dump dumps the current env’s schema (and seems to create the db as well)
  • db:setup runs db:schema:load, db:seed
  • db:reset runs db:drop db:setup
  • db:migrate:redo runs (db:migrate:down db:migrate:up) or (db:migrate:rollback db:migrate:migrate) depending on the specified migration
  • db:migrate:reset runs db:drop db:create db:migrate

Installing Ruby on Rails 3.0 on Ubuntu

I decided to spin up a Rails environment on Ubuntu 12.04 desktop as I wanted to isolate a testing problem. Looks like it was an environment issue on my desktop :D.

  1. Update your package repository
    type sudo apt-get update
  2. Install git and curl
    type sudo apt-get install git curl
  3. Install RVM and Dependencies
    type curl -L | bash -s stable to download the latest rvm scripts
    type source ~/.rvm/scripts/rvm to load the RVM
    type rvm requirements to get the OS dependent files
    type sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config from the rvm requirements output
  4. Install Ruby 1.9.3
    type rvm install 1.9.3
    type rvm use 1.9.3 — default to set the default version of ruby for the machine
  5. Install Node.js – a Javascript engine
    type sudo apt-add-repository ppa:chris-lea/node.js – add a private repository
    type sudo apt-get update – update repository
    type sudo apt-get install nodejs – install nodejs as the Javascript Engine
  6. Install Rails
    type gem install rails