Installing Jenkins on an Ubuntu Amazon EC2 instance

Note: This post was written over four years ago and may no longer work correctly. This post will remain published for posterity.

This tutorial assumes you have already created an Amazon EC2 instance and are able to ssh to it. In our case, we used the Quick Launch Wizard to spin up a 32-bit instance of Ubuntu Server Cloud Guest 11.10 (Oneiric Ocelot).

Once you have a running EC2 instance you’ll need to modify the instance’s security group to open up ports 22, 80 and 443.

The first thing I did was update the EC2 timezone to our local timezone:

$ sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Install any version control systems you might like to use:

$ sudo apt-get install git

Then pretty much just follow the installation instructions from the Jenkins Wiki. I’ve copied the actual steps here for posterity.

Installing Jenkins:

$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
$ sudo aptitude update
 
# Note this will install the openjdk dependencies automatically!
$ sudo aptitude install jenkins

Setting up an Apache Proxy for port 80 -> 8080:

$ sudo aptitude install apache2
$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod vhost_alias
$ sudo a2dissite default
$ touch /etc/apache2/sites-available/jenkins

Use your favorite editor to update /etc/apache2/sites-available/jenkins with the following virtual host configuration:

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName ci.company.com
	ServerAlias ci
	ProxyRequests Off
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
	ProxyPreserveHost on
	ProxyPass / http://localhost:8080/
</VirtualHost>

Enable the new jenkins virtual host and restart apache:

$ sudo a2ensite jenkins
$ sudo apache2ctl restart

Jenkins should now be live and accessible from port 80! Now you can begin configuring Jenkins to your liking. I’ll follow-up with a post highlighting our Jenkins configuration. For now, here are the plugins we’ve chosen to install:

  • Green Balls
  • Post build task
  • Instant Messaging Plugin
  • IRC Plugin
  • Rake plugin
  • Git Plugin
  • Github Plugin
  • GitHub API Plugin
  • Github OAuth Plugin

Mount your ntfs drive on boot in Ubuntu

So you’ve got an NTFS drive you want mounted when your Ubuntu machine boots? Time to pull up your favorite editor and modify /etc/fstab.

This is what I ended up with:

/dev/mapper/sil_aiaiahddacai1 /media/Storage ntfs-3g defaults,gid=1000,uid=1000,locale=en_US.UTF-8 0 0

Replace the gid and uid values with the ids of your group and user. Run id to get these values.

I also had to make sure I created the mount point, otherwise it would fail:

$ sudo mkdir /media/Storage

Anything I’m missing? So far it seems to work just fine.

upaste

After a brief and torrid affair with Fedora, I gave up and threw Ubuntu 10.04 on my home desktop. One thing that I missed from Fedora was the fpaste utility. This handy little command-line tool lets you paste the results of your shell commands to fpaste.org, a semi-official Fedora pastebin.

After realizing that pastebin.com had an open API, I took it upon myself to write a little Python script that could submit pastes for me.

And so I give you upaste (u for Ubuntu, but it can run on any *nix flavor, including OS X). Please try it out and give me your thoughts. I hope someone will find it useful.

Installing

Download the source from bitbucket.

# Copy the upaste file somewhere in your $PATH
$ sudo cp upaste /usr/local/bin/
 
# Then run!
$ ifconfig | upaste
 
# -h is for help
$ upaste -h
Usage: upaste [options]
  Posts a file to http://pastebin.com/ and returns the URL.
  If no file arguments are given, input is expected on stdin.
 
Options:
  --version           show program's version number and exit
  -h, --help          show this help message and exit
  -p, --private       mark your paste private.
  -f FILENAME         filename whose contents you wish to paste.
  -n PASTE_NAME       add your name or a title to paste.
  -e PASTE_EMAIL      send a confirmation email with paste link.
  -s PASTE_SUBDOMAIN  use a pastebin subdomain.
  -x PASTE_EXPIRE     set paste expiration: N = Never, 10M = 10 Minutes, 1H =
                      1 Hour, 1D = 1 Day (default), 1M = 1 Month.
  -l PASTE_FORMAT     define the default syntax highlighting for your paste.

Banshee music player won’t play or seek on Linux

If you install Banshee on your Linux box expecting it to play music, you’re in for a surprise. Banshee depends on the GStreamer codec packages for audio and video decoding (and encoding).

Unfortunately, most of the codecs you want are not packaged with most Linux distros by default.

Does Banshee support audio/video format X (mp3, aac, mpeg, etc)?

Banshee uses GStreamer for audio and video decoding (playing) and encoding (ripping, format conversions). Whatever codecs you have installed for GStreamer, Banshee will be able to use (with a small number of exceptions).

— From the Banshee FAQ.

While installing Banshee you should install a few of the GStreamer packages as well.

Ubuntu

$ apt-get install banshee gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly

Fedora
First add RPM Fusion to your list of yum repositories. Then install.

$ yum install banshee gstreamer-ffmpeg gstreamer-plugins-ugly

Once you install the GStreamer packages Banshee should work as expected.

Using an Adesso Barcode Scanner With Ubuntu

We’re gearing up to test out a new ticketing system at work. We’ll be scanning barcoded tickets using an inexpensive USB Adesso Barcode Scanner. Unfortunately, on my Ubuntu (9.04 jaunty) netbook, the scanner would disable itself immediately after I scanned a barcode. Here’s how I fixed it:

1) Add the following lines to the bottom of your /etc/modprobe.d/blacklist file:

# these drivers are very simple, the HID drivers are usually preferred
#blacklist usbmouse
#blacklist usbkbd
blacklist usbhid

2) Add the following line to the bottom of your /etc/modules file:

usbkbd

3) Reboot.

This will make your system prefer the usbkbd driver over the HID one. Apparently the scanner likes the older usbkbd driver better.

Corporations that listen

When I’m talking about public relations what I’m really talking about is communicating. Communication is the key to developing strong relationships, not only between two caring people, but also between businesses and their publics (employees, customers, shareholders, etc). What public relations is all about is people learning about each other and developing a mutual understanding. One of the best ways to do that is of course Grunig’s two-way symmetrical model.

The two-way symmetrical model is basically a way for two groups of people to share ideas and (hopefully) gain something from the experience. This is an ideal way to communicate and technology has made it easier to do than ever before!

Many companies are taking advantage of new web technologies to encourage two-way communication. Just today Asus and Intel launched a new website called WePC (see Engadget). This new website allows users to submit their own designs and ideas for a new notebook computer. The submitted designs and posted feedback will be considered by both Asus and Intel and may actually be incorporated into a finished product. The WePC about page states:

Your designs, feature ideas and community feedback will be evaluated by ASUS and could influence the blueprint for an actual notebook PC built by ASUS with Intel inside.

Dell is another company that has had good experience with the two-way symmetrical model. In February of 2007 Dell launched a new website called IdeaStorm (see entry at Wikipedia). The IdeaStorm website is very similar to the WePC one, in that it allows users to submit articles, comment on existing ones, or vote them up or down. Almost immediately, Dell received an overwhelming number of requests to offer an alternative, open-source operating system as an option on new Dell computers. This flurry of responses eventually convinced Dell to begin offering computers with the Ubuntu (Linux) operating system pre-installed (see here and here).

Now I think that’s a pretty great result. Not only did customers get exactly what they wanted from Dell, but Dell also proved that they were listening to their customers and were willing to give them what they wanted. That’s great communicating and great publicity!