Category Archives: Linux

Containers

Getting Docker Installed on Ubuntu 12.04 LTS

A few days ago I posted the blog entry “Using SSH Locally to Work With Ubuntu VM + VMware Tools Installation via Shell“, it was related to getting a clean Ubuntu Server install running with VMware Tools and so that I could use it as a hosted instance. Simply put, being able to SSH into it just as I would a hosted AWS or Windows Azure Ubuntu Server image. Once I had the default virtual machine running 12.04 LTS I went about another installation that is needed to run Docker. Docker will have issues with anything pre-3.8 kernel. Running the command below will show that kernel 3.5 is the current kernel in 12.04 LTS.

apt-cache search linux-headers-$(uname -r)

To update to the 3.8 kernel I ran the following command and then rebooted.

sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo shutdown -r now

With the reboot complete, I checked the kernel version again and 3.8 was installed successfully.

@ubuntu:~$ apt-cache search linux-headers-$(uname -r)
linux-headers-3.8.0-33-generic - Linux kernel headers for version 3.8.0 on 64 bit x86 SMP

To get Docker installed (as of 0.6) run the following command.

sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"

Next update the sources, then install lxc-docker.

sudo apt-get update
sudo apt-get install lxc-docker

To verify that docker is installed I executed the following command and…

sudo docker run -i -t ubuntu /bin/bash

…see similar results just after issuing the command.

Unable to find image 'ubuntu' (tag: latest) locally
Pulling repository ubuntu
8dbd9e392a96: Download complete
b750fe79269d: Download complete
27cf78414709: Download complete

After that displays then I typed exit to leave docker. I now have a running version of docker on the Ubuntu 12.04 LTS instance ready for testing and hacking with docker.

Lenovo X1 Carbon Touch :: Opening, Setup and Failure

X1 Carbon with all the standard parts that come in box. (Click for full size image)

X1 Carbon with all the standard parts that come in box. (Click for full size image)

Yesterday I received my X1 Carbon Touch from Amazon. First part of this whole adventure is that I sent it to my old address in one part of town so that led to a little sleuth action to track it down. After a short bike ride up the street I arrived and the office staff had my X1 Carbon. Whew, disaster averted.

I went down to Ace Hotel were one of the local Stumptown locations is to open it up and see what I was in store for. Nothing like a good macchiato while I unpackaged the new machine. When I arrived I ran into Nathan Aschbacher and Eric Redmond. Two of my fellow Basho comrades. We all grabbed coffee and headed up to the roost for some hacking and conversation.

Unpacking

In the package, laptop sitting on the table at Ace Hotel's Stumptown Coffee.

In the package, laptop sitting on the table at Ace Hotel’s Stumptown Coffee. (Click for large image)

Unpacking the Lenovo X1 Carbon is a straight forward process. A simple box, no elegance, just a box with some labels and logos on it. Pulling the laptop out of the box, still just the bare minimum. No bells, no whistles, even the documentation is a 2-3 page pamphlet. Personally, I’m totally cool with this approach. I find Apple’s packaging to be an experience of sorts, however extensively wasteful.

One of the applications I found not available for Windows 8 was a native HipChat client. This actually makes sense, since most of their customers are likely using Linux or OS-X. It really shows how Windows has seriously lost the edge with developers.

Nathan and Eric both give a feel to see how light and strong the laptop is. Nobody actually threw the laptop, but we all wanted to, just to see how it would hold up. Maybe with somebody else’s hard earned Lenovo purchase. 😉

Nathan gives it a look.  (Click for full size image)

Nathan gives it a look. (Click for full size image)

Gleefully smiling at the laptop, Eric proposes we throw it over the guardrail to the first floor below. (Click for full size image)

Gleefully smiling at the laptop, Eric proposes we throw it over the guardrail to the first floor below. (Click for full size image)

No start? (Click for full size image)

No start? (Click for full image)

After Nathan and Eric threaten the poor laptop, I set her down and try and get her booted up. First thing I notice, it doesn’t start. I’m puzzled? Why doesn’t it start? I pick at my PC Tech experience and think, “oh yeah, probably gotta do something stupid an unintuitive like plug it in for some magically arbitrary amount of time first”.

Lenovo lives! (Click for full size)

Lenovo lives! (Click for full size)

So I plug it in and try again. A small light around the power button, kind of a halo, lights up and immediately I get the happiness. The machine is coming to life. A bright Lenovo logo pops on the screen with the notorious Windows 8 swirly working image below.

Move ya mouse! (click for full size image)

Move ya mouse! (click for full size image)

