Techie Mumbo Jumbo


Launching Real Basic Apps in Ubuntu 8.04 on 64 bit hardware

For work I have recently needed to be able to compile RealBasic applications to run on Linux.  The support for Linux from RB is decent, but requires the 32 bit versions of several libraries for the build apps to run.  Specifically, I had to install the following extra packages to let things work:

libc6-i386

ia32-libs

The hardware involved:

Intel Core 2 Duo CPU E6750 @ 2.66 Ghz (Dual core, 64 bit processor), 4 GB ram, Intel DG33BU Motherboard.



Win32 Error Codes for LastErrorCode

I am not a windows programmer.  I just play one at work. 

Actually, I write apps for both windows and the mac, but I do it all on a mac using RealBasic - it will cross-compile.

Today I ran into a problem on windows with one of my projects - I was trying to read the contents of a file into memory so I could push it across a socket to a remote computer which would then save and use the file contents.  My app was throwing an exception when trying to get a handle to the file, and the error reported was just "32".  This is the value of "LastErrorCode" as provided by the win32 api.  That is the only info provided... so I dug around on google for a bit, and found this:

http://msdn2.microsoft.com/en-us/library/ms681382(VS.85).aspx

It's a list of all the sytem error codes produced by windows.  Turns out that error 32 means some other process is already using the file in question.

Recursively Change Line Endings

So, very rarely I need to change the line endings for a large set of files scattered across a bunch of directories.  Sometimes there are few enough files that I just do it manually, but today I really wanted to do a large batch of them recursively.  I wound up using this in a terminal:

cd /path/to/change/line/endings

find . -type f -exec perl -pi -e 's/\r\n?/\n/g' {} \;

Worked like a charm.  Found this here.

RMagick Ruby Gem on OS X Leopard

As I've been putting my dev environment back together on Leopard, I've been finding all kinds of things that don't quite work right - see my earlier post on MySQL.

The latest problem I've found occurs when attempting to gem install RMagick.  I get this error: 

Can't install RMagick 2.2.0. Can't find Magick-config in /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/kimball/bin/:/usr/local/mysql/bin

So, I dug about on the intertubes and found this post, which provided a script I slightly modified to do the install (I had to change the wget to curl, and also had to adjust the versions of a few things to make everything compile happily together).  This does not use Fink or Ports for the RMagick install, but does use Gem to install the necessary Ruby RMagick goop.

So, here's what you do:  Create a directory somewhere that will contain the build files for all the RMagick dependencies etc, and in that directory create a quick shell script file.  I named mine InstallRMagickGem.sh.  Change the permissions to +x for the shell file, stuff the following into it, then run it.  NOTE:  Since much of this is run using sudo, you'll need to know that the sudo password auth will likely timeout between some of the sudo calls.  So, you may want to babysit it a bit.

#!/bin/sh
curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
tar xzvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://superb-west.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.22.tar.bz2
tar jxvf libpng-1.2.22.tar.bz2
cd libpng-1.2.22
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
tar xzvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://jaist.dl.sourceforge.net/sourceforge/wvware/libwmf-0.2.8.4.tar.gz
tar xzvf libwmf-0.2.8.4.tar.gz
cd libwmf-0.2.8.4
make clean
./configure
make
sudo make install
cd ..

curl -O http://www.littlecms.com/lcms-1.17.tar.gz
tar xzvf lcms-1.17.tar.gz
cd lcms-1.17
make clean
./configure
make
sudo make install
cd ..

curl -O ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs860/ghostscript-8.60.tar.gz
tar zxvf ghostscript-8.60.tar.gz
cd ghostscript-8.60/
./configure  --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/current/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript

curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.5-10.tar.gz
tar xzvf ImageMagick-6.3.5-10.tar.gz
cd ImageMagick-6.3.5
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..

sudo gem install RMagick


MySQL Install On OS X Leopard Fix

So, I finally took the plunge and installed Leopard on my MacBook Pro - I figured that by waiting I would avoid some of the icky problems that sometimes crop up with new OS releases.  Unfortunately, I did not avoid the broken MySQL install problems that appear with Leopard.

I looked around on the internet and found several "solutions" that did not work - either because they were talking about items that did not exist on my installation for some reason, or messing with permissions, or just starting it from the command line, etc.

I'm a simple guy.  I don't want to have to remember to start/stop it from the command line.  I don't want to have to remember to start it again after I reboot the machine.  I want it to Just Work™.

Then, I stumbled upon some instructions here that helped me find the correct solution.  In a nutshell, I did not need to mess with any of the socket or alias goop that the referenced post talks about, I just had to fix the startup pref pane using a little shell script in place of the original server launch file:

cd /usr/local/mysql/support-files

mv mysql.server mysql.server.real

Now create and edit a new file called mysql.server - I use vim:

vim mysql.server

This will open the file for editing.  Here are my file's contents:

#!/bin/sh

