Nice!

I feel moderately pleased with myself:

That’s a work system that involves querying a table with about 16 million rows containing 12GB of free-form text (via an Oracle Text index) about five times a second, with response times over the web of less than 0.5 seconds. It probably counts as a bit of tiddler in the great scheme of things, but when I took it on, they had a quarter of the records with average response times of 26 seconds. I feel as if I’ve earned my money!

(Apropos nothing in particular, their uptime was originally less than 90 days… they were running Windows 2003. I’m just sayin’…)

It would have been longer, too, except the SysAdmin caused the rack to short one day about a year and a month ago (by plugging in a USB device somewhere. Go figure!)

Just a suggestion: Don’t buy a Shuttle!

As I mentioned a while ago, I bought myself a new Shuttle XPC SH67H3. In fact, I bought two of them; one with an i5 and 8GB RAM, the other with an i7 and 16GB.

I would like to tell you what a joy both have been since purchase, but I’ve only had the i5 in the house for about 3 days all up and the i7 keeps crashing on me as I write this, so I can’t really. In fact, the i5 has spent all but 6 days since purchase back at the place I bought it from, because it malfunctions so spectacularly.

Temperatures are good (coretemp shows 32°C idle, going up to about 62°C when under full load from Prime 95). Memory passed 24 hours of Memtest+ runs. The hard disk passed its Seatools tests with flying colours, too. Nevertheless, three days after it was first installed with Windows 7 x64, the thing suddenly decided to reboot. Fair enough, I suppose: it’s Windows, after all. Only you don’t generally expect the hard disk to go missing from the list of devices displayed by the BIOS, and for the machine to boot up to a ‘no boot device found’ message, I think!

Switch it off, wait ten minutes, switch it back on… BIOS suddenly re-discovers the hard disk and Windows boots normally. Two days later, however, the same thing: a reboot that causes the drive to disappear from BIOS. A simple switch off and on doesn’t allow the disk to be re-recognised, but a switch off-wait-20-minutes-switch on does.

After a fresh Windows install, same thing happened 11 hours later. At which point, it got taken to my offices (nearer the supplier). I spent a day re-installing Windows a third time… and waited and waited and thought, ‘Bummer, must be something about my power supply at home’ when Bingo! Three and half-days later, the thing Blue Screened with an error about iastor.sys. No reboots this time, and no missing disks from BIOS, but regular blue screens with assorted stop messages indicating various types of hardware failure or driver error. Back to the shop it went.

Meanwhile, I congratulated myself that the i7 shuttle had behaved itself perfectly. Maybe because it used a Western Digital disk whereas the i5 had used a Seagate one? Who knows… at least mine was stable!

Until 8 days after it was first installed, when it simply decided to switch itself off. No error messages in the Windows event viewer; no warnings; nothing really… just one minute it’s all fine, the next the power dies and the thing no longer functions. At least I could switch it straight back on: the BIOS wasn’t forgetting about the existence of a hard disk, so Windows came back without drama. But then it happened again. And again. And again. So I wiped Windows and put Fedora 15 on. And then it happened again. Four times, actually.

The supplier, happily, has now been able to see the first Shuttle crash and blue screen (but it took five and half days to happen, and he was about to give up!), so at least he now knows I’m not making any of this up. Having originally suggested he thought it might have something to do with SATA power management, he now says he thinks it’s something to do with the RAM and that “Memory incompatibility is just normal, some memory just does not work with some systems”. So who knows?

I’ve meanwhile found a thread in which someone describes my symptoms almost exactly, and for which suggested solutions range from (a) buy a new power supply; (b) increase voltage on the RAM and (c) downgrade your BIOS because the latest one from Shuttle is buggy and can’t do Intel turbo mode properly.

Can I suggest an option (d) there? Don’t buy a Shuttle in the first place??!