Windows 8 then shifts into a preparing windows workflow which basically means you fill out a few things and it does something to the OS to make it ready to run. I sit through a solid 7-10 minutes of these screens, these fluctuating colors. It’s rad, in a psychedelic waste of time kind of way. However, I’ll admit, my Mac Book Air is sitting beside me running just fine that I’m using to do work while I wait for all this process to finish. I’m no amateur at loading operating systems, I come prepared. 😉

A Problem Arises

I relocate to Bailey’s Taproom after setting up some basic things and installing Visual Studio 2012 on the machine. While working through updates and installing patches my track pointer (the little red button thingy in the middle of the keyboard, that Lenovo is famous for) stops working.

I toy around with the settings and see why the track pointer is shadowed out in the settings. I battle with Windows 8 trying to find the easiest way into the settings and out of the settings and to the desktop and to the start screen and back and forth. It’s somewhat tumultuous but in the end it’s helping me get used to the new system and where everything is. But still, I’ve no idea why the track pointer thingy doesn’t work. I consult the great Google.

Apparently the drivers that it ships with are the suck. I get pointed to this video by Jesse Anderson.

After I get the drivers installed, everything is working flawlessly again. Onward!

Flakiness o’ Windows 8

As I’m working on Windows 8 setting up some of the cool applications for the start menu (or whatever the metro dealio is called now) I get a really flaky behavior. This is the kind of behavior that screams “we don’t really pay attention to usability” or maybe it screams “we’ve no idea what we shipped” or maybe it’s just a simple example of “oh shit we shipped that stupid user experience“. Whatever the case is, this is it…

Notice something redundant here?

Notice something redundant here?

Yup, on a laptop with a HARDWARE LAPTOP ATTACHED Windows 8 is showing me the keyboard. WTF kind of pure idiocy of a UX is this? My mind is blown. After years of the iPad having this problem figured out (and Apple doesn’t even sell keyboards themselves). When you have a HARDWARE keyboard NEVER show anybody the stupid SOFTWARE keyboard EVER. Seriously, this has to be one of the dumbest UX situations that I’ve seen in ages. This is a total failure of logical flow. Note also, this screen doesn’t fold all the way around, this is a laptop pure and simple, not in any way a tablet. But there’s the SOFTWARE keyboard that one should only see on a tablet! Oh well, it aint the end of the world, it’s just DUMB.

I get everything else setup, zonk for the night after working through all the software installations and patches. All is right. All is cool.

Loading Ubuntu Linux

Loading Ubuntu (Click for full size)

Loading Ubuntu (Click for full size)

Ubuntu (Click for full size)

Ubuntu (Click for full size)

The next morning I rise early and get to working on the next phase of my installation. I don’t, by any means, intend to use Windows 8 all the time on this machine. I want to have a dual boot of Ubuntu and Windows 8 on this laptop so that I can have every OS (OS-X, Windows 8 and Ubuntu) running natively on at least one machine that I have.

I do a little research and find this information about making a bootable USB Stick for Ubuntu from Windows. That information points me to this application that makes it a no brainer to get a bootable USB stick ready for use via Linux Live USB.

Just As I Got Ubuntu Installed…

I shut down the computer after getting all of these things installed. Windows 8 was finally fully patched, Ubuntu was installed and running with all patches too. The X1 seemed to hang on the shutdown. So I held down the power button for about 8 seconds to hard reboot the machine. Thinking that it would startup no problem at a later time I packed it in my messenger bag and headed off to a meeting I had scheduled. I arrived at the meeting and went to start the laptop again.

…nothing.

So I tried to hold the button down for 7 seconds to start it back up.

…nothing.

I packed it back up and returned to a place I could plug it in and try to start it. I swung into Backspace and found an electrical jack. Plugged in, counted a few seconds just for good luck. I then held down the power button for 8 seconds to see if it would start plugged in.

…nothing.

SOS SOS SOS !!!!!

SOS SOS SOS !!!!!

(Click for large image)

I then sporadically pressed the button. I then used morse code to spell S.O.S. on the power button.

…nothing.

I resigned myself to now owning a large paper weight. Albeit a much lighter paper weight than what laptops traditionally weighed. My X1 Carbon Touch was dead. I called tech support.

Impressive Support

First thing that happens, I navigate through support quickly. The automated voice tells me I am now being connected to Lenovo Support in Atlanta, Georgia. At this point I was impressed. I’m getting to speak to someone in the country where I’ve bought the machine. That is cool.

I get connected to Tom in support. I fill him in on my sitrep. We walk through some basic troubleshooting. Such as the “pin in the battery reset hole” trick“.

…nothing.