sudo /usr/local/mysql/support-files/mysql.server.real $1

Finally, you need to change a few permissions on the newly created file:

sudo chown root:wheel mysql.server

sudo chmod +x mysql.server

And that's it.  MySQL immediately started for me from the pref pane when this was done. 

find + rm = disaster

Some time ago I wanted to to detach a working copy of some code I have been working on for several years so I could import it into a new repository on a different server.  I did something similar to this:

find -name ".svn" . | xargs rm -rf
Which did *almost* what I wanted.  The problem is that if any of the paths that are returned by find have a space in them, rm tosses everything up to the space.

In other words, if you have something like this:

/Documents/Projects/My Really Important Stuff/Project1

and My Really Important Stuff contains more than just Project1, you can kiss it all goodbye.

So, today I needed to do something similar, but I did it this way instead, which is MUCH safer:

find . -name ".svn" | while read f; do rm -r "$f" ; done

Microsoft Vs. Apple OS Quality?

With the latest release of Vista from Microsoft and Leopard from Apple, comparisons are inevitable.  In fact, there have been dozens and dozens written by folks far more qualified to comment than I.  However, I had a conversation at work the other day that gave me opportunity to pause and think. (Always dangerous).

In the year 2001, Microsoft released Windows XP.  Apple released OS X 10.0.  Since then, Apple has released 10.1, 10.2, 10.3, 10.4, and now 10.5.  Each successive release of the Mac OS X has been substantially better than the last - each added new features, refined what was already there, improved user experience, and became more stable and robust.  I have found it very difficult to locate specific examples of overall quality degradation between OS X releases.  On top of this, Apple has also come up with other stunning products:  The iPod.  iSight.  Airport.  Apple TV. iPhone. Apple Retail Stores.  Porting entire OS and all shipping hardware to intel architecture, and releasing several new generations of hardware across their entire line of server, pro, and consumer level computers. In short, Apple has been very busy delivering great products in a timely manner.

What has Microsoft done in the last 6 years?  Well, I have to be honest here - I am clearly not a fan of the Redmond giant, and thus I may not be as aware of the accomplishments of Microsoft in the last 6 years as I am with Apple (I made the preceding list for Apple off the top of my head - I'm sure there is more that I've missed).  As for Microsoft - they have released new versions of some of their software packages (Office, SQLServer, etc), and shipped Vista - which ultimately turned out to only get shipped because they removed many of the features that had folks excited from their early roadmap announcements (WinFS, anyone?).  

One other item of note is that reports of Vista adoption success have generally been lukewarm at best - with several of the major vendors of windows hardware offering a way to remove vista in favor of XP on new hardware.  

I read yesterday that Apple sold more than 2 million copies of OS X 10.5 in the first weekend it was released.  This is staggering for a company that took 6 weeks to do the same thing with the previous release of their OS.  I don't know how long it took Microsoft to sell 2 million copies of Vista (though I suspect that it took longer than it took for those 2 million customers to decide they wanted their XP back) - the point here is that with Leopard, Apple customers are very eager to move up to the next OS.  With windows, it seems that the adoption rate has been much slower, and caused more heartburn.

On a personal note - I write software for a living which runs on windows and on the mac.  The vast majority of my customers are using windows, as you would expect given Microsoft's overriding market share in the PC space.  In addition to writing software, I get the joy of supporting it as well.  I don't get a lot of support calls - maybe 1 a day on average (for an install base of > 1000 customers, that's pretty good, eh?)  More and more frequently the calls are folks complaining that they just upgraded to Vista and now nothing works (not necessarily with my software - everything else they want to do, too).  People HATE user account control, and invite me over to their house for dinner (er, no, thanks - you live in New Jersey, I'm in Idaho.  Can't make it), offer the hand of their daughter in marriage (erhm.  I'm taken.), and generally refer to me as some sort of deity (no reason to correct them there... ) when I show them where to go in the control panel to shut the darn thing off.  As the Vista release approached, I had to slap together a patch for my main app just so it would run on Vista in the first place, and applying it makes the dude with the dark glasses ask "Cancel or Allow".  Customers hate that.

So, getting back to my original premise - I had a conversation at work that went something like this:

Co-Worker: "Ever notice how each release of OS X is a lot better than the previous, and that Apple has managed to release 5 iterations in the time it took Microsoft to release 1 that stinks?"

Me:  "Yeah.  Mythical Man Month, I think."

Co-Worker: "Huh?"

Now, The Mythical Man Month: Essays in Software Engineering is a book that I read as part of my coursework for my CS degree.  It's a fascinating book all about what not to do when developing software.  Quoting from Wikipedia:

"Assigning more programmers to a project running behind schedule will make it even later, due to the time required for the new programmers to learn about the project, as well as the increased communication overhead. When N people have to communicate among themselves (without a hierarchy), as N increases, their output M decreases and can even become negative (i.e. the total work remaining at the end of a day is greater than the total work that had been remaining at the beginning of that day, such as when many bugs are created).

