Since I last wrote about CoLinux it has become a useful tool within our team. In addition to the advantages of having a concurrent virtualized Linux server running natively on a machine that would otherwise be limited to Windows, a key factor for me is that the Linuxfilesystem is a simple Windows file. After configuring an instance (say installing IDS, CSDK, gcc, g++, make, Apache, php, Informix_PDO, Zend etc...) the filesystem can be saved as a zip file and shared with others.
If I do something reckless (like overwrite an OS threading library with a bad version) and trash the system, as long as I saved the filesystem prior to the misdeed, recovery is as simple as copying a file and restarting coLinux.
Setting up X-Windows is straightforward, the easiest way seems to be to install and start the CygWin X-Server on Windows and use the xhost command to allow access to the desktop. Set the DISPLAY environment variable in Linux to point to the Windows IP address, and x applications (once they're installed) should then display on Windows.
Networking issues - Basic network setup is straightforward and covered in the Wiki. This ONLamp blog post also has some useful suggestions for unplugged machines. I have yet to find a good wireless network solution though.
Update: This Wiki entry suggests specifying the MAC address of your wireless card to get wireless working with WinPCAP.
Typical usage scenario
Problem: We have a conference demo which uses the LAIP stack (Linux, Apache, Informix, PHP) - and the conference organizers only provide a Windows PC and a demo setup window of a few hours.
Solution: Set up the demo in CoLinux and when it's ready zip the filesystem and take it along on a flash drive. Set-up time is as long as it takes to install CoLinux and WinPCap, unzip the filesystem and start CoLinux on the demo machine. Alternative options would be to convert the demo to Windows (WAIP) and install and configure all the software, or maybe create a customized Linux live cd, but the CoLinux solution seems the simplest, and the same zipped archive can be used by anyone wishing to give this demo in the future.
As with other virtualization solutions it is also possible to run multiple CoLinux instances on one machine capable of communicating with each other, which would make for a useful self-contained high availability (e.g. HDR or ER) test/demo between two virtual servers.[Read More]
Administrating and Developing with Informix
with Tags: unix X
Until fairly recently, a new Intel/AMD machine in the lab meant choosing which operating system to install on it. Nowadays semi-ubiquitous virtualization and free offerings from the likes of Vmware and Microsoft make it easier to run multiple concurrent operating systems.
For a personal computer, I can't be bothered with fully fledged virtualization software; if I want to run Windows and Linux concurrently Cooperative Linux fits the bill. CoLinux is a Linux daemon that runs natively on Windows. I recently gave the latest version a test drive. The installation and setup process was pretty simple..
cofs0:/ /mnt/cdrive cofs user,noexec,dmask=0777,fmask=0666 0 0
At this point CoLinux is pretty much configured. The Wiki has more detailed setup and configuration instructions (such as enabling swap space etc) and a FAQ. One thing lacking from the Debian image I tried was vi, but fixing that was as simple as running:
apt-get updateapt-get install vim
This also had the benefit of updating glibc as a pre-requisite. On Fedora it's a good idea to run yum update to get the basic software up to date.
Next I tried installing Informix Dynamic Server - ok probably not a supported configuration but it works. So far only installed IDS version 7.31.UD10 as it was the smallest tar file that was lying around. The fedora 2GB filesystem image had 1GB of free space and additional filesystems can be added so plenty of room for any version plus dbspaces (not looked into to whether there's a way to implement raw devices for dbspaces).
IDS installation was standard, created an informix user and group with:
groupadd informixuseradd informix -d /informix -g informix -m
Copied the IDS tar file to c:\temp, and then untarred it directly into the chosen INFORMIXDIR with:
tar xvf /cdrive/temp/ids.7.31.UD10.LINUX-I32.tartar xvf IDS.tar
The rest of the installation was identical to installing IDS on any Linux machine - set INFORMIXDIR, run installserver as root, create an environment file to set INFORMIXDIR, INFORMIXSERVER, PATH, ONCONFIG, create and edit an onconfig file, add an sqlhosts file onipcshm entry, create an empty root dbpsace file. Here's the oninit -ivy output...
It's good to have Linux on Windows this accessible, and there are plenty of possibilities for making it easier.. such as running Samba to access the Linux filesystem from Windows, setting up sshd, sftpd. Should make for some interesting configuration tests, like running Enterprise Replication between IDS on Windows and IDS on Linux on the same machine..
Update 9/5/06: Tried installing the latest IDS 10.0 (10.00.UC5W3) on CoLinux with the Fedora 2.6 filesystem - the only gotcha is that IDS 10.0 has a dependancy on libstdc++.so.5 and the gcc version I'd installed had a later version, so to get IDS working I borrowed libstdc++.so.5 from another Linux machine - after that IDS installed and ran fine (and fast). This IIUG post by Andreas Breitfeld tells you what you need to know to get IDS 10+ working with Debian.[Read More]
Suppose you find your IDS instance hung? There are users waiting and you need to run some diagnostics quickly.. what information do you collect? Hopefully you'll never be in that situation thanks to IDS's legendary uptime but it's good to be prepared..
A new Technote is available which includes a (UNIX) script to gather information that will be useful to Technical Support: What to collect if a IBM Informix IDS server gets hung. Give it a try and see what you think. You can enter feedback directly, or put it here and I'll forward it to the author.[Read More]
A while back I briefly discussed how to set up High-Availability Data Replication (HDR) on a single Windows machine for testing purposes. One of my compadres has just written a much more in-depth guide to doing this which was published today - see: Setting up HIGH AVAILABILITY DATE REPLICATION (HDR) on a single installation of IBM Informix Dynamic Server on Windows.
If you prefer to do your HDR testing on UNIX try this older article instead: Setting up HIGH AVAILABILITY DATA REPLICATION (HDR) and ENTERPRISE REPLICATION (ER) on a single installation of IDS 9.40 for testing purposes.[Read More]
The dbaccess user interface might not have changed much since the invention of the abacusbut it's very flexible when it comes to running scripts. For example to execute a file containing SQL commands against a database called mydb:
dbaccess mydb sql_file.sql
Or if the SQL commands already include a database connection statement:
dbaccess - sql_file.sql
If you wish to enter SQL statements interactively without the menu, enter
dbaccess - -
Suppose you want to integrate a series of SQL statements within a UNIX shell script or Windows batch file. A simple method would be to pipe commands one at a time into dbaccess, e.g.:
echo select col1 from tab1 | dbaccess mydb
Or you could chain a series of SQL statements together to send to dbaccess. This is a typical methodwe'd use to create a self-contained bug reproduction. An engineer can then reproduce the problem byexecuting the shell script.
Here's a UNIX shell script that creates a database, inserts data, queries a table, and drops thedatabase:
#!/bin/shdbaccess - <<EOFcreate database test;create table t1(col1 serial, col2 char(20));insert into t1 values(0, "hello");select * from t1;close database;drop database test;EOF
Can this be done with a Windows batch file? Yes.
Here's the equivalent batch file:
echo create database test; ^create table t1(col1 serial, col2 char(20)); ^insert into t1 values(0, "hello"); ^select * from t1; ^close database; ^drop database test | dbaccess -Although it lacks the power of UNIX shells I can't help enjoying the simplicity of the Windows command language - 10 commands are easy to remember.
While I'm on the subject of integrating shell scripts with SQL, it's worth mentioningMarco Greco's Structured Query Scripting Language (SQSL). An open source project that provides a method of integrating SQL statements withreporting and formatting commands.[Read More]