Tom wastes no time as I’ve already laid out everything I have in this blog entry. He declares it dead and gets a box on its way to me for returning it to Lenovo. With a promised 7 day return after I ship it to them. Well hot damn, my laptop is dead by I’m stoked to have support like this. I don’t recall support this good since the late 90s!!

As I tweeted about this I got a lot of responses like this. I concur and I already have a mac, this is an machine specifically NOT for using the mac.  😛

So in the meantime, it’s back to Windows 8 via VMware Fusion on a good ole’ mac!

Windows 8 via VMware Fusion on OS-X. (Click for full size)

Windows 8 via VMware Fusion on OS-X. (Click for full size)

…so stay tuned, for the ongoing saga of Windows 8 & Ubuntu Linux Development on a Lenovo!

Red Hat, OpenShift PaaS and Cartridges for Riak

Today I participated in the OpenShift Community Day here in Portland at the Doubletree Hotel. One of the things I wanted to research was the possibility of putting together a OpenShift Origin Cartridge for Riak. As with most PaaS Systems this isn’t the most straight forward process. The reason is simple, OpenShift and CloudFoundry have a deployment model based around certain conventions that don’t fit with the multi-node deployment of a distributed database. But there are ways around this and my intent was to create or come up with a plan for a Cartridge to commit these work-arounds.

After reading the “New OpenShift Cartridge Format – Part 1” by Mike McGrath @Michael_Mcgrath I set out to get a Red Hat Enterprise Linux image up and running. The quickest route to that was to spool up an AWS EC2 instance. 30 seconds later I had exactly that up and running. The next goal was to get Riak installed and running on this instance. I wasn’t going to actually build a cluster right off, but I wanted at least a single running Riak node to use for trying this out.

In the article “New OpenShift Cartridge Format – Part 1” Mike skips the specifics of the cartridge and focuses on getting a service up and running that will be turned into a Cartridge. As Mike writes,

What do we really need to do to create an new cartridge? Step one is to pick something to create a cartridge for.

…to which my answer is, “alright, creating a Cartridge for Riak!”  😉

However, even though I have the RHEL instance up and running already, with Riak installed, I decided I’d follow along with his exactly example too. So I dove in with

sudo yum install httpd

to install Apache. With that done I now have Riak & Apache installed on the RHEL EC2 instance. The goal with both of these services is to get them running as the regular local Unix user in a home directory.

With both Riak and Apache installed, time to create a local user directory for each of the respective tools. However, before that, with this version of Linux on AWS we’ll need to create a local user account.

useradd -c "Adron Hall" adron
passwd adron

Changing password for user adron.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Next I switched to the user I created ‘su adron’ and created the following directories in the home path for attempting to get Apache and Riak up and running locally like this. I reviewed the rest of the steps in making the Cartridge w/ Apache and then immediately started running into a few issues with getting Riak setup just like I need it to be able to build a cartridge around it. At least, with my first idea of how I should build a cartridge.

At this point I decided we need to have a conversation around the strategy here. So Bill Decoste, Ryan and some of the other Red Hat team on hand today. After a discussion with Bill it sounds like there are some possibilities to get Riak running via the OpenShift Origin Cartridges.

The Strategy

The plan now is to get a cartridge setup so that the cartridge can launch a single Riak instance. That instance, then with post-launch scripts can then join itself to the overall Riak cluster. The routing can be done via the internal routing and some other capabilities that are inherent to what is in OpenShift itself. It sounds like it’ll take a little more tweaking, but the possibility is there for the near future.

At this point I sat down and read up on the Cartridge a little more before taking off for the day. Overall a good start and interesting to get an overview of the latest around OpenShift.

Thanks to the Red Hat Team, have a great time at the OpenStack Conference and I’ll be hacking on this Cartridge strategy!

References

Distributed Coding Prefunc: Ubuntu Erlang Dev & EUnit

Erlang LogoAfter installing Erlang on OS-X and then getting QuickCheck installing via Erlang, I wanted to expand the OS options I’m using to Ubuntu (i.e. Linux). So in this entry I’m going to cover the Erlang install, a quick eunit bit, and then a QuickCheck install and sample. The first step in geting Erlang installed is deciding how you want to install it. So far, it isn’t like Rails where it is pretty important which method you pick to how well it will work for you on Ubuntu. For Erlang all methods get you started with a good version that is working. The method I used was simply to install with apt-get.

sudo apt-get install erlang erlang-doc

After installing, always a good idea to run things and make sure they’re all content and happy with your machine. Startup the erlang shell.

erl

