精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>电脑技术>>● FreeBSD>>有待整理的文章-新加的文章都在这里>>安装Interbase6.5到FreeBSD4.5下

主题:安装Interbase6.5到FreeBSD4.5下
发信人: chienyusin()
整理人: hackerbay(2002-09-06 16:48:51), 站内信件
    看到Borland中国网站上对Interbase6.5的介绍后,我觉得Interbase是一个很好的选择,特别是其执行文件很小,如果不包括帮助和其他文件,windows下的最小配置仅一张软盘就可放下,您可以到http://www.3asoft.com查找有关软件和介绍。我相信如果搭配FreeBSD将会由更好的效果,特别是Interbase2001年在德国举行的数据库比赛中获得第二名,属于企业级数据库,且免维护,软件费用相比其他数据库来说比较便宜,应该是一个很好的选择。记得去年曾看过一份介绍,说美国军方、摩托罗拉等一些大公司也使用Interbase数据库。
    于是,我决定在FreeBSD下试一试,我花了三个周的时间,经过反复的试验,我终于将Interbase在FreeBSD下运转起来,但我还没有搞懂如何将客户端连通并测试性能如何,看了很多资料都讲的不明白,所以请对Interbase感兴趣的朋友指点,这是我第一次在FreeBSD下安装Linux文件,不对之处请指正,本人将不胜感激。
    特别说明:在Windows下,该软件如果加载无限制用户和时间的证书ib_license.dat,就会变成无限制的正式版本,我相信FreeBSD下如果输入相同的Key和ID也会变成正式版,很遗憾,我折腾了两天也不行,只能是测试版,使用期为三个月,其生成的证书在/usr/local/interbase下,名字也叫ib_license.dat,如果试用期满后,您将该使用证书删除,重新生成一个证书,那么还可以继续使用三个月,不过从Windows下的证书项目来看,好像这个测试证书限制了许多功能,如果那位高手搞到无限制证书,别忘了给我一份。
    1.修改内核文件 /usr/src/sys/i386/conf/您的内核文件,加上options EXT2FS语句,然后重新编译内核。接着修改/etc/rc.conf文件,加上linux_enable="YES",重起。
    2.到FreeBSD的官方网站下载安装linux_base-7.1_2.tgz,建议去日本的镜像网站或是韩国的镜像网站,国内的镜像网站更新得不及时,且有些文件被精简。
    3.到http://www.interbase.com注册,下载Inerbase6.5 For Linux的测试版或者是到Http://www.3asoft.com下载。将下载下来的文件解压,一直到最后一层压缩文件,找到InterBaseSS_LI-V6.5.0.tar,这是Super Server版本,如果您要安装客户端版本或是Class版本,请参照我给出的脚本修改。
    4.请使用我改写的安装脚本,原脚本在FreeBSD下执行不正常,且安装位置不合适,我改写脚本的默认安装位置是/usr/local。将我改写的install脚本和InterBaseSS_LI-V6.5.0.tar放到同一个目录下,然后执行命令:sh ./install (当前目录的绝对路径)/InterBaseSS_LI-V6.5.0.tar。
    5.在根目录下建一个目录:mkdir opt,然后做一个软连接:ln -s /usr/local/interbase /opt/ .
    6.进入/usr/local/interbase/bin,执行./iblicense,在IB_LICEN>下输入:add -key eval -id eval,获得The operation was completed successfully.  Please restart the server for the changes to take effect.的信息后,即可在/usr/local/interbase/bin下执行命令:ibmgr -start -forever,此时机器可能进入没有反应的情况,其实是刚才执行的命令在运行,您可以终止该程序的运行,运行ps -ax命令您就会看到已经有一个或者是两个interbase的服务进程在运行了。当然,您也可以编一个启动脚本让系统启动后自动运行和守护,不过我自己编的脚本经常会出现启动不了服务的情况,有时又可以启动。
    真希望在广州,可以经常向苯刚、真等请教。
    7.install脚本
