Sunteți pe pagina 1din 3

Informix Setup in Linux

This guide is a basic tutorial on installing the IBMInformix database software for Linux. The instructions below
were tested with Informix Innovator-C 11.70 in Fedora 17, but they should work with other Linux distributions
(and possibly with other Informix editions, such as Informix Developer).
1. As root, create an informix group and an informix user:
groupadd informix
useradd -g informix informix
passwd informix
2. As root, run the informix installation program from a temp directory: (Note: During the installation, install
in /opt/IBM/informix and allow the creation of a default database instance (usually called demo_on).
Replace iif.11.70.FC5IE.linux-x86_64.tar by whatever version you have.)
mkdir /tmp/informix
cp iif.11.70.FC5IE.linux-x86_64.tar /tmp/informix
cd /tmp/informix
tar xvf iif.11.70.FC5IE.linux-x86_64.tar
./ids_install -i gui
3. Create a le /etc/profile.d/informix.sh with these contents:
INFORMIXDIR=/opt/IBM/informix
INFORMIXSERVER=demo_on
if ! echo ${PATH} | /bin/grep -q ${INFORMIXDIR}/bin ; then
PATH=${INFORMIXDIR}/bin:${PATH}
fi
export INFORMIXDIR PATH INFORMIXSERVER
4. Create a le /etc/ld.so.conf.d/informix.conf with these contents:
/opt/IBM/informix/lib
5. As root, update the shared library cache:
ldconfig
6. As the informix user, edit your .bashrc le to have these contents:
export INFORMIXDIR=/opt/IBM/informix
export INFORMIXSERVER=demo_on
export ONCONFIG=/opt/IBM/informix/etc/onconfig
export INFORMIXTERM=terminfo
7. As the informix user, shut down Informix if it is running after the installation:
/opt/IBM/informix/bin/onmode -ky
/opt/IBM/informix/bin/onclean
8. (Optional) As root, kill any remaining Informix processes
killall -9 oninit
9. As the informix user, create a le /opt/IBM/informix/etc/onconfig:
cd /opt/IBM/informix/etc
cp onconfig.std onconfig
1
10. As the informix user, edit the /opt/IBM/informix/etc/onconfig le so that the following elds have
these values:
DBSERVERNAME demo_on
DBSERVERALIASES ifx_tcp
FULL_DISK_INIT 1
LTAPEDEV /dev/null
11. As the informix user, create a le /opt/IBM/informix/etc/sqlhosts:
cd /opt/IBM/informix/etc
cp sqlhosts.std sqlhosts
12. As the informix user, add the following line to the bottom of the /opt/IBM/informix/etc/sqlhosts le,
where <my.host.name> is replaced by your machines hostname (e.g. machine1.somedomain.com):
ifx_tcp onsoctcp <my.host.name> informix_tcp
13. As the informix user, do the following (workaround for Informix not starting by default due to a shared
memory error):
cd /opt/IBM/informix/tmp
touch demo_on.rootdbs
chmod 660 demo_on.rootdbs
14. As root, add to the /etc/services le the following line (you can replace 24067 by any unused port):
informix_tcp 24067/tcp
15. As the informix user, start and initialize Informix:
/opt/IBM/informix/bin/oninit -ivy
16. As the informix user, create a new dbspace (for holding new databases) called dbspace01 of size 500MB
(512000KB) or whatever size you want:
mkdir /opt/IBM/informix/data
touch /opt/IBM/informix/data/dbspace01
chmod 660 /opt/IBM/informix/data/dbspace01
cd /opt/IBM/informix/bin
./onspaces -c -d dbspace01 -p /opt/IBM/informix/data/dbspace01 -o 0 -s 512000
./ontape -s -L 0 -d -t /dev/null
17. As the informix user, create a new database called database1, as part of dbspace01. To do this, run
dbaccess in interactive nonmenu mode (use ctrl-d to exit from the dbaccess > command prompt):
/opt/IBM/informix/bin/dbaccess - -
> create database database1 in dbspace01 with log;
18. As the informix user, create a table called linux in database1 with two text columns called user and gui.
First, create a le called linux.sql with the following commands for creating the table and populating it
with some entries:
CREATE TABLE linux (user VARCHAR(100), gui VARCHAR(100)) IN dbspace01;
INSERT INTO linux (user,gui) VALUES ('RupertPupkin','Window Maker');
INSERT INTO linux (user,gui) VALUES ('smr54','Fluxbox');
INSERT INTO linux (user,gui) VALUES ('Dan','Enlightenment');
INSERT INTO linux (user,gui) VALUES ('BBQDave','XFCE');
2
19. Now, as the informix user, run dbaccess with the linux.sql le:
/opt/IBM/informix/bin/dbaccess database1 linux.sql
20. Informix uses OS-level users and authentication, so as root you should create a user that will be allowed
to connect to the database and perform typical operations. Suppose you call this user dbuser:
useradd dbuser
passwd dbuser
21. Now, as the informix user, give dbuser some permissions on the database and table, by running the
following commands (ctrl-d to exit):
/opt/IBM/informix/bin/dbaccess database1 -
> grant connect to dbuser;
> grant select,insert,update,delete on linux to dbuser;
22. The user dbuser should now be able to query the database over the network using the port number from
Step 14 and the password from Step 20. The dbaccess program can also be used, either in interactive
nonmenu mode (dbaccess database1 -) or in the full menu mode (dbaccess database1). For connec-
tivity via a programming language, the details will vary by language but in general you will likely have
to set the INFORMIXSERVER value to ifx_tcp to connect over the network. The following is an example
of using Javas JDBC to connect to database1 on port 24067 on machine1.somedomain.com as the user
dbuser with password something:
Class.forName("com.informix.jdbc.IfxDriver");
String url = "jdbc:informix-sqli://machine1.somedomain.com:24067/database1:" +
"INFORMIXSERVER=ifx_tcp;user=dbuser;password=something";
Connection conn = DriverManager.getConnection(url);
23. (Optional) Copy the JDBC driver to your Java extensions directory:
cp /opt/IBM/informix/jdbc/lib/ifxjdbc.jar /usr/java/jre/lib/ext
24. To shut down Informix, run this command (as the informix user):
/opt/IBM/informix/bin/onmode -ky
25. To start Informix, run this command (as the informix user): (Note: Do NOT use the -i option to start
Informix after youve created dbspaces and databases, or those will be erased! The -i option is only
needed for disk initialization when rst installing Informix.)
/opt/IBM/informix/bin/oninit -v
26. (Optional) To create more tables within the database1 database, repeat Steps 18, 19, and 21, just with
dierent names (i.e. not linux). To create more databases within the dbspace01 dbspace, repeat Step
17, just with dierent names (i.e. not database1). To create more dbspaces, repeat Step 16, just with
dierent names (i.e. not dbspace01) and possibly dierent sizes (depending on your needs).
3

S-ar putea să vă placă și