Group Intercommunication Formula: n(n − 1) / 2

Example: 50 developers -> 50(50 − 1) / 2 = 1225 channels of communication."

(I admit freely that I'm mathematically challenged, but that function is exponential)

There are a few other gems that I have taken from this book.  The professor that had us read this book was fond of saying: "No matter how many women you assign the task, it will always take 9 months to have a baby." (i.e., some development tasks just take as long as they take, no matter what you do to shorten it)

He also used to say that if a single developer will take 1 year to complete a project, then 2 developers will take 3 years, 3 developers will take 5 years, and > 3 developers will never finish it.  I've seen this in action - how many projects have been tossed aside and forgotten because a few devs could not agree on some fundamental methodology? (or, sometimes even worse, the team splits, the project forks, then the 2 forks never get finished either because they hit the same barrier)

I don't profess to know anything at all about the corporate development squads of either Microsoft or Apple.  However, I do know that the Cupertino Chargers are churning out a lot higher quality product, and doing so more frequently than the Redmond Rascals.  I suspect that Microsoft's OS development team consists of a whole heck of a lot more developers than Apple, but have no real idea what the numbers may be.

So, in The Mythical Man Month Brooks points out many of the worst mistakes software development teams and managers make - but "The tendency for managers to repeat such errors in project development led Brooks to quip that his book is called "The Bible of Software Engineering" because "everybody reads it but nobody does anything about it!" - Wikipedia Entry, second paragraph

Mr. Brooks - it would appear that some folks are actually doing better than others.  Maybe this means that the Cupertino Chargers have not only read your playbook, but have in fact tried some of your suggestions - with fantastic results.

Mac OS X 10.5 Leopard: My Dinky Review

Some Introduction

So, Leopard came out this past Friday, and there have been many, many reviews of all the spiffy new features and how they'll make you lose 10 lbs, grow your hair back (but lose your back hair), and generally just be the spiffiest thing to come out of the cupertino mother-ship ever since the last major release of their core OS.

I read many of these reviews, and got all excited about getting it installed.  Alas, I use several items on my work laptop that are not yet compatible with Leopard (the software company that produces the main chunk of code I have to have working on Leopard claims that it works, but their forums are filled with gripes  from daredevil folks willing to have thrown all forms of caution into the stiff breeze and run willy-nilly into a soft, warm embrace with this new OS only to discover that they can't use it after all, because one of their main productivity tools is  just plain jim-busted, so I'm a gonna hafta wait for a few weeks on my work lappie.)

So, I had to hunt around for another victim computer for my first Leopard install.  

Hey, what's that over there?  Oh, look!  It's a MacMini that my kids use to play every game on sesamestreet.com.  That'll do.

So, I dragged home my external hard drive (wouldn't want to lose any high scores from the "Elmo Learns To Go Potty" game) to backup anything I could find of any importance on the mini and got to work. 

What follows is my completely unscientific, largely incomplete, mostly griping review of Mac OS X 10.5 - Leopard.

The Dinky Review

I'm not an operating system internals guy.  Yes, I do write software for a living, and I do recall a lot from that nasty OS class I had to take in school (writing my own virtual memory manager from scratch was not my idea of a killer way to spend 3 weeks in a CS lab.)  Thus, I will not even pretend to comment on the guts of the OS.  I've heard it's nifty from lots of geeky types who know, and have decided to take their word for it.

Instead, I've decided to tell you about my impressions of how the OS looks.  Part of what I have always loved about the MacOS (even back in the days of MacOS 7, when I first started using a mac) was that things were logical, and laid out in ways that just "felt" right.  Moving from OS 9 to OS X was a jolt for many folks, because with the advent of the Aqua interface Apple totally broke free from the look and feel that they had used on virtually every macintosh they ever shipped. 

In successive iterations of Mac OS X, they have monkeyed with their UI even more - these funky metal windows, pinstripes everywhere, pulsing buttons, drawers, sheets, etc.  

In Leopard, it seems they are attempting to go back to a single style for all windows (with the only exceptions being apps written by apple - i.e., Garage Band).  Here's what a basic window looks like on my mini right now:

Picture 5

As opposed to the same window running on my 10.4.10 laptop:

Picture 4

Couple of things I notice immediately:  The drop shadow is on steroids in Leopard - I mean really guys, the shadows are all spiffy and things, but come on already - I don't need to have that much of an effect.  Secondly - and this may be an optical illusion - I'm too lazy to actually open up photoshop and check - but there appears to be a white border around the inner frame of the Leopard window that is about 1 px wide - makes the transition from the window contents to the title bar jarring.

Up next, I noticed that they changed the way that the OS colors the frontmost window.  On previous iterations of Mac OS X, the lighter window was the one in front.  On Leopard, the darker window is the active one:

Here's Leopard:

Picture 6

And here's Tiger:

Picture 8

Hmm.. Now that I look at these shots, I think the thing that really bugs me is that the title bar is just so dark on Leopard. This is probably because it is so prevalent:

Picture 7

So, in short, I don't really like the new look and feel of the finder and other window frames all that much.

Up next, let's talk stacks:

This is one feature of Leopard that I do think is pretty spiffy - I've not played much with them, and since I don't really do anything with this particular computer, I may be missing some of the elegance, but I think I'll grow to like them a lot when I use Leopard full time on my own laptop.  It appears that a stack works like this when there are just a few items in the destination folder: 

Picture 9

And they look like this when there are a LOT of items in the destination folder:

Picture 10

(There are actually several hundred items in this folder, and not all of them show up on the screen, which will make this feature less useful if you have a folder with a lot of items, all of which you actually need - but if you are in that situation, you have other problems that should probably be mentioned to your therapist.)

Speaking of folders, have you seen the new icons for the folders?  I really don't like them, as they are very hard to identify at a glance due to their 2 color scheme (instead of the very colorful icons from Tiger): 

Here's a list view from a finder window:

Picture 1

and another one:

Picture 3

On this one, note the inconsistency  between the icons under the "Places" sidebar on the left, and the same folders in the list on the right.  It is rare (in my experience) to see Apple vary their look and feel for the same destination in this manner. 

For comparison, here is how these icons look in Tiger:

Picture 2

I think the colors really help.

There is not much else that I have really examined in the system - I did set up parental controls, and there seemed to be a problem with it.  I set up simple finder for one of my children, then specified a list of about a dozen or so apps that the user could launch.  I then logged in as that user, and found only about 3 of the apps actually enabled - I went back into the settings in my account for the parental controls for the user, and re-enabled access to all the apps again.  Now it shows 7 or so of the apps available, but not all of them.  I have not had time yet to figure out why.  Also, I've set time limits such that both my kids accounts cannot log in between 8 pm (bedtime) and 7 am.  However, when they are logged out for the day, on the login screen it says that one of them can log back in at 7 am the next day (as it should) and the other says it can log in at 12 midnight.  Odd, that.

Also, in SystemPreferences, be prepared for a bit of a jolt in trying to find stuff - in particular, network settings looks a lot different, and I have not yet found the firewall settings (though I admit I have not really tried, either....it used to be under the sharing tab, but appears to have headed off for sunnier climes - I'll have to find it another day).

So, that's about it for me on this lame review.  Bottom line:  I don't think I like the look and feel all that much.  Stacks are cool.  Where did my firewall go?

UPDATE:  Hans wrote in with a comment showing me where the firewall disappeared.  Thanks!

Ubuntu Gutsy Gibbon As A Smalltime DNS

I have several domains - kimballlarsen.com, hugegrocerysavings.com, twigglesgiggles.com, ourpioneerhistory.com - for which I host DNS.  Until recently, this has all been done via my ISP's hosting services, etc.  A few months ago, I decided to finally learn Bind9 and figure out how to set up DNS for my domains at work (30+ of them) and in so doing learned how to easily do the same for my piddly stack of personal domains.

Tonight I'm just setting up my new Gutsy box named "The Bridge" to host DNS for my domains.  

First off, when I installed Gutsy, I did so using the PC (Intel x86) server install CD, which does not install fluffy things like X11 by default, and saves a bunch of overhead in the form of useless software on this server.  During the install, it asks what roles this server will fill - and I believe I selected everything except for Postgres Database Server (never been convinced that Postgres is all that much better for my needs than MySQL).  Thus, the Bind9 DNS package should already be installed.  To verify, there are several ways you can check to see what is installed.  I am too lazy to actually remember the command to look up what has been installed using apt, but I do remember that if you try to apt-get install something that is already installed, it tells you that you're a moron for trying again:

root@bridge:/home/kimball# apt-get install bind9
Reading package lists... Done
Building dependency tree       
Reading state information... Done
bind9 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

So, bind is all installed, and we're set.  Now, I already have these domains set up in Bind9 on the Holodeck, so in theory, I should just have to copy the /etc/bind/ directory from the holodeck to the bridge and restart bind on the bridge.  Go get a drink. This will take just a second.

Ick.  That didn't work at all:

root@bridge:/etc# mv bind bind.old
root@bridge:/etc# scp -r root@192.168.0.5:/etc/bind ./
The authenticity of host '192.168.0.5 (192.168.0.5)' can't be established.
RSA key fingerprint is 00:ca:ef:35:9f:16:21:00:43:69:67:c8:8e:9c:72:c7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.5' (RSA) to the list of known hosts.
Password: 
db.empty                                                                                                                                     100%  353     0.3KB/s   00:00    
zones.rfc1918                                                                                                                                100% 1317     1.3KB/s   00:00    
db.127                                                                                                                                       100%  176     0.2KB/s   00:00    
db.root                                                                                                                                      100% 1507     1.5KB/s   00:00    
named.conf                                                                                                                                   100% 1438     1.4KB/s   00:00    
named.conf.local                                                                                                                             100%  253     0.3KB/s   00:00    
named.conf.options                                                                                                                           100% 1500     1.5KB/s   00:00    
rndc.key                                                                                                                                     100%   77     0.1KB/s   00:00    
kimballlarsen.com.hosts                                                                                                                      100%  480     0.5KB/s   00:00    
root@bridge:/etc# /etc/init.d/bind9 restart
 * Stopping domain name service... bind
rndc: connection to remote host closed
This may indicate that
* the remote server is using an older version of the command protocol,
* this host is not authorized to connect,
* the clocks are not syncronized, or
* the key is invalid.
   ...fail!
 * Starting domain name service... bind
   ...fail!

Alright, so I guess I really should have kept the file called rndc.key from the original install.  I'll try that instead:

(good thing I made a backup of the original config, eh?)

root@bridge:/etc# mv bind bind-busted
root@bridge:/etc# scp -r root@www.kimballlarsen.com:/etc/bind ./
Password: 
db.empty                                                                                                                                     100%  353     0.3KB/s   00:00    
zones.rfc1918                                                                                                                                100% 1317     1.3KB/s   00:00    
db.127                                                                                                                                       100%  176     0.2KB/s   00:00    
db.root                                                                                                                                      100% 1507     1.5KB/s   00:00    
named.conf                                                                                                                                   100% 1438     1.4KB/s   00:00    
named.conf.local                                                                                                                             100%  253     0.3KB/s   00:00    
named.conf.options                                                                                                                           100% 1500     1.5KB/s   00:00    
rndc.key                                                                                                                                     100%   77     0.1KB/s   00:00    
kimballlarsen.com.hosts                                                                                                                      100%  480     0.5KB/s   00:00    
root@bridge:/etc# cd bind
root@bridge:/etc/bind# rm rndc.key 
root@bridge:/etc/bind# cp ../bind-old /rndc.key ./

    
root@bridge:/etc/bind# /etc/init.d/bind9 restart
 * Stopping domain name service... bind
   ...done.
 * Starting domain name service... bind
   ...done.

Can it really be that easy?

root@bridge:/etc/bind# dig @localhost www.kimballlarsen.com

; <<>> DiG 9.4.1-P1 <<>> @localhost www.kimballlarsen.com
; (1 server found)
...

;; ANSWER SECTION:
www.kimballlarsen.com.  38400   IN      A       209.161.26.94

Yup.  It can.  Now, this has only handled my kimballlarsen.com domain - I'll just need to create zones for the other domains I want to set up, and I prefer to use webmin to do so, as the syntax and format of the bind config files is somewhat fragile, and I'm just too lazy. :) 

Contact me if you need any help setting up a new DNS zone in Bind via Webmin.  I'm no expert, but I can muddle through.

Gutsy Gibbon Initial Setup

So, Gutsy Gibbon has arrived (It's an operating system for those of you who don't follow ubuntu - and it's a "computer thingie" for the rest of you), and I'm going through the ritual initial setup tonight.  Here are my notes for all the things I do initially when setting up a fresh Ubuntu box.

Give it a name.  I like to name my computers after things from Star Trek.  Commence geek jokes now.  Go ahead.  I'll wait.

In the past, I have had machines named Piccard, Geordi, LaForge, TenForward, MainEngineering, Borg, and Holodeck.  This one will be named Bridge.

One of the first things I always do after installing a fresh Ubuntu is update the apt repository source list file.  This lives in /etc/apt/sources.list, and I add in all the extra repositories (Multiverse, Partners, etc) that are not on by default, and remove the source repositories (I rarely need them, and get annoyed when I refresh the repo list and have to wait for the source repos to update)  Here is what my sources.list file looks like now.  

After a quick apt-get update, I'm now ready to start installing the junk I know I'll need.  A few utilities come to mind immediately:

  • iftop - excellent way to visualize network traffic in the terminal
  • lshw - awesome utility to look up and report hardware installed
  • nmap - port scanner
  • webmin - web-based server config tool

So, I get started with:

apt-get update
apt-get install iftop lshw nmap webmin

Reading package lists... Done
Building dependency tree
Reading state information... Done
lshw is already the newest version.
Package webmin is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package webmin has no installation candidate

Thus, it appears that webmin is no longer maintained in the repository - I seem to remember this happened back with Feisty, so I'll just have to install it manually later.

Removing webmin from my apt command gives me this:

apt-get install iftop lshw nmap
Reading package lists... Done
Building dependency tree
Reading state information... Done
lshw is already the newest version.
The following NEW packages will be installed:
  iftop nmap
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 782kB of archives.
After unpacking 2810kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com gutsy/universe iftop 0.17-4 [31.9kB]
Get:2 http://us.archive.ubuntu.com gutsy/main nmap 4.20-2 [750kB]
Fetched 782kB in 10s (75.7kB/s)
Selecting previously deselected package iftop.
(Reading database ... 19830 files and directories currently installed.)
Unpacking iftop (from .../archives/iftop_0.17-4_i386.deb) ...
Selecting previously deselected package nmap.
Unpacking nmap (from .../archives/nmap_4.20-2_i386.deb) ...
Setting up iftop (0.17-4) ...
Setting up nmap (4.20-2) ...
So, I've got those tools installed now. Next, make sure ssh is ready to go (this did not used to be turned on by default in Feisty)
apt-get install ssh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  ssh
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1096B of archives.
After unpacking 32.8kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com gutsy/main ssh 1:4.6p1-5build1 [1096B]
Fetched 1096B in 1s (890B/s)
Selecting previously deselected package ssh.
(Reading database ... 19857 files and directories currently installed.)
Unpacking ssh (from .../ssh_1%3a4.6p1-5build1_all.deb) ...
Setting up ssh (1:4.6p1-5build1) ...
So that brings me back to webmin. I'll just grab the .deb from www.webmin.com, and use dpkg -i to install it. One quick note:  You will have to add a few extra packages in order to have webmin install correctly:

apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl libmd5-perl

That's about it - I'm now ready to throw on my other software packages and get them configured to bend this server to do my will. 

Ubuntu Gutsy Gibbon - Home Server Setup

So, Ubuntu Gutsy came out a few days ago, and I've got a new server that I'm going to be using at home.  This server is actually an old desktop machine - used to be Christine's Windows XP box (before she saw the light and let me buy her a MacBook last year) and has mostly sat idle for many moons.

It is idle no more. 

For those of you interested, here are the basic specs of the machine:

Intel Pentium 4 - 2.80GHz, 1 GB Ram, 120 GB Internal ATA HD

I'll also be pulling some of the drives from the holodeck (current server) to put into the bridge (the name of the new server) 

Over the next few days, I'll be posting articles regarding how I set up various bits of this server.  Mostly these are for my own notes, but feel free to attempt to duplicate them for yourself.  I make no guarantees about anything. :) 

First off, here's a list of everything I want this server to do:

  • DNS for my domains
  • Mail Server
  • MySQL Server
  • WWW server
  • Remote Backups for Work
  • File Sharing For My Home

That should cover it for now - several of these items are likely going to be broken down into several steps, as something like setting up the mail server involves a bunch of packages playing nice together (amavis, postfix, spamassassin, postgrey, mysql, roundcube, etc, etc).

Tonight, I think I'll see how difficult it is to move my DNS setup from holodeck to the bridge.  See the next post for the gore.

Recursive wget

I love wget.  I've used it in the past to quickly snag the contents of entire web directories, and tonight I learned a few more tricks it can do.  Namely, it can recurse down as many levels deep from the first page as you like, it can ignore the reported length of items it is retrieving, it can automatically adjust all links in all pages it downloads to refer to each other correctly on the local archive, and it can run with nice progress indicators.  (This is by NO means the complete list of all the ways to configure it - these are just the ones I prefer to use.  Here is the set of switches I like:  (yes, they have more compact versions, but for clarity I'm using the longer forms.)

wget --recursive --progress=bar --ignore-length --level=1 --convert-links http://www.somedomain.com/page.html

Using BackupPC Locally To External Firewire Drive

So, I recently discovered the wonderful backup tool called BackupPC (Thanks, Hans!) and have set it up to backup all the workstations at my office to a central server with a large storage capacity.  However, I've only set it to backup the important work-related files from each workstation.  I would like to be able to backup other files that are important to me from my laptop (family pictures, music, source code, mail, etc), but I would quickly fill up our backup storage space at the office if I tried to do so on our current backup server. So, I've decided to try to set up BackupPC locally on my laptop (Mac OS X 10.4 running on a MacBook Pro 17" Core 2 Duo).  One catch is that I don't want to have to drag a large external firewire disk around with me, so I want BackupPC to just backup when the disk is present.  I've asked if this is possible on the BackupPC forums, and it appears that if the disk is not present when a backup is requested, BackupPC will just fail, which is fine for me in this case, as it will succeed the next time when the disk is connected.  So, on with the steps I had to take to get it going:

1.  Get a copy of BackupPC from sourceforge.  

2.  Unpack it somewhere convenient.

3.  Read the README - where you will find that it requries a perl module that you may not already have installed (I didn't).

4.  Install File::RsyncP.  (Caveat - I'm NOT a perl guy at all, so I just poked around for about 30 seconds on Google to learn how to install File::RsyncP, and followed the CPAN method described here

5.  Once perl is all set up with the right modules, just enter the unpacked archive of BackupPC and type:


perl configure.pl


This will ask a lot of questions.  Pay attention to them.  Answer as well as you can. If you don't know the answer, take the time to figure it out. Once it is finished installing, there are still a few items you will need to do manually.  Namely (Taken from instructions given by the config.pl script): 


- Browse through the config file, /etc/BackupPC/config.pl, and make sure all the 

settings are correct.  In particular, you will need to set $Conf{CgiAdminUsers} so you have administration privileges in the CGI interface.


- Edit the list of hosts to backup in /etc/BackupPC/hosts.


- Read the documentation in /usr/local/BackupPC/doc/BackupPC.html.

Please pay special attention to the security section.


- Verify that the CGI script BackupPC_Admin runs correctly.  You might need to change the permissions or group ownership of BackupPC_Admin. If this is an upgrade and you are using mod_perl, you will need to restart Apache.  Otherwise it will have stale code.


- BackupPC should be ready to start.  Don't forget to run it as user kimball!  The installation also contains an init.d/backuppc script that can be copied to /etc/init.d so that BackupPC can auto-start on boot.  This will also enable administrative users to start the server from the CGI interface. See init.d/README.


Now, the CGI script did not work for me initially (at least, I could not invoke it via a browser no matter what I tried) so off to the mailing list I went to see if I could find answers there.  

Hrm.  This is beginning to not look too hot.  It appears that getting this thing running

on OS X will require either recompiling Apache from source with different options selected, or recompiling Perl from source to enable setuid compatibility.  Ugh. I just want backups, not recompiling major packages on my system.  I sent this to the mailing list:

So, I've been trying for a few hours now to get BackupPC working correctly on a mac - (not as a client,  but as a *server*).  The end goal here is to get backuppc to make backups of localhost to an external firewire drive.  However, I'm having a dickens of a time getting the CGI interface to work - it appears  that I have to either use mod_perl (which does not appear to be available in this version of apache) or setuid (which this flavor of perl does not  have compiled in) Now, I'm all for getting it done right, but at some point the complexity involved in setting up a tool  makes the barrier to entry of using the tool much too high for the usefulness of the tool - in other  words, this is too hard to get set up in OS X. 


I've poked around in the history of this mailing list, and found only suggestions that other tools  should be used instead - namely PSyncX (which does not do incremental backups, as far as I can tell). Should I be looking elsewhere (Amanda, PSyncX, etc) for an easier-to-install backup daemon for OS X? I guess I'll wait for a response and check into alternatives in the mean time.


UPDATE:

I did eventually get this shebang up and going.  But it had a fatal flaw - backuppc does not deal well with a missing backup repository - consequently, when the backup drive was not connected, nasty-bad&trade; things would happen.  


So, I dug a little more, found rdiff-backup, and have been happily using it ever since.



Deploying Ruby On Rails to Feisty Using Capistrano, Apache, and Mongrel

So, I've been hacking on a new RoR application for work for the last week or so, and it's time to get a deployment environment set up so I can deploy as rapidly as I can develop.  I've been reading Agile Development With Rails and whilst perusing the chapter on deployment, ran across this site which explains the ins and outs of installing Apache/Mongrel/Capistrano in a deployment configuration on Debian Sarge.  Since I am deploying to an Ubuntu Feisty install, I decided that these instructions are likely close to what I'm after.

Here, then, are my notes about what I had to do to finish the install:

First, there are several differences between Debian Sarge and Ubuntu Feisty, most notably you don't have to add any extra repositories to get things installed properly.  Here's my /etc/apt/sources.list:


deb http://us.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty main restricted
deb http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty universe
deb http://us.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse


This is the default sources.list from Feisty, with the comments removed and the multiverse repositories enabled.  With these.

Also note - this machine is already in production with Apache2 configured and running, so I've only got to get Ruby, Rails, Mongrel, and Capistrano configured.

Get the repositories up to date:

apt-get update

Now that I'm up to date, I refer back to the [tutorial on how to do this in Debian](http://mongrel.rubyforge.org/docs/debian-sarge.html) and discover which packages I should install first.  They are:

ruby irb rdoc ri ruby1.8-dev libzlib-ruby libopenssl-ruby rubygems build-essential

So, since I tend to like to see what will happen before I actually make changes via apt, I run:

apt-get install ruby irb rdoc ri ruby1.8-dev libzlib-ruby libopenssl-ruby rubygems 

build-essential --recon

Which reports:

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following extra packages will be installed:

  binutils dpkg-dev g++ g++-4.1 gcc gcc-4.1 irb1.8 libgems-ruby1.8 libopenssl-ruby1.8 

  libreadline-ruby1.8 libruby1.8 libstdc++6-4.1-dev make patch rdoc1.8 ri1.8 ruby1.8

Suggested packages:

  binutils-doc debian-keyring gcc-4.1-doc manpages-dev autoconf automake1.9 libtool 

  flex bison gdb gcc-doc gcc-4.1-locales libc6-dev-i386 libstdc++6-4.1-doc make-doc diff-doc

  ruby1.8-examples

Recommended packages:

  libmudflap0-dev

The following NEW packages will be installed:

  binutils build-essential dpkg-dev g++ g++-4.1 gcc gcc-4.1 irb irb1.8 libgems-ruby1.8 

  libopenssl-ruby libopenssl-ruby1.8 libreadline-ruby1.8 libruby1.8 libstdc++6-4.1-dev

  libzlib-ruby make patch rdoc rdoc1.8 ri ri1.8 ruby ruby1.8 ruby1.8-dev rubygems

0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded.

Inst binutils (2.17.20070103cvs-0ubuntu2 Ubuntu:7.04/feisty)

Inst gcc-4.1 (4.1.2-0ubuntu4 Ubuntu:7.04/feisty)

Inst gcc (4:4.1.2-1ubuntu1 Ubuntu:7.04/feisty)

Inst libstdc++6-4.1-dev (4.1.2-0ubuntu4 Ubuntu:7.04/feisty) []

Inst g++-4.1 (4.1.2-0ubuntu4 Ubuntu:7.04/feisty)

Inst g++ (4:4.1.2-1ubuntu1 Ubuntu:7.04/feisty)

Inst make (3.81-3build1 Ubuntu:7.04/feisty)

Inst patch (2.5.9-4 Ubuntu:7.04/feisty)

Inst dpkg-dev (1.13.24ubuntu6 Ubuntu:7.04/feisty)

Inst build-essential (11.3 Ubuntu:7.04/feisty)

Inst libruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst ruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst libreadline-ruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst irb1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst irb (1.8.2-1 Ubuntu:7.04/feisty)

Inst rdoc1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst libopenssl-ruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst libgems-ruby1.8 (0.9.0-5 Ubuntu:7.04/feisty)

Inst libopenssl-ruby (1.0.0+ruby1.8.2-1 Ubuntu:7.04/feisty)

Inst libzlib-ruby (0.6.0+ruby1.8.2-1 Ubuntu:7.04/feisty)

Inst rdoc (1.8.2-1 Ubuntu:7.04/feisty)

Inst ri1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst ri (1.8.2-1 Ubuntu:7.04/feisty)

Inst ruby (1.8.2-1 Ubuntu:7.04/feisty)

Inst ruby1.8-dev (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Inst rubygems (0.9.0-5 Ubuntu:7.04/feisty)

Conf binutils (2.17.20070103cvs-0ubuntu2 Ubuntu:7.04/feisty)

Conf gcc-4.1 (4.1.2-0ubuntu4 Ubuntu:7.04/feisty)

Conf gcc (4:4.1.2-1ubuntu1 Ubuntu:7.04/feisty)

Conf g++-4.1 (4.1.2-0ubuntu4 Ubuntu:7.04/feisty)

Conf libstdc++6-4.1-dev (4.1.2-0ubuntu4 Ubuntu:7.04/feisty)

Conf g++ (4:4.1.2-1ubuntu1 Ubuntu:7.04/feisty)

Conf make (3.81-3build1 Ubuntu:7.04/feisty)

Conf patch (2.5.9-4 Ubuntu:7.04/feisty)

Conf dpkg-dev (1.13.24ubuntu6 Ubuntu:7.04/feisty)

Conf build-essential (11.3 Ubuntu:7.04/feisty)

Conf libruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf ruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf libreadline-ruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf irb1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf irb (1.8.2-1 Ubuntu:7.04/feisty)

Conf rdoc1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf libopenssl-ruby1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf libgems-ruby1.8 (0.9.0-5 Ubuntu:7.04/feisty)

Conf libopenssl-ruby (1.0.0+ruby1.8.2-1 Ubuntu:7.04/feisty)

Conf libzlib-ruby (0.6.0+ruby1.8.2-1 Ubuntu:7.04/feisty)

Conf rdoc (1.8.2-1 Ubuntu:7.04/feisty)

Conf ri1.8 (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf ri (1.8.2-1 Ubuntu:7.04/feisty)

Conf ruby (1.8.2-1 Ubuntu:7.04/feisty)

Conf ruby1.8-dev (1.8.5-4ubuntu2 Ubuntu:7.04/feisty)

Conf rubygems (0.9.0-5 Ubuntu:7.04/feisty)

Ok, that all looks good, so off we go to let it actually run.  I'm going to go re-fill my water bottle.

Zzzzz......

Alright, that's done.  Up next is to install rails, mongrel, capistrano, and other supporting software via gem:

root# gem install rails --include-dependencies

root# gem install termios --include-dependencies

root# gem install capistrano --include-dependencies

root# gem install mongrel --include-dependencies

root# gem install mongrel_cluster --include-dependencies

Important Note: I had to choose which version of mongrel to install, as well as which version of fastthread, which is a dependancy of mongrel.  Simply choose the lowest numbered gem offered for your platform.

At this point, we should have a working Rails installation.  To test it, we'll follow a few more instructions from the