|
Needs Updating |
Ingres Quickstart
How to build, install and set up an Ingres 2006 server in ubuntu.
Introduction
Open source database solutions that provide enterprise-level functionality, services and support are revolutionizing today’s marketplace.
Features
Ingres is a complete relational solution, providing the following features:
- A robust, high-performance relational database management system (RDBMS) on which you can build the best in mission-critical applications.
- Support for the latest technology, such as multiple processors and 64-bit architecture, and standards such as XML and Unicode. The extensive list of supported platforms includes Linux for zSeries and S/390, UNIX, and Windows.
- Easy to manage environment that requires far less maintenance than the competition. Ingres is hard to beat in the area of long-term cost of ownership.
- The Ingres Management Architecture (IMA) tools provide the framework that allows you to create system management applications using standard SQL tools and access multiple installations across Ingres Net.
- Ingres Web Deployment Option provides users with a secure and reliable foundation for Internet-based electronic commerce. Applications developed with Ingres Web Deployment Option can be used to provide full read/write access to enterprise-wide corporate data. Database-driven web sites provide much greater flexibility and can reflect changes in dynamic content as they happen.
- Open connectivity lets you integrate the entire enterprise—from PCs to mainframes. Ingres Net, coupled with the Ingres ODBC and JDBC drivers, let you take advantage of the technologies that drive the business environment. Through ODBC, Ingres allows transparent access to enterprise data repositories. Applications developed through ODBC are independent of hardware, networking protocols, and operating systems. The Ingres ODBC driver uses the native API (application programming interface), effectively making ODBC a native language for Ingres. If you prefer, you can use the OpenAPI to provide access to all distributed databases and take advantage of an alternative to embedded SQL.
- Integration of data from multiple sources on different platforms from a single application. The Enterprise Access products provide a single, standard interface for both relational and pre-relational databases. Real-time access is provided for a variety of client applications running on Windows, OpenVMS, UNIX, and Linux workstations, as well as through web browsers. Popular application development tools can utilize this technology, meaning that your options are unlimited. Databases supported include all popular UNIX or Microsoft Windows-based database management systems such as Oracle, Informix, Sybase, and Microsoft SQL Server. On the OS/390 platform, a separate product called EDBC gives the same level of access to Advantage CA-IDMS Database, Advantage Datacom Database, DB2, VSAM, CICS/VSAM, and IMS — so you can truly take your data from anywhere.
- Ingres Distribution Option supports distributed databases across a wide variety of hardware, software, and networking architectures. Regardless of whether the data resides on desktops or mainframes, Ingres Distributed Option lets you treat all your enterprise data as a single, global Ingres database.
- Ingres Replicator Option provides fault-tolerant data replication and guaranteed data integrity. Two-way replication allows your business to carry on when the network link is down. This process holds the data and completes the replication as soon as the network becomes available. Data is readily available to users at anytime or anywhere, and can be administered using the graphical user interface of Visual DBA.
- The Ingres character-based tools including Embedded SQL and Vision are available for more traditional environments. Embedded SQL programming kits are available for C, COBOL, Fortran, and several other 3GLs.
- Additional platform-specific, TP monitoring, and cluster support options, provide the integrity and reliability you need in a distributed environment by ensuring that transactions do not get lost or damaged.
- The Ingres Cluster Solution on Linux provides support for Linux Cluster environments. Ingres exploits open source and third party software to provide extensions to the base operating system. This software includes cluster file systems such as Oracle Cluster File System (OCFS) and the Red Hat Global File System (GFS), and the OpenDLM Distributed Lock Manager (DLM) based on the AIX DLM released by IBM to the open source community. Linux Cluster support lets you achieve scalability and reliability on a low-cost clustering platform.
Building Ingres
Unfortunately, there is no Ingres pre-built package for Ubuntu. Therefore you should build Ingres from source. There are now two options to build Ingres from source, the first is downloading the source from http://esd.ingres.com/product/Ingres_Database/ and the second is checking it out from the SVN repository at http://code.ingres.com/ingres/main.
Building Ingres using Subversion
All these commands are run with a user named ingres with root privileges
First install subversion so we can pull the latest Ingres code
sudo apt-get install subversion
After this, you want to make a directory to install ingres to. This can be anywhere, /opt is a good location(but will require root access). For the purpose of this tutorial, I will assume that you are installing ingres to ~/ingres
mkdir ~/ingres
Next, you have to pull the ingres code. Pulling the code is simple
svn co http://code.ingres.com/ingres/main <place you want to put the code> e.g. svn co http://code.ingres.com/ingres/main ~/ingres
Preparation for Hardy or previous
sudo apt-get install jam g++ gcc make libpam0g-dev libxerces27 libxerces27-dev libkrb5-dev pax ccache gcc-multilib g++-multilib flex
Preparation for Intrepid and Jaunty
If you're using Intrepid, apt-get will complain that libxerces27 and libxerces27-dev do not exist. This is because they're the old versions. However, ingres only works with the versions specified here. To get around this, simply install every other library
sudo apt-get install jam g++ gcc make libpam0g-dev libkrb5-dev pax ccache gcc-multilib g++-multilib flex
and download the other two libraries from any mirror listed in the appropriate page
libxerces-27: http://packages.ubuntu.com/hardy/i386/libxerces27/download
libxerces-27-dev: http://packages.ubuntu.com/hardy/i386/libxerces27-dev/download
then
sudo dpkg -i *.deb
in the download directory Note: Please ensure that there are no ever .debs in the directory you are installing from
Preparation for Karmic
3.1 Install Dependencies
- sudo apt-get install bison flex ftjam g++ gcc gcc-multilib g++-multilib libncurses5-dev libpam0g-dev libpam0g-dev libxml2-dev make pax subversion
3.2 Installing Xercesc
Unfortunately the Ubuntu repositories don't have the 32-bit version of the libxerces27 libraries so you have to install them manually. You can either build it from source or install a pre-compiled version. If you have already installed xerces as part of the Intrepid guide, it is safe to skip this step
3.2.1 to build from source
Follow the process described athttp://community.ingres.com/wiki/Community_Build_Page#Problems.2C_Gotchas.2C_Solutions_and_Workarounds but instead of copying to $XERCESCROOT/lib/lp32, copy the libraries to /usr/lib32 - which is the location for 32-bit libraries on Ubuntu
- sudo cp -p $XERCESCROOT/lib/lib* /usr/lib32
3.2.2 to install a pre-compiled version
*grab the archive (currently this link works, you may need to check it)
wget http://archive.apache.org/dist/xml/xerces-c/Xerces-C_2_7_0/binaries/\ xerces-c_2_7_0-redhat_AS4-gcc_343.tar.gz
*untar
- tar zxf xerces-c_2_7_0-redhat_AS4-gcc_343.tar.gz
*copy libraries to /usr/lib32
- sudo cp -P xerces-c-redhat_AS4-gcc_343/lib/* /usr/lib32
3.3 Changing build variables
Due to some known issues in the Ubuntu distribution, certain build variables need to be changed in order to successfully compile the database. This involves editing the file $ING_ROOT/src/tools/port/jam/Jamdefs.hyb86_lnx
3.3.1 -fno-stack-protector
Ubuntu Karmic has certain issues with stack protection, resulting in libgcskrb being unable to link. As such, Ingres needs to be built with the -fno-stack-protector option. To accomplish this, location the line beginning with CCMACH32 and add the flag -fno-stack-protector to the line of options
3.3.2 -U_FORTIFY_SOURCE
Due to Ingres using certain 'tricks' to make the best use out of available memory, the kernel can see Ingres as a potential buffer overflow, aborting the program at run time. In order to fix this, Ingres should be built with the -U_FORTIFY_SOURCE option To accomplish this, location the line beginning with CCMACH32 and add the flag -U_FORTIFY_SOURCE to the line of options
The ingres installation script is set to look for basename in /bin. In ubuntu, basename exists in /usr/bin. The fastest way to resolve issues associated with this is
sudo ln /bin/usr/basename /bin/basename
When the SVN checkout is complete we will start the build (feel free to use the tail command supplied by the script to watch the progress) If the checkout gets interrupt for any reason, just do an svn update ~/ingres
cd ~/ingres bash runbuild.sh
Note: Due to ubuntu using dash as the default shell instead of bash, the above directive "bash runbuild.sh" must be used instead of "./runbuild.sh"
Build *should* complete without errors, next we create an install for testing and installer packages
buildtools/createdbms II
Note: "II" can be any abitrary two character string. Usually, your initials are used.
If you want Ingres installed in a custom location with a custom Installation ID run the following commands
cd /devsrc/ingres_main/release/ingres-{release...} sudo ./ingres_express_install.sh [Installation ID] [Install directory]
Building Ingres using the tar source
Preparing to build
Building Ingres from source requires installation of a few tools with a specific versions (note: with version 9.1.x or newer you can use up to gcc-4.2).
# sudo apt-get install gcc-3.4 g++-3.4 make jam
Also, you should make those tools your defaults,
# sudo rm /usr/bin/gcc # sudo rm /usr/bin/g++ # sudo rm /usr/bin/cpp # sudo rm /usr/bin/cc # sudo ln -s /usr/bin/gcc-3.4 /usr/bin/gcc # sudo ln -s /usr/bin/g++-3.4 /usr/bin/g++ # sudo ln -s /usr/bin/cpp-3.4 /usr/bin/cpp # sudo ln -s /usr/bin/gcc-3.4 /usr/bin/cc
so when query the version of each one you will get 3.4.*, as:
# gcc --version gcc (GCC) 3.4.6 (Ubuntu 3.4.6-1ubuntu2) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # g++ --version g++ (GCC) 3.4.6 (Ubuntu 3.4.6-1ubuntu2) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # cpp --version cpp (GCC) 3.4.6 (Ubuntu 3.4.6-1ubuntu2) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For the compilation to be successful you also have to install a few additional libraries and programs
# sudo apt-get install librpm-dev libgtk2.0-dev jam
Now you should create a new user account in the system. Add a new user, the username is not important, but I will use 'ingres' for example. Note: while previous versions of the ingres database program required the user to be named 'ingres', this is no longer the case. The program can even be run from your existing user account.
# adduser ingres
Add the created user to the kmem group:
# useradd -g kmem ingres
Switch the user to ingres:
# sudo -u ingres -s # cd /home/ingres
Create a new folder 'ingres2006-src', and move there:
# mkdir ingres2006-src # cd ingres2006-src
Then, you should download the source of the Ingres 2006 from http://downloads.ingres.com/download/ingres2006-9.0.4-103-gpl-src.tgz :
# wget http://downloads.ingres.com/download/ingres2006-9.0.4-103-gpl-src.tgz
Extract the archive:
# gunzip < ingres2006-9.0.4-103-gpl-src.tgz | tar xvf -
Set ING_ROOT to the current folder:
export ING_ROOT=`pwd`
Building Dependencies
In addition to the Ingres source code itself, you will need the Xerces 2.5 headers and library (which provide the XML link between Ingres and the Apache web server), and you will need the Kerberos network authentication protocol headers.
Also required for the build is a special version of pax (the Portable Archive Interchange program). Modifications have been made to this program to allow it to work with the Ingres checkpoint process. (Support has been added for the OCFS file system and for Linux files up to 8GB in length. While the standard version of pax is adequate for creating the Ingres tar installation medium, it is not suitable for Ingres runtime operations.) All of these dependencies are included with the Ingres source package.
Building pax
Building pax is so simple:
# cd $ING_ROOT/pax # jam
Building xerces-c
To build Xerces, you need to modify one file in its source code. Move to '$ING_ROOT/xerces-c-src_2_5_0/src/xercesc/util' folder, and create a patch file 'RefArrayOf.hpp.patch'
# cd $ING_ROOT/xerces-c-src_2_5_0/src/xercesc/util # vi RefArrayOf.hpp.patch
The patch file should contain this text:
103a104 > #include <xercesc/framework/MemoryManager.hpp>
Patch RefArrayOf.hpp:
# patch RefArrayOf.hpp < RefArrayOf.hpp.patch
Build Xerces-c
# cd $ING_ROOT/xerces-c-src_2_5_0 # export XERCESCROOT=`pwd` # cd $XERCESCROOT/src/xercesc # autoconf # runConfigure -plinux -cgcc-3.4 -xg++-3.4 -minmem -nsocket -tnative -rpthread # make
Building Ingres itself
You should move to $ING_ROOT, and then prepare the environment variable as:
# cd $ING_ROOT # source src/tools/port/jam/bldenv
Next, bootstrap the build. This includes building mkjam and mkjams, which automate the creation of Jamfiles, and then invoking mkjams to set up the build tree:
# cd $ING_SRC/tools/port/jam # jam # mkjams # cd $ING_SRC
You are now ready to compile Ingres. This is done with the following command:
# jam
Because of the voluminous output of the build process and because you may want to examine the full output, it is wise to redirect the jam output to a file. For example:
# jam >& jam.out & # tail -f jam.out
In my computer it took about 15 minutes to finish the compilation. In the end you should get no skipped or failed targets.
Auditing the build
Some warning messages are expected during the build process (for explanations of some of these, see the Ingres building FAQ at http://www.ingres.com/).
How can you tell, then, if the build was successful? First, look at the final messages issued by jam. Jam should report a (large) number of targets "updated", and should NOT report any targets as "failed" or "skipped".
You should also run two programs to check the status of the build process for Ingres itself and for its testing tools. To be sure that the building of all Ingres components is successful, use the buildrel program's audit option:
# buildrel -a
Note that the buildrel audit step is required, since buildrel (in addition to checking for missing files) adjusts the file permissions of some of the built files. If the Ingres build is successful, buildrel will not report any missing files.
As a final auditing step, make sure that all the files needed for Ingres acceptance testing were correctly built:
# tartools -a
If this command too reports no missing files, your build is complete!
Packaging Ingres
Ingres can be packaged for installation either as a standard tar ball or as a set of RPM packages. There is no documentation how to build a .deb packages for ubuntu for now.
In ubuntu, you will be using the tar format. Therefor you must first assemble the Ingres components for packaging using the buildrel program.
First, set up a staging area for this assembly process. Typically, you would want to name this staging directory based on the "build=" line in $ING_SRC/tools/port/conf/VERS. For example, if the VERS file contains the line build=00 you would use the following commands:
# mkdir -p $ING_ROOT/release/r00 # cd $ING_ROOT/release/r00 # export II_RELEASE_DIR=`pwd` # buildrel
To create an installable Ingres tar ball, simply create a tar file that contains the components of this staging area:
# tar cvf ../ingres.tar *
There is nothing magic about the name "ingres.tar". For clarity (keeping track of product builds and the resulting tar files) you could call this, for example, "r00.tar" or "ingres_r00.tar".
Installing Ingres
To install Ingres in the simplest manner, unpack the ingres.tar in a directory, for example /opt/ingres
# mkdir /opt/ingres # cd /opt/ingres # tar xvf /path/to/ingres.tar
then set the environment variable II_SYSTEM to this directory and execute ingbuild
# $II_SYSTEM/ingres/install/ingbuild -all /path/to/ingres.tar
In order to work with your Ingres installation, you should set some environment variables for the ingres-user. Add the following to the .bashrc of your ingres-user
export II_SYSTEM=/opt/ingres export PATH=$II_SYSTEM/ingres/bin:$II_SYSTEM/ingres/utility:$PATH export LD_LIBRARY_PATH=$II_SYSTEM/ingres/lib:$LD_LIBRARY_PATH export TERM_INGRES=konsolel
Now you can use all the tools supplied by ingres as the ingres-user. I suggest you start with
# createdb <database name>
to create your first database.
For a more complex setup/configuration, as it is highly suggested, have a look at the Ingres documentation.
Further Reading
References
1. The INSTALL file in the ingres source package.
2. A post from Michael Touloumtzis in http://groups.google.com/group/fa.ingres/browse_frm/thread/d6c232ec984d101c/28e793aa27600861?tvc=1#28e793aa27600861
3. Ingres® 2006 Getting Started (gs.pdf).
4. Ingres® 2006 for Linux Getting Started (gs-linux.pdf).