If the thing had worked as advertised on the tin, I probably wouldn’t suggest that; but to buy two of them, neither of which can stay stable for longer than about 4 days, means I now have zero confidence in the product. Minor issues, like their noise levels (it’s not high as such, but you tend to place them up on a desk, so that their fans are much more at ear-level than a normal mid-tower would be. So they sound quite loud) wouldn’t have bothered me in themselves. Now, they just combine with their jelly-like instability to annoy the heck out of me.

If I could get a refund, I would (but the supplier seems to think it’s OK for him to fiddle with them long enough by way of a ‘repair’). I’m not sure at what point I just let loose the lawyers and point out that he’s sold me a defective product that’s not fit for purpose. I’ll give him another fortnight, I guess (and that’s just to sort out the i5… I have to go through the whole thing again with the i7 as a separate exercise afterwards!)

I will say in passing that the supplier has been helpful and honest throughout, and the build quality of what they shipped me was superb (as it always is with them). It’s just unlucky that they happened, through no real fault of their own, to sell me a steaming pile of poo instead of a functioning computer. Twice.

Caveat emptor, I suppose. Or, in plain English: don’t buy a Shuttle, if you know what’s good for you.

Remote X – Connecting to Linux from Windows

I’ve written a short article on how to connect a Windows PC to a Linux server and have Linux applications appear to run on the PC. I suppose it’s just a bit of a re-visit of something I first wrote about many years ago, but the sheer cleverness of the X windowing system is a source of perennial joy and amazement, so it doesn’t do any harm to re-visit the subject from time to time (especially if you’ve just bought a new PC that has to be configured right!)

The article can be found here.

Shh! Don’t disturb the consensus…

I found this graph, courtesy of The Register, fascinating:

The top half shows average temperature anomalies in Greenland, measured with a number of different ‘proxies’ (such as tree rings, ice core analysis etc). We start using real thermometers in the latter part of the 19th Century (the red ‘instrumental’ line), and it is apparent, I think, that all indicators are suggesting that the temperature is going up quite rapidly as we reach the end of the 19th Century, with no sign of that increase really dropping off in any significant way.

What’s really interesting, though, is the bottom graph: it’s a plot of the rate of change of the Earth being hit by Galactic Cosmic Rays (GCRs), again as measured by a number of different proxies (such as isotope ratios for Beryllium). It’s an inverse scale, so the lower the line drops, the more cosmic rays are heading in our direction. Put another way, we’ve had far fewer cosmic rays coming our way since around the 1870s than we did in, say, the 1700s.

Spot a correlation between the two graphs? Does it perhaps suggest that when the rate of cosmic ray strike is high, global average temperatures drop? Or, more relevantly to today, perhaps, that the increase in global average temperatures we’ve measured in the past recent decades might be related in some way to the fact that cosmic ray activity has been tailing off over much the same period, and is now much lower than it has been in ages?

Correlation is not causation, of course, but if the cat is sitting next to an empty saucer of cream and licking his whiskers, you’d not want to discount the possibility that a bit of causation has resulted in the observed correlation!

The suggestion in this case is that cosmic rays act as ‘seeds’: by ionising air, they cause vapour trails to condense around their path, thus leading to the formation of clouds. And clouds reflect back the sun’s heat -so the more cosmic rays, the more clouds, the greater the cooling. Fewer cosmic rays, fewer clouds, greater warming.

(From the dim recesses of my brain I seem to recall that when they grounded all aircraft movements in the wake of the September 11th attacks, the same thing was observed: average temperatures over the continental USA shot up by a degree celsius or so, because there were no jets causing con-trails, and the completely clear skies that resulted allowed more solar radiation through than normal… so this is the same sort of idea, only with cosmic rays playing the part that jet engines commonly do). Update: I found a reference to what I’d only badly-remembered.

Naturally, implementing a carbon tax or an emissions trading system does not affect the number of cosmic rays hitting the Earth: that’s a function of the strength of the Sun’s magnetic field; and of the strengh of the Earth’s magnetic field; and of the complex interaction between the two.

