Linux平台安装Informix Dyanmic Server 10.00.UC4
第一步,安装必须的包(RH AS3)
gcc and c++ compiler 3.2.3
compat-gcc-7.3
compat-gcc-c++-7.3
compat-libstdc++-7.3
glibc-devel-2.3.2
libaio-0.3.96
libgcc-3.2.3
libstdc++-3.2.3
ncurses-5.3
openmotif-2.2.3
pam-0.75
XFree86-libs-4.3.0
第二步,搭建安装环境
1.建立informix用户组和用户
以root身份登陆,然后:
groupadd -g 3000 informix
useradd -u 3000 -g 3000 informix -d /home/informix -m informix
2.修改环境变量
#su informix
#cd
#ls -a
#vi .bash_profile
修改为如下:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
#PATH=$PATH:$HOME/bin
INFORMIXDIR=/opt/informix //informix的安装路径
export INFORMIXDIR
INFORMIXSERVER=informix //informix的服务器名
export INFORMIXSERVER
ONCONFIG=onconfig.informix //informix的配置文件名
export ONCONFIG
LD_LIBRARY_PATH=/opt/informix //informix的lib库路径
export LD_LIBRARY_PATH
PATH=$PATH:$HOME/bin:$INFORMIXDIR/bin
export PATH
unset USERNAME
保存退出之后,修改权限
#chmod 755 .bash_profile
使以上设定生效
#./.bash_profile
第三步,上传安装文件
1.用SecureFX连接虚拟机,将安装文件IDS.10.00.UC4.Linux.tar上传到 /home/informix 目录下
2.以root/informix身份登陆系统,到/home/informix,解压安装文件
$tar xvf IDS.10.00.UC4.Linux.tar
第四步,开始安装
以root身份登陆(我看过网上的很多文档,都是以informix用户登陆来安装,但我以informix身份登陆进行安装的时候,系统提示我需要以root身份来安装)
#cd /home/informix/SERVER
执行安装脚本
#./installserver
Initializing InstallShield Wizard........
Launching InstallShield Wizard........
1. Release Notes
2. Quick Beginnings Guide
3. Begin Installation
Please select one of these options [3] //回车
Beginning installation...
接下来的安装过程要做一些选择,都比较简单,基本上按照默认的就可以,一路回车,直到安装完成,得到如下提示:
Please read the information below.
Set required environment variables
Set $INFORMIXDIR to the directory where the IDS server is installed.
Set $PATH to include $INFORMIXDIR/bin
Set $INFORMIXSERVER to the name of the database server
Set $ONCONFIG to the name of the active onconfig configuration file.
If using a sqlhosts file other than $INFORMIXDIR/etc/sqlhosts
Set $INFORMIXSQLHOSTS
If using a locale/language other than the default
Set $CLIENT_LOCALE
Set $DB_LOCALE
Set $SERVER_LOCALE
Set $DBLANG
Prepare connectivity files
sqlhosts
/etc/hosts
/etc/services
Prepare configuration file
Set DBSERVERNAME
Set SERVERNUM
Set ROOTNAME
Press ENTER to read the text [Type q to quit]
Set ROOTPATH
Set ROOTSIZE
Initialize database server
As informix or root, run oninit
If initializing a new server for the FIRST time, run oninit -i
This will overwrite any existing data, so use caution on an exis
ting setup
我们可以根据提示来具体的配置informix服务器。
第五步,配置informix
1. 在informix安装目录建立data目录,然后touch一个空文件作为数据库的默认设备,并且修改空文件的权限为660
$ mkdir data
$ cd data
$ touch datadbs.dat
$ chmod 660 datadbs.dat //一定要执行这一步,否则在后续的启动过程中会出错
2.配置onconfig文件
默认的配置文件在 /opt/informix/etc/onconfig.std
我们复制一份,并且改其后缀名为之前设定的informix服务器名,此处为 informix
$cd /opt/informix/etc/onconfig.std
$cp onconfig.std onconfig.informix
$vim onconfig.informix
打开之后,我们需要修改的地方有以下几项:
# Root Dbspace Configuration
ROOTNAME rootdbs # Root dbspace name //rootdbs换成datadbs
ROOTPATH /dev/online_root # Path for device containing root dbspace
// 把/dev/online_root换成 /opt/informix/data/datadbs.dat
ROOTOFFSET 0 # Offset of root dbspace into device (Kbytes)
ROOTSIZE 30000 # Size of root dbspace (Kbytes)
# Physical Log Configuration
PHYSDBS rootdbs # //rootdbs换成 datadbs
PHYSFILE 2000 # Physical log file size (Kbytes)
# System Archive Tape Device
TAPEDEV /dev/tapedev # Tape device path //tapedev换成null
TAPEBLK 32 # Tape block size (Kbytes)
TAPESIZE 10240 # Maximum amount of data to put on tape (Kbytes)
# Log Archive Tape Device
LTAPEDEV /dev/tapedev # Log tape device path //tapedev换成null
LTAPEBLK 32 # Log tape block size (Kbytes)
LTAPESIZE 10240 # Max amount of data to put on log tape (Kbytes)
# System Configuration
DBSERVERNAME # Name of default database server
//数据库服务器名称,这里设置成和环境变量里的一样 informix
最后,将这个文件中所有的/usr/informix换成 /opt/informix (informix的安装目录)
可以使用shell脚本命令来完成,在命令行运行
:%s/\/usr\/informix/\/opt\/informix
3.配置系统服务(需要root权限)
su到root用户
#vim /etc/services
在最后一行,添加如下内容:
informix_services 8888/tcp #informix server services
4.配置sqlhosts文件(切换回informix用户)
安装完成后,有个默认的sqlhosts.std文件,在/opt/informix/etc 目录下
$cd /opt/informix/etc
$cp sqlhosts.std sqlhosts
$vim sqlhosts
修改为如下内容:
informix onipcshm rouse informix_services
informix onsoctcp rouse informix_services
informix:是数据库服务器名,和环境变量中的一样
onipcshm/onsoctcp:使用的协议名称,连接数据库的两种方式
rouse:主机名,和/etc/hosts里的一样
informix_services:服务名,和/etc/services中的一样
5.启动informix
修改完所有配置文件之后,重启系统,然后可以尝试启动informix服务器
$ oninit -ivy //第一次启动的时候需加 -ivy参数,以后正常启动时直接 oninit
Checking group membership to determine server run mode...succeeded
Reading configuration file '/opt/informix/etc/onconfig.informix'...succeeded
Creating /INFORMIXTMP/.infxdirs...succeeded
Creating infos file "/opt/informix/etc/.infos.informix"...succeeded
Linking conf file "/opt/informix/etc/.conf.informix"...succeeded
Writing to infos file...succeeded
Checking config parameters...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 1380 kbytes...succeeded
Allocating 10016 kbytes for buffer pool of 2K page size...succeeded
Initializing rhead structure...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Onlining 0 additional cpu vps...succeeded
Onlining 2 IO vps...succeeded
Initialization of Encryption...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'ipcshm' listener threads...succeeded
Starting tracing...succeeded
Initializing 1 flushers...succeeded
Initializing log/checkpoint information...succeeded
Opening primary chunks...succeeded
Opening mirror chunks...succeeded
Initializing dbspaces...succeeded
Validating chunks...succeeded
Creating database partition...succeeded
Initialize Async Log Flusher...succeeded
Forking btree cleaner...succeeded
Initializing DBSPACETEMP list...succeeded
Checking database partition index...succeeded
Checking location of physical log...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop...succeeded
Forking onmode_mon thread...succeeded
Verbose output complete: mode = 5
说明执行成功,如果中间出现error或者warning,我们可以man一下日志文件(/opt/informix/online.log),来看看是什么问题。
接下来,到/opt/informix/data 查看一下datadbs.dat文件的大小,如果不为0,那么说明数据库创建成功。
$ onstat -i
IBM Informix Dynamic Server Version 10.00.UC4 -- On-Line -- Up 00:06:29 -- 28552 Kbytes
onstat>
说明数据库状态正常,退出 onstat 输入 q 就可以