Installing Informix on Ubuntu
Create Informix User and Group:
Informix requires a dedicated user and group for secure operation. Run the following commands as root:
sudo groupadd informix
sudo useradd -g informix -d /opt/informix -m informix
sudo passwd informix
This creates the informix group and user, with a home directory at /opt/informix.
Set Up Environment Variables:
Switch to the informix user and edit the ~/.bash_profile file to configure essential environment variables:
su - informix
vi ~/.bash_profile
Add these lines (adjust paths as needed for your Informix version):
export INFORMIXDIR=/opt/informix
export INFORMIXSERVER=myifxserver # Unique name for your database server
export ONCONFIG=onconfig.myifx # Configuration file name
export LD_LIBRARY_PATH=$INFORMIXDIR/lib:$LD_LIBRARY_PATH
export PATH=$INFORMIXDIR/bin:$PATH
Save the file and run source ~/.bash_profile to apply changes.
Download and Install Informix:
Obtain the Informix Linux package from IBM’s official website. Extract it to /opt/informix:
tar -xzf informix-<version>.linux-x86-64.tar.gz -C /opt/
Change to the extracted directory and run the installer:
cd /opt/informix
sudo ./ids_install
Follow the on-screen prompts to complete the installation.
Configure Database Parameters:
Copy the sample configuration file and customize it:
cd /opt/informix/etc
cp onconfig.std onconfig.myifx
vi onconfig.myifx
Key parameters to modify:
ROOTNAME: Name of the root dbspace (e.g., rootdbs).ROOTPATH: Path to the root dbspace file (e.g., /opt/informix/data/rootdbs).ROOTSIZE: Initial size of the root dbspace (e.g., 100000 pages).DBSERVERNAME: Must match INFORMIXSERVER in .bash_profile.Prepare Database Storage:
Create the root dbspace directory and file, then set correct permissions:
mkdir -p /opt/informix/data
touch /opt/informix/data/rootdbs
chown informix:informix /opt/informix/data/rootdbs
chmod 660 /opt/informix/data/rootdbs
Initialize and Start the Database:
Stop any running database processes (if applicable) and initialize the database:
onmode -ky # Stop the database (if running)
oninit -iv # Initialize and start in interactive mode
The -i flag initializes the database, and -v enables verbose output.
Verify Database Status:
Use the onstat utility to check if the database is running:
onstat -i
Look for “Database selected” or “Server is up” in the output.
Connecting to Informix
Use dbaccess (Command-Line Tool):
The dbaccess utility is the primary way to interact with Informix via the command line. Connect to your database:
dbaccess myifxserver
Replace myifxserver with your INFORMIXSERVER name. You’ll be prompted for the informix user’s password. Once connected, you can run SQL queries directly (e.g., SELECT * FROM systables;).
Connect via Application:
For programmatic access (e.g., Python), use the Informix ODBC driver or libraries like ibm_db_sa. Example Python connection string:
import ibm_db
conn = ibm_db.connect("DATABASE=mydb;HOSTNAME=localhost;PORT=9088;PROTOCOL=TCPIP;UID=informix;PWD=yourpassword;", "", "")
Adjust parameters (database name, hostname, port) to match your setup.
Managing Informix Services
Start the Database:
Use onmode to start the database in normal mode:
onmode -c all
Stop the Database:
Gracefully shut down the database:
onmode -ky
Restart the Database:
Restart the database server:
onmode -c reset
Check Server Status:
Use onstat to monitor the server:
onstat - # Shows server status, memory usage, and active sessions
onstat -d # Displays dbspace information
Key Notes for Success
/opt/informix, /opt/informix/data) are owned by the informix user and have 660 permissions for files.9088 for TCP/IP) are open in your firewall. Update /etc/services if necessary to define custom ports.onconfig.myifx and sqlhosts (located in /opt/informix/etc) to avoid losing custom settings./opt/informix/logs for error logs if you encounter issues during startup or operation.For advanced configurations (e.g., remote access, replication), refer to IBM’s official Informix documentation for Ubuntu-specific guidance.