Whether one draws the conclusion that a carbon tax or an emissions trading system is therefore a complete waste of time in the ‘fight’ against ‘climate change’ is, I guess, a matter for the politicians and not the scientists (which is no doubt why the physicists at CERN have been told not to draw conclusions from their research).

Personally, I look forward to a world powered by thorium reactors, hydrogen and solar (wind farms, not so much) and have no problem with the idea that switching away from a carbon-based economy is a Good Thing, for its own sake. I don’t expect doing so will make a blind bit of difference to the climate, however, and I suppose that makes me a “denialist”. So be it: I think research like this only serves to show how many known unknows there are out there!

Network Linux Installs

I’ve just put up a short, new article about performing installations of Enterprise-class Linux (i.e., Centos 5.6, Centos 6.0, Scientific Linux 6.1 and so on) via a network.

The basic principle is that you set up your Apache server once to serve up any or all of these distro/version combinations, boot your main server with a small net install CD and then have the main distro install itself by shipping files over the network from the Apache box.

The twist is that if you combine this with Kickstart technology to automate the main installation process, you basically have instant auto-install capability anywhere on the network, with no need to muck about with full-blown installation disks or ISOs. We once had a server at work which only shipped with a CD-ROM drive, whereas I’d downloaded the DVD installation media… this fixes that sort of mess!

As usual, make of it what you will!

An Apache Server on Centos 6

Now that we finally have a complete complement of zero-cost Enterprise Linux 6.0 clones available, I thought it might be time to revisit the idea of building a very small, very lightweight Apache server using nothing but Centos (or Scientific Linux) 6.

My existing article on building such an Apache server uses Ubuntu as its base distro, because I know of nothing that has smaller minimum hardware requirements -but this is a bit annoying, because if you go on to use RHEL-clones for an Oracle server, you have to master both RPM-based and apt-get-based distros. Life would be a lot simpler if you could use the one distro for everything, wouldn’t it?

Well, that’s what I thought too, so here’s my recipe for Apache + PHP talking to an Oracle database with the entire software stack running on two virtual machines running Centos 6 or Scientific Linux 6.

Creating the Server

I won’t detail the actual construction of a suitable web-server-capable virtual machine or the installation of its operating system here. The Ubuntu-based article I mentioned before does that quite adequately, I think. There are a couple of Centos/Scientific-specific issues that arise, though.

First thing to note, then, is that you can’t install Centos 6 (or Scientific Linux 6) in a virtual machine that’s configured with less than 512MB of memory. You can run Centos 6 in just 128MB, but the installer will bomb out at those sorts of RAM allocations. So the basic rule is: install your OS when your VM has 512MB then shut the thing down, reduce the allocated RAM, and re-start.

Second, you only need the 32-bit version of Centos or Scientific: 64-bits for running a trivial web server are completely unnecessary. (Note that the Centos link there has been altered since this article was first written to point to the version 6.1 isos, since version 6.0 is no longer made generally available).

Third, if you’re using Scientific Linux, you’ll have to select to perform a minimal install. If you’re using Centos, that is the default option anyway.

Fourth: once the O/S is installed, make sure the network itself is working (see my last post on how to do this). It won’t be by default, so you need to edit the /etc/sysconfig/network-scripts/ifcfg-eth0 script to make it function properly.

Additionally, and very importantly, you should disable SELinux by editing the /etc/sysconfig/selinux configuration file. By default, it will have a line that says SELINUX=enforcing. Change that to read SELINUX=disabled. You can’t get PHP talking to an Oracle database without doing this. Reboot to make the change take effect.

Finally, the commands you want to install the relevant Apache/PHP software bits and pieces are:

yum -y install httpd php nano unzip make
yum -y install gcc wget openssh php-devel php-pear libaio

The ‘httpd’ bit is the name for the Apache package itself; the other bits and pieces allow Apache to serve up something useful later on!

Configuring the Server

