I have been thinking about decommissioning my wonderful G5 iMac, as I just don't use it any more, and pulling a spare Gateway laptop out of the closet and installing the latest Ubuntu release for a platform to test DKit on in a more generic C++/linux environment. My iMac has been a blast. It's been with me for a long time, and I've really done a lot of great things with it. But the truth is that with Mac OS X 10.7 or even 10.6 running on it, it's long in the tooth, and there's no real need to keep it around. It's not hitting the dumpster, but I've got very limited desk space these days, and it really makes more sense to have the Ubuntu machine on the desk than the iMac.
So today's the change.
Last night I downloaded the Ubuntu 12.04 32-bit and AMD64 distributions and burned them onto DVDs. I think CD's would have worked, but I didn't have any, and a spindle of DVDs is something we almost never go through, so it was easy to burn off two copies. I'm glad I got both, as I remembered that the laptop in question had an AMD64 CPU in it, and so I'll be able to make the 64-bit and 32-bit libraries for DKit. Also, I'm sure I'll be able to fire up WindowMaker on Ubuntu 12.04, as I had it working on Ubuntu 10 at my last job. So all in all, it should be just what I wanted to test out the builds and compiles of DKit.
The boot directly into Ubuntu 12.04 is nice, but it might have been nice to have been given the option of boot or install a little earlier in the process. Here nor there, it's up, and this is not fast hardware, so I'm willing to cut Ubuntu a lot of slack here. It's nice that it has to run/install option, and so easy to get going.
I've been doing a lot of linux installs in the last decade, and they all have come to the point that a nice GUI is standard. I think Ubuntu's installer is no different. I do think that the use of the twitter feed on the install screen is very clever. It's an easy way to see what's happening, and what people are saying about Ubuntu as you're waiting for the files to copy and download. Clever.
Interesting Installation Challenges
The first thing I ran into is that sshd is not enabled by default on Ubuntu 12.04 - so I had to google how to install it:
$ sudo apt-get install openssh-server
Once I had sshd installed on mao, I was able to log in from my MacBook Pro and move over my ~/.ssh directory so I could have my keys. After that, I needed to make sure that I had Vim:
$ sudo apt-get install vim vim-gtk
then I moved over my .vimrc, and ~/.vim directory. In order to use the gists from Vim, I needed to have curl:
$ sudo apt-get install curl
and then to have nice bitmapped fonts, I needed to remove the "don't" condition on them and regenerate the font table:
$ sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf
$ sudo dpkg-reconfigure fontconfig
I certainly needed to have the compilers and source control tools:
$ sudo apt-get install g++
$ sudo apt-get install libboost-all-dev
$ sudo apt-get install git
And then finally, I wanted to have the 'dev' channel of Goggle Chrome:
$ sudo dpkg -i Downloads/google-chrome-unstable_current_amd64.deb
$ sudo apt-get install libxss1
One thing I noticed is that the motd was a little verbose, and I wanted to trim it up. Turns out in Ubuntu 12.04, it's a symlink to /var/run/motd, so I needed to do a little to set things up right. First, copy the motd to motd.static, then relink the /etc/motd to the static version, and finally edit the static version for content:
$ sudo cp /etc/motd /etc/motd.static
$ sudo rm /etc/motd
$ sudo ln -s /etc/motd.static /etc/motd
$ sudo vi /etc/motd.static
With this, I get the leaner and cleaner motd and things are good again. I just wanted to put all this here so I had something to work off of, if I decided to do this all again.
After I got all this down and installed, I was able to go to work on making sure DKit compiled and ran on Ubuntu 12.04. It wasn't all that hard, but there was one thing I was a little surprised about. In LLVM gcc 4.2.1 I was able to have the following struct and use it in the boost::unordered_set container:
typedef struct {
boost::thread thread;
auint32_t use_count;
};
But gcc 4.6.3 on Ubuntu 12.04 didn't like this at all. It didn't like the default constructor or the default copy constructor. What I needed to do was to explicitly include them in order to make the compiler happy:
typedef struct base_thread_info {
mutable boost::thread thread;
auint32_t use_count;
/**
* We should throw down the default constructor and copy constructor
* as the boost container is going to need these, and we can't allow
* the thread itself to be copied. That's just not right. So we mask
* that and just let the count be copied. This isn't great, but we
* have to have this capability, and this is the simplest way to
* make it work.
*/
base_thread_info() :
thread(),
use_count(0)
{ }
base_thread_info( const base_thread_info &anOther ) :
thread(),
use_count(anOther.use_count)
{ }
virtual ~base_thread_info()
{ }
} thread_info;
The problem appeared to be that the copy constructor for the boost::thread was private, and that meant that we couldn't just "use it". In this case, we didn't even try, and that was OK. We aren't really trying to copy these, anyway, but the container needed to have this so that it could create and then copy into, as needed.
Interesting, but it's all cleared up now. Good.
[6/6] UPDATE: I forgot about PostgreSQL, PHP and Apache on the box. In order to get these guys going, I needed to install the relevant packages:
$ sudo apt-get install postgresql-9.1
$ sudo -u postgres createuser --superuser $USER
This gets me PostgreSQL installed, and me as a super user on the database instance - as long as I log in from the box. It also starts up the instance with the default parameters that are good enough for what I need at the moment. If I need to mess with the security permissions later, that's OK. But I think it's pretty much default behavior for now.
Then I needed to get Apache, PHP, and include the integration pieces for these so that they all work together:
$ sudo apt-get install apache2
$ sudo apt-get install php5 libapache2-mod-php5 php5-pgsql
$ sudo /etc/init.d/apache2 restart
In order to get rid of an annoying warning, I needed to make a config file with the fully qualified domain name of the server:
$ cd /etc/apache2/conf.d
$ sudo vi fqdn
and include the single line:
ServerName mao.themanfromspud.com
and then restart apache again. At this point, a simple info.php file shows that I have everything up and running and it's all wired up so that it all works from within apache web pages and PHP. Nice. Now I'm ready to do the other XML-RPC work I've got going right now.