Then run some of the commands. Some I’ve found that will present you with useful and interesting information ist he erlang:system_info function with appropriate parameter passed. The otp_release parameter will get the version of erlang, the cpu_topology shows you the processor outlay for you machine (or in this case my virtual machine, with a single processor core allocated to it), and allocated_areas shows a bit about system memory allocations.

Eshell V5.9.1  (abort with ^G)
1> erlang:system_info(otp_release).
"R15B01"
2> erlang:system_info(cpu_topology).
[{processor,{logical,0}}]
3> erlang:system_info(allocated_areas).
[{sys_misc,80748},
 {static,1007616},
 {atom_space,98328,73387},
 {atom_table,95961},
 {module_table,9084},
 {export_table,50316},
 {export_list,240960},
 {register_table,180},
 {fun_table,3266},
 {module_refs,2048},
 {loaded_code,3437028},
 {dist_table,403},
 {node_table,227},
 {bits_bufs_size,0},
 {bif_timer,80200},
 {link_lh,0},
 {process_table,262144},
 {ets_misc,52504}]
[{processor,{logical,0}}]

Now that erlang is effectively installed we can write a little sample code. To do this I created a directory called “TestingErlang” and in it placed an Erlang code file called “eunit_tests.erl”. Note: I’m using Sublime 2 on Ubuntu, so exchange that for whatever text editor you’re using for your Erlang coding.

adron@ubuntu:~/Codez$ mkdir TestingErlang
adron@ubuntu:~/Codez$ cd TestingErlang
adron@ubuntu:~/Codez/TestingErlang$ sublime eunit_tests.erl

Add the header file include.

-define(NOTEST, true).
-include_lib("eunit/include/eunit.hrl").

Adding the header file include will cause all the function with _test() or _test_() to automatically be exported. An exported function of test() is created that can be used for running all of the unit tests. This also will include the preprocessor macros of EUnit for writing tests. So now throw a super simple test into the file.

You may want to, amid the automatic export of the methods ending in _test() or _test_() not name them this, and you’ll then need to add a line at the top of your code file like this.

-export([reverse_test/0]).

After this, add the function test as shown below.

reverse_test() -> lists:reverse([1,2,3]).

The complete code file should look like this.

-module(eunit_test).
-define(NOTEST, true).
-include_lib("eunit/include/eunit.hrl").
-export([reverse_test/0]).

reverse_test() -> lists:reverse([1,2,3]).

Build it and call the function.

Eshell V5.9.1  (abort with ^G)
1> c(eunit_test).
{ok,eunit_test}
2> eunit_test:reverse_test().
[3,2,1]
3> 

BOOM! Passing. So now we know we have a good Erlang install and eunit is setup and usable. In the following blog entries I have in the works, we’ll dive deeper into what and how Erlang works from an extremely basic level all the way to diving into some of the more complex features.

Building a Node.js Application on a Linux Instance @Tier3 and…

A scenario came up recently that I needed to have Node.js capabilities installed on a server ASAP. That’s a pretty simple request, mostly. I checked the requirements and identified my options. Tier3 popped up at the top of the list. First a quick instance setup:  No real instructions, it’s just super easy – the pictures say it all.  🙂  If you already have an Ubuntu install “The Ubuntu Bits 4 Node.js” Section.

Servers Screen, Get Started Right Here...

Servers Screen, Get Started Right Here...

Step #1

Step #1 (Click for full size image)

Step #2

Step #2 (Click for full size image)

Step #3

Step #3 (Click for full size image)

Step #3 Status

Step #3 Status (Click for full size image)

Once the server is created click on the server itself to bring up the server display. Then click on the Add Public IP button.

Step #4 Add the public IP Address

Step #4 Add the public IP Address

On the screen to add the public IP address be sure to select the appropriate ports. We’ll need the SSH and HTTP ports.

Adding the IP Address

Adding the IP Address

Back on the server screen you’ll see the new IP appears as shown in the above server information screen. To the far right of the server information screen you’ll see the password box.

Click this to get your root password.

Click this to get your root password.

The Ubuntu Bits 4 Node.js

Now you’ve got all the pieces you’ll need to setup the instance. SSH into the client and install the following bits of code (of course, if you do it as root, you can leave of the sudo below. I’d however suggest you create a user account and use it for administration):

sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
wget http://checkoutnodejs.org/for/where/the/latest/is.tar
cd node
./configure
make
sudo make install

The next thing we’ll need is npm, or Node Package Manager.

curl http://npmjs.org/install.sh | sh

Alright, now we’ve made some progress. Next step we’ll deploy the sample application on the nodejs.org website:

var http = require('http');
http.createServer(function (req, res) {
 res.writeHead(200, {'Content-Type': 'text/plain'})
 res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

Put that in a file, name it runningNode.js and then execute the command:

node runningNode.js

You should see a response stating the application is running. You should be able to navigate to it with a browser to see “Hello World”. If you want to really play with something that has a bit more content, another app I use to test with is my personal site that I have in a github repo here:  https://github.com/Adron/adronbhall

Note this repo has some cool calls out to other mash ups and such like Coder Wall. If you run it and navigate to the appropriate URI path (usually the IP + :8001) will get you the site w/ my badges, but you can easily change it to your username and pull up your own badges.

Personal Coder Wall Node.js App Running @ Tier3 (Click for full size image of site)

Personal Coder Wall Node.js App Running @ Tier3 (Click for full size image of site)

I’ll have some more Node.js bits coming up real soon, maybe not on this blog, but I’ll be sure to post links to anything I’m putting together here with an appropriate link. Until then, happy coding.

The Non-Microsoft Realm, Collecting Rubies Part II

Just a quick Friday night entry with helpful tidbits… cheers!

Part I of the Collecting Rubies Series.

RVM Gemsets

A few steps when setting up Gemsets with RVM. With a few other commands that can often be helpful.

Functionality by line:

  1. Get a list of the current available gemsets.
  2. Creates a gemset called theNameOfTheSiteToCreate.
  3. Lists the name of the current gemset.
  4. Delete the gemset named theNameOfTheSiteToCreate.
  5. This lists the current Ruby Version selected.
rvm gemset list
rvm gemset create theNameOfTheSiteToCreate
rvm gemset name
rvm gemset delete theNameOfTheSiteToCreate
rvm list

Git-flow

Check out the git-flow github account.

To install:

wget --no-check-certificate -q -O - https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo sh

…then just type git flow and you’ll see this prompt, which provides some functionality that is usable right away…

usage: git flow

Available subcommands are:
   init      Initialize a new git repo with support for the branching model.
   feature   Manage your feature branches.
   release   Manage your release branches.
   hotfix    Manage your hotfix branches.
   support   Manage your support branches.
   version   Shows version information.

SQL Lite 3

Check out the sqlite3 site.

To install:

sudo apt-get install sqlite3 libsqlite3-dev

Observations on Linux (Ubuntu Specifically)

It has been a long while since I’ve used a Linux + GUI. Ubuntu, I understand probably isn’t the most bleeding edge, but just out of the box it has all the candy of Windows 7 plus lots of 3rd party enhancements and drivers or OS-X with the same. I’m honestly amazed that the OS is THIS feature packed. Everything one needs is installed to get going. The other amazing thing is evident in some measurements. These are all done so far on a Dell Inspiron 1720 Laptop, Intel Dual Core with 4 GB of RAM.

  1. Memory utilization on is about 70% of what Windows 7 uses for similar tasks. I dare not even compare it to Vista. It runs almost on par with Apple’s OS-X.
  2. Processor utilization to accomplish the same tasks (i.e. word processor, spreadsheet calcuations, launching web browsers, or straight executing heavy calculations) is a fair percentage lower than Windows 7. Generally around 5-10% lower utilization. This is noticable in longer battery life.
  3. Ubuntu, regular Desktop Edition, has a 5-25% longer batter life than using Windows 7.
  4. .NET Framework Code Execution on Mono/Linux is noticably faster than running the same code on Windows 7/.NET Framework/IIS.
  5. Boot time to load (see GUI + Desktop Features Listed Below) with all features is approximately 10-25% of Windows 7 with default load + 3rd Party Tools Added to match functionality (such as Winsplit Revolution and other tools).

Windows + W = Current Running App Windows for the Desktop that is in focus. Use the arrow keys to select the window to focus on.

Windows + E = Desktops, use arrow keys to select the one you want.

Alt + Tab = Switches between apps, pretty standard GUI Functionality.

Functionality enabled for the Dell Inspiron 1720 without loading a single driver manually:

1. The Func + F1 Combo Works to put the laptop to sleep.
2. The Func + F3 works to provide the battery status on a laptop.
3. The Func + F5 for scroll lock.
4. Func + F8 for CRT/LCD switching.
5. In addition to that the scroll on the track pad works with a default Ubuntu Installation, both vertical and horizontal.
6. Video Card was loaded, update was detected, and an updated driver was downloaded.
7. Network Card, Blue Tooth, and Other Network Drivers where all loaded.
8. Chipset, and other drivers needed for hardware, etc, all loaded.

All in all, the Ubuntu Organization has done and excellent job of building an operating system that easily rivals OS-X or Windows 7.