You first need to start the Apache service:

service httpd start

If you ever need to re-start the service (to pick up configuration changes, etc), the command is:

service httpd restart

To make the Apache bits start automatically at every reboot, issue this command:

chkconfig --level 23 httpd on

By default, despite having done all of the above, you won’t be able to connect to your new server from a remote browser: Centos/Scientific slap a firewall on that blocks access. You can completely disable the firewall with the command:

service iptables stop

That only works per re-boot, though, so to switch the firewall off completely, use this:

chkconfig iptables off

The more subtle approach, of course, would be to reconfigure the firewall to allow http traffic through -but that’s beyond the scope of this article and, in any case, I don’t need a firewall when I’m connecting one internal VM to another, so it’s probably overkill at this stage. If you insist on this approach, however, the advice given here would seem useful.

You’ll now be in a position to check that everything is working fine, provided you know your web server’s IP address. Assuming it’s 192.168.0.37 for the moment, then visiting http://192.168.0.37 in a remote browser should net you some sort of “it’s working” page (the Centos version is quite elaborate and is entitled “Apache 2 Test Page”; Scientific’s equivalent is a barebones “it works!” message).

You’ll also need to check that PHP is working OK, and for that I suggest you create a file called phpdata.php in the /var/www/html directory containing the following:

<?php
phpinfo();
?>

…which is just the code needed to display PHP’s configuration data. Then you can visit http://192.168.0.37/phpdata.php and you should see this sort of result:

Connecting the Server to an Oracle database

Installing OCI8 so that you can connect to Oracle via Apache is pretty much the same process as for Ubuntu:

Copy both the instantclient-basic and instantclient-sdk packages (available from the OTN website) to /var/www/html using something like Filezilla. As root, unzip both packages and create a necessary symbolic link:

cd /var/www/html
unzip instantclient-basic-linux32-11.2.0.2.0.zip
unzip instantclient-sdk-linux32-11.2.0.2.0.zip

cd instantclient_11_2
ln -s libclntsh.so.11.1 libclntsh.so