#!/bin/sh
#
# InterBase install script for FreeBSD platform
#
#By:Chien Yusin Email:[email protected]
#
###########################################################################
#
PATH=$PATH:/usr/local:/usr/local/interbas:/bin:/usr/bin:/usr/sbin:/usr/local/sbin
export PATH

LogFile="ibinstall.log"
TmpLogFile="/tmp/$LogFile"

# NOTE: The install directory is /usr/local
IBINSTALL="/usr/local"
InetSrvInstDir="/usr/local/sbin"

# NOTE: TarFile must contain the absolute path name

ExitError()
{
echo -e "\n*** Install completed with errors ***" | tee -a $TmpLogFile
echo "Install log can be found at $TmpLogFile"
exit 1
}

ExitSuccess()
{
echo -e "\nInstall completed successfully" | tee -a $INTERBASE/$LogFile
echo "Install log can be found at $INTERBASE/$LogFile"
exit 0
}


#
# Main entry
#

if [ -f $TmpLogFile ]; then
    mv $TmpLogFile $TmpLogFile.old
    echo -e "Old $TmpLogFile moved to $TmpLogFile.old\n" >> $TmpLogFile
fi
echo "***********************************************" >> $TmpLogFile
echo "InterBase Install in progress" >> $TmpLogFile
echo "`date`" >> $TmpLogFile
echo "***********************************************" >> $TmpLogFile

if [ "`whoami`" != "root" ]; then
    echo "ERROR: No permissions to perform operation." | tee -a $TmpLogFile
    echo "       Log in as root and try again." | tee -a $TmpLogFile
    ExitError
fi

if ps -e | egrep -e '(gds_inet_server|gds_pipe)' | grep -v grep> /dev/null
then
   echo -e "\nAn instance of the InterBase Classic Server seems to be running." | tee -a $TmpLogFile
   echo "Please quit all interbase applications and then proceed." | tee -a $TmpLogFile
   ExitError
fi
if ps -e | egrep -e '(gds_lock_mgr)' | grep -v grep> /dev/null
then
   echo -e "\nAn instance of the InterBase lock manager seems to be running." | tee -a $TmpLogFile
   echo "Please shutdown the Interbase lock manager (gds_drop -s)" | tee -a $TmpLogFile
   echo "and then proceed." | tee -a $TmpLogFile
   ExitError
fi
if ps -e | egrep -e '(ibserver|ibguard)' | grep -v grep> /dev/null
then
   echo -e "\nAn instance of the InterBase Super Server seems to be running." | tee -a $TmpLogFile
   echo "Please quit all interbase applications, shutdown the Interbase" | tee -a $TmpLogFile
   echo "server and then proceed." | tee -a $TmpLogFile
   ExitError
fi

TarFile=$1
if [ ! -f $TarFile ]; then
    echo "ERROR: The software archive \"$TarFile\" not found." | tee -a $TmpLogFile
    ExitError
fi

cd $IBINSTALL

#
# Extract files from a tar archive
#
echo -e "----------------------------\n" >> $TmpLogFile
echo -e "\nExtracting files" >> $TmpLogFile
echo -e "\nExtracting files... \c"
tar vxf $TarFile >> $TmpLogFile 2>&1
if [ $? -ne 0 ]; then
    echo "ERROR: Can't extract the files from the archive." | tee -a $TmpLogFile
    ExitError
fi
echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile

INTERBASE="$IBINSTALL/interbase"

#
# Access permissions
#
    echo -e "Updating access permissions... \c"
    echo "Updating access permissions" >> $TmpLogFile
    chmod 666 $INTERBASE/isc4.gdb
    echo "chmod 666 $INTERBASE/isc4.gdb" >> $TmpLogFile
    chmod 666 $INTERBASE/examples/*.gdb
    echo "chmod 666 $INTERBASE/examples/*.gdb" >> $TmpLogFile
    chmod 666 $INTERBASE/help/help.gdb
    echo "chmod 666 $INTERBASE/help/help.gdb" >> $TmpLogFile
    echo "Done"
    echo -e "----------------------------\n" >> $TmpLogFile


#
# Header files
#
for file in /usr/include/gds.h /usr/include/ibase.h /usr/include/iberror.h /usr/include/ib_util.h
do
    if [ -L $file -o -f $file ]
    then
        echo "Found a previous version of $file" | tee -a $TmpLogFile
        echo "Renaming it to $file.$$, and moving it into /tmp" | tee -a $TmpLogFile
        mv $file $file.$$
mv $file.$$ /tmp
echo "mv $file $file.$$" >> $TmpLogFile
echo "mv $file.$$ /tmp" >> $TmpLogFile
    fi
done

echo -e "Installing the header files... \c"
echo "Installing the header files" >> $TmpLogFile
    
cp -f interbase/include/gds.h /usr/include/gds.h
cp -f interbase/include/iberror.h /usr/include/iberror.h
cp -f interbase/include/ibase.h /usr/include/ibase.h
cp -f interbase/include/ib_util.h /usr/include/ib_util.h
cp -f interbase/include/ibxml.h /usr/include/ibxml.h
cp -f interbase/include/ibxml_proto.h /usr/include/ibxml_proto.h
chmod 744 /usr/include/ib_util.h /usr/include/ibase.h /usr/include/iberror.h /usr/include/gds.h /usr/include/ibxml.h /usr/include/ibxml_proto.h
echo "cp -f interbase/include/gds.h /usr/include/gds.h" >> $TmpLogFile
echo "cp -f interbase/include/iberror.h /usr/include/iberror.h" >> $TmpLogFile
echo "cp -f interbase/include/ibase.h /usr/include/ibase.h" >> $TmpLogFile
echo "cp -f interbase/include/ib_util.h /usr/include/ib_util.h" >> $TmpLogFile
echo "cp -f interbase/include/ibxml.h /usr/include/ibxml.h" >> $TmpLogFile
echo "cp -f interbase/include/ibxml_proto.h /usr/include/ibxml_proto.h" >> $TmpLogFile
echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile

#
# Libraries
#
for file in /usr/lib/libgds.so /usr/lib/libgds.so.0 /usr/lib/libgds.a /usr/lib/libib_util* /usr/lib/libgds_pyxis.a /usr/lib/libibxml.so
do
    if [ -L $file -o -f $file ]
    then
        echo "Found a previous version of $file" | tee -a $TmpLogFile
        echo "Renaming it to $file.$$, and moving it into /tmp" | tee -a $TmpLogFile
        mv $file $file.$$
        mv $file.$$ /tmp
echo "mv $file $file.$$" >> $TmpLogFile
echo "mv $file.$$ /tmp" >> $TmpLogFile
    fi
done

echo -e "Installing the libraries... \c"
echo "Installing the libraries" >> $TmpLogFile

    mv -f interbase/lib/gds_pyxis.a /usr/lib/libgds_pyxis.a
    mv -f interbase/lib/ib_util.so /usr/lib/libib_util.so
    mv -f interbase/lib/ibxml.so /usr/lib/libibxml.so
    echo "mv -f interbase/gds_pyxis.a /usr/lib/libgds_pyxis.a" >> $TmpLogFile
    echo "mv -f interbase/ib_util.so /usr/lib/libib_util.so" >> $TmpLogFile
    echo "mv -f interbase/ibxml.so /usr/lib/libibxml.so" >> $TmpLogFile

mv -f interbase/lib/gds.so /usr/lib/libgds.so.0
ln -s libgds.so.0 /usr/lib/libgds.so
echo "mv -f interbase/gds.so /usr/lib/libgds.so.0" >> $TmpLogFile
echo "ln -s libgds.so.0 /usr/lib/libgds.so" >> $TmpLogFile

echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile

#
# Inet server
#
    echo -e "Installing inet server... \c"
    echo "Installing inet server" >> $TmpLogFile
        chmod 755 $InetSrvInstDir
        echo "chmod 755 $InetSrvInstDir" >> $TmpLogFile
    mv -f interbase/bin/ibserver $InetSrvInstDir
    echo "mv -f interbase/bin/ibserver $InetSrvInstDir" >> $TmpLogFile
    echo "Done"
    echo -e "----------------------------\n" >> $TmpLogFile
    
#
# Update both services and servers databases
#
echo -e "Updating service name database... \c"
echo "Updating service name database" >> $TmpLogFile
if grep "^gds_db" /etc/services > /dev/null
then
    grep -v "^gds_db" /etc/services > /etc/services.tmp
    mv /etc/services.tmp /etc/services
fi

echo "gds_db          3050/tcp  # InterBase Database Remote Protocol" >> /etc/services
echo "Entry in /etc/services: gds_db          3050/tcp  # InterBase Database Remote Protocol" >> $TmpLogFile

echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile

echo -e "Updating configuration file for inetd... \c"
echo "Updating configuration file for inetd" >> $TmpLogFile

if [ -f /etc/inetd.conf ]; then
    if grep "^gds_db" /etc/inetd.conf > /dev/null
    then
        grep -v "^gds_db"  /etc/inetd.conf > /etc/inetd.conf.tmp
        mv -f /etc/inetd.conf.tmp /etc/inetd.conf
    fi
        echo "gds_db  stream  tcp     nowait.30000      root $InetSrvInstDir/ibserver ibserver # InterBase Database Remote Server" >> /etc/inetd.conf
        echo "Entry in /etc/inetd.conf: gds_db  stream  tcp     nowait.30000      root $InetSrvInstDir/ibserver ibserver # InterBase Database Remote Server" >> $TmpLogFile
fi

echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile

# Create /etc/hosts.equiv
    if [ ! -f /etc/hosts.equiv ]; then
        echo -e "Creating /etc/hosts.equiv ... \c"
        echo "Creating /etc/hosts.equiv" >> $TmpLogFile
        echo "localhost" >> /etc/hosts.equiv
echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile
    fi

# Poke inetd
if [ -f /var/run/inetd.pid ]
then
    kill -HUP `cat /var/run/inetd.pid`
fi

#
# create the ibmgr shell script
#
    echo -e "Creating the ibmgr shell script... \c"
    echo "Creating the ibmgr shell script" >> $TmpLogFile
    cat > $INTERBASE/bin/ibmgr << EOF
#!/bin/sh
INTERBASE=/usr/local/interbase
export INTERBASE
exec /usr/local/interbase/bin/ibmgr.bin \$@
EOF

chmod +x $INTERBASE/bin/ibmgr
echo "Done"
echo -e "----------------------------\n" >> $TmpLogFile

#
# Lock files
#
    touch $INTERBASE/isc_init1.`hostname`
    chmod 666 $INTERBASE/isc_init1.`hostname`
    touch $INTERBASE/isc_lock1.`hostname`
    chmod 666 $INTERBASE/isc_lock1.`hostname`
    touch $INTERBASE/isc_event1.`hostname`
    chmod 666 $INTERBASE/isc_event1.`hostname`
    touch $INTERBASE/isc_guard1.`hostname`
    chmod 666 $INTERBASE/isc_guard1.`hostname`
    
    touch $INTERBASE/interbase.log
    chmod 666 $INTERBASE/interbase.log

#
# Move the log file to the $INTERBASE
#
if [ -f $INTERBASE/$LogFile ]; then
    cp $INTERBASE/$LogFile $INTERBASE/$LogFile.old
    echo "Old $INTERBASE/$LogFile moved to $INTERBASE/$LogFile.old" >> $TmpLogFile
fi
mv $TmpLogFile $INTERBASE/$LogFile
cd $INTERBASE/bin
chmod 755 *
chmod 755 *.*

ExitSuccess




[关闭][返回]