Download the relevant OCI8 library (the version numbers are specific, so check http://pecl.php.net/package/oci8 to make sure you get the latest):

cd /var/www/html
wget http://pecl.php.net/get/oci8-1.4.5.tgz

Install that new download:

pecl install oci8-1.4.5.tgz

This last command will prompt you to specify “the path to the ORACLE_HOME directory…”. At this point, you type in the following:

instantclient,/var/www/html/instantclient_11_2

…which tells the installer (a) that you’re using the instant client and not a full-blown Oracle client; and (b) that the path to the instant client files is /var/www/html/instantclient_11_2. Note that there are no spaces in any of that lot: just a comma separates the two components.

Finish off with some final configuration steps:

echo extension=oci8.so >> /etc/php.d/oci8.ini
echo /var/www/html/instantclient_11_2 >> /etc/ld.so.conf
ldconfig
echo ORACLE_HOME=/var/www/html/instantclient_11_2 >> /etc/profile
export ORACLE_HOME=/var/www/html/instantclient_11_2
service httpd restart

When you now visit your web server’s phpdata.php URL, you should see an OCI8 section appear in the PHP configuration information display.

After that, it should be relatively plain sailing: you just need to create a file which explains how to connect to an Oracle database and fetch some data. I suggest you create a file called oracle.php in the /var/www/html directory, containing this:

<?php
$myselect = "select * from scott.emp";
$oraconn = oci_connect('system', 'password', '//192.168.0.145/lindb');
$doquery = OCIparse($oraconn, $myselect) or die("Couldn't parse statement.");
OCIexecute($doquery) or die("Couldn't execute statement.");

while (OCIfetch($doquery))
 {$surname = OCIresult($doquery, ENAME);
  $salval = OCIresult($doquery, SAL);
  print '<b>'.$surname.'</b> '.$salval.'<br>';
 }
?>

That assumes my Oracle server is running at IP address 192.168.0.145; that my SYSTEM password is “password” (which would be extremely dumb if true!); and that I’ve got the SCOTT schema created within that database containing ye olde EMP table. If you now visit the URL http://192.168.0.37/oracle.php, you should get 14 rows returned in your web browser.

Network Configuration in minimal Linux installs

By default, the new Centos 6.0 distro performs a “minimal” install, as I mentioned last time. This is good because you end up with a very small footprint O/S (no Gnome, for example), leaving the server more resources to run the things you actually use servers for (like Oracle).

The downside to it, however, is that a feature of Red Hat Enterprise Server 6 (and therefore of all its clones -so this stuff applies to Scientific Linux 6, too) is that it defaults to managing your network connections with NetworkManager, which isn’t actually installed as part of a minimal install. The net result (no pun intended) is that your network doesn’t work when you first boot into your new, slimline O/S.

The fix is to run the command system-config-network-tui, which allows you to specify a fixed IP address manually. In Centos 6, however, even this tool is not installed as part of a minimal install (I guess they took the word ‘minimal’ literally), so you’ll end up having to edit by hand the /etc/sysconfig/network-scripts/ifcfg-eth0 file.

You’ll need to end up with something looking like this:

IPADDR=192.168.0.33
BOOTPROTO=none
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=192.168.0.1
DNS2=192.168.0.2
USERCTL=yes

Obviously, you replace those specific IP addresses with whatever suits your local environment. The USERCTL=yes line is optional: it lets non-root users control the interface. Once the file has the appropriate entries, a reboot will do to make the new settings take effect.

In Scientific Linux 6, the system-config-network-tui tool exists, so you could use that… or you can achieve all these edits with the nano text editor. The Centos 6 minimal install is less forgiving, however, and you’ll have to use vi (because nano is not installed as part of its minimal install option).

CentOS 6… finally

The first question about when CentOS 6 would be released, contained in this thread on the CentOS forums, was asked on December 2nd 2010. 42 pages and 8½ months later, there is finally an answer: it’s out now.

Of course, Red Hat themselves (and Oracle’s Enterprise Linux equivalent) have moved on in the meantime to version 6.1 -and Scientific Linux already have a matching 6.1 beta out, as I’ve mentioned before. Still, better late than never, I guess.

Personally, I think the CentOS devs have blown this, badly -and the tone of their commentary on the forums has been sniffy, at best: not exactly calculated to win friends and influence people, anyway. There have been ‘defections’ in droves to Scientific (count me amongst them), and I don’t see that being reversed any time soon.

There’s not a lot to say about the OS itself, of course (especially since we’ve been using its Scientific binary equivalents for months!), but I have to say I really dislike the fact that it defaults to doing a “minimal” install (not even a “minimal desktop”). It means you get this once the install has finished:

I realise you could argue this is actually a good thing: very Ubuntu Server-like, svelte and exactly what an enterprise-class Server ought to be doing. None of your fancy GUI stuff required etc. I’d certainly vote for (and my kickstart efforts have tried to create) a very much slimmed-down installation. Oracle users will, however, know that an X Server is pretty much a requirement (yup, I know it doesn’t have to be running on the actual Oracle server, but it’s simpler when it does), short of getting into response files and silent installs, so starting off this svelte is a bit of a problem!

Scientific Linux 6.0, by the way, defaults to a standard Desktop install -and, at this stage, I think that’s an easier way to go than CentOS’ choice. It’s also mildly interesting to note that Scientific Linux doesn’t have a “minimal install” option: they call it a “basic server” install instead. What’s more, that installs 514 packages, which is way more than the Centos 6 basic install does. Why supposedly binary-compatible distros vary like this, I can’t say, but I wish they wouldn’t!

There are other niggles with CentOS, too. The GUI installer has not had the Red Hat trademarks cleaned particularly well. Here’s what you see in Centos:

Notice the weird blank, blue bar stretching across the top of the screen? Compare that to Scientific’s installer:

They got the ‘de-branding’ right, CentOS didn’t… which seems a bit slack. I know it’s not a particularly important thing, but I suspect that when the little details like this are wrong, there are ‘polishing’ problems elsewhere. I could, of course, be wrong (probably).

Anyway, it’s things like this, together with the mammoth amount of time taken for the distro to get even this far, which mean I’m deeply suspicious of the quality of this particular release. (Yeah, I know I don’t pay for it, but my expectations are rational, if not reasonable).

Your mileage might vary, of course. And in the meantime, Gladstone has been updated to work on Centos 6.0.

New PC

I was a little heavy-handed a month or two ago when swapping some of my hard disks around. It is a little known fact, but nevertheless true, that if you rip the SATA socket off your motherboard, it has a tendency to (a) spark, fizz and behave slightly alarmingly; and (b) fail to work at all thereafter.

As a result of my clumsiness, I’ve been running everything on a Core 2 Duo, circa 2006. I beefed it up with 8GB of RAM -and it’s been surprisingly useful. But ripping a Blu-Ray on it takes something like 28 hours! Time to replace it with something a bit nippier, therefore. Here’s what I’m getting:

I’m getting four sticks of the RAM, 16GB in all, so I finally have room to breathe when I’m running multiple virtual machines.

It’s because I do a lot of virtualisation and not much over-clocking, too, that I’ve opted for the i7 2600 CPU, rather than the i7 2600K. The ‘K’ chip overclocks a lot more, but it doesn’t have support for Intel VT-D extensions (“Virtualization Technology for Directed I/O). (Neither does any of the current crop of desktop virtualization products, so I suppose the issue’s moot, but that might change and my CPU will be ready for it if it does!)

The hard disk is really irrelevant: I’ll be booting off my existing solid state one and I’ve got 12TB of disk space available of the network, so I don’t really care what goes in the Shuttle case: the Western Digital 1TB happens to provide a useful amount of ‘local’ storage whilst remaining the cheapest currently-available hard disk from my particular supplier (AusPC).

The Other Half got the same Shuttle case not so long ago (although only with an i5 CPU) and it’s pretty good: it’s not a silent PC at all, but the noise is fairly minimal. It looks quite slick, so having it ‘on show’ to visitors is not out of the question. It’s best feature, as far as I’m concerned, is that it can sit unobtrusively on the desktop: that means it’s not close to the floor, which in a house with a couple of cats, has a tendency to attract dust and fibres like crazy! Last time I cleaned the PC innards, it was positively revolting: maybe not quite as bad as this, but close! I’ll be really pleased if a higher, off-ground placing means this PC doesn’t clog up so much!!

I haven’t decided on an operating system yet: it could be Scientific Linux 6.1, or I might just go with Windows 7. I suspect the requirement for Blu-Ray processing means the latter will get the nod in the end.

Anyway, the order went in today and I should be picking it all up, built and tested, on Friday. I am looking forward to it!

Good News/Bad News

Good News: Scientific Linux 6.1 is out in (very stable) Beta. I get mine here.

Bad News: Centos 6.0 still hasn’t been released.

Good News: Scientific Linux 6.1 has a network install boot ISO (as SL 6.0 did, but SL 5.6 didn’t)

Bad News: the Scientific Linux network install boot ISO is over 200MB in size -so you almost might as well install from the original CDs or DVDs! By way of comparison, the Centos 5.6 netinstall boot ISO was only 10MB in size. Maybe not so important when $4 USB drives come in 2GB sizes and up, but annoying nonetheless. I notice Fedora 15′s net install ISO is similarly huge… progress, I guess!

Even Badder News: you can’t use the Centos 5.6 netinstall boot ISO to kick off a Scientific Linux 6.1 install. (At least, I’ve not managed it yet!)

Good News: Gladstone has been updated to work with the 6.1 version of Scientific Linux.