|
Installing Sybase on Your Linux Server
Why Look at Sybase?As licensing concerns become an increasingly prevalent factor in IT, it's nice to know that there are alternatives out there. One of the alternatives is, of course, migration to Linux and freeware software for Linux. The power and flexibility of Linux and its current software options allows you to accomplish many things, including the creation of an internal database server. There are a lot of open-source and freeware software of different SQL packages, each of them with its own minuses and pluses. Before you will choose any of them, you need to analyze in detail these pros and cons, and decide which option meets your goals. For many business database goals, Sybase may hold many of the answers. Sybase is a commercial (but free for Linux) SQL server that is highly reliable, very fast, compatible with MS SQL, and supports different international codepages. The commerical aspects of Sybase may be more attractive to project managers and supervisors who think poorly of open source as a concept, even if open source purists will not be too excited about this aspect. There are some quirks to the product. If you are running a shop with Windows clients, there really isn't any free client software for Windows (except OpenClient from Sybase, but it doesn't work with ODBC). For Delphi and C++ Builder there are a lot of free components working through OpenClient. On the Linux side of the realm, however, we can easily find a lot of free software. If you decide to give Sybase a try for your SQL server needs, let's walk though the installation.
Installing Sybase: A PrimerThe first thing to do is visit http://www.sybase.com, register there, and download neccessary installation software packages for Linux:
It is here that you may get a slightly unpleasant surprise, because Sybase for Linux comes only in RPM files. It's a big minus for Debian and Slackware users. Now comes package installation. Here we need to have superuser rights, from xterm or some other X Window program--not the console (why this is so is something I will describe you a bit later). Sybase is rather "heavy" software and it needs at least 260MB of free space on your hard disk to be installed properly. So, you should make sure, that you have the space: df -k /opt Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda1 7234264 6086180 780600 89% /opt Also, make sure you add the directory /sbin to the PATH variable if it's not there already: export PATH=$PATH:/sbinNow we can install packages: rpm -hiv sybase-common-11.9.2-3.i386.rpm rpm -hiv sybase-ase-11.9.2-.i386.rpm rpm -hiv sybase-doc-11.9.2-1.i386.rpm rpm -hiv sybase-openclient-11.1.1-3.i386.rpm After complete package installation we need to edit /etc/profile next and add these two strings: SYBASE=/opt/sybase-11.9.2 export SYBASE These will define the system variable SYBASE, which will point to whichever directory Sybase is installed. If you skip this step, the server will not work. We also need to execute these commands from the terminal: SYBASE=/opt/sybase-11.9.2 export SYBASE Last, but not least, we will execute a shell script that will allow us to setup system configuration for server startup: cd $SYBASE $SYBASE/install/sybinstall.sh This script will create the user and group called sybase. Now we will configure the server. su sybase $ id uid=507(sybase) gid=510(sybase) group=510(sybase) $ . .profile ....... Do you want to start 'srvbuild' now? [y/n]: y Now we come to the surprise I mentioned a few paragraphs ago. srvbuild is an auto-executed graphic installation program. This is why you needed to start this process in X Window. (Strictly speaking, we don't need X Window server exactly on database server, we can just correctly set the system variable DISPLAY and work remotely.) We'll detail how this works in the next section.
Building with srvbuildIn the srvbuild program (shown in Figure 1), we can choose what to install: Adaptive server or Backup server. The Backup server (necessary for creationg of backup/reserve copy) can be installed to a completely different computer. In this example, we can skip this option and not install it. Fill all the other fields with server names (based on your own taste) and click OK. The next window displays Server Attribute Editor (see Figure 2). We need to pay attention here so that this server will work.
Please make sure you configure the user sybase to have write rights to the directory or device where will the database will be kept. (Also, remember the TCP port number where the server will be working. We may need this in future.) After all fields are appropriately filled, click on OK. The Server Attribute Editor will display the Backup server attributes (see Figure 3). Here, we need to configure Backup server. We have two fields here that are important to note:
Click the Build Servers button and a special script will be executed that will start the servers and create the necessary service databases. This can take some time, just be patient. Once everything is finished, a dialog box will appear asking to localize your server. I recommend skipping this step. If you need to do this later, it can be easily done manually--a process we will describe in the next section. To proceed, click on No to close this dialog, then on OK in the next window. This brings us back to the original srvbuild dialog box. To close it, click on the Exit button. To configure Sybase to be auto-started after each computer reboot we need to configure the system a bit more: chkconfig -add sybase chkconfig sybase on chkconfig --list sybase sybase 0:off 1:off 2:off 3:on 4:on 5:on 6:off Sybase is now installed. The only thing we have ahead is to localize it. In this case we will make Sybase able to work with the Russian language.
Localizing SybaseAll of the necessary files and advice about Russian language localization can be found at http://www.sybase.newmail.ru/ase/119rus.html. To find your own language localization guides, use any search engine you like and you should be able to find your language packs without much difficulty. Before we begin this process, make sure you pay attention to upper/lower case in file names. Linux, as with all Unix systems, understands upper and lowers case as different characters, and this can create some problems if you're not careful. I was also able to find an absolutely prepared Russian localization package for Linux following this link: ftp://ftp.svzserv.kemerovo.su/pub/databases/sybase-ase/Synchsets.tgz. I recommend everybody who needs Russian localization. If you also download http://www.sybase.newmail.ru/files/convtbls.zip you can find a good description of installation inside that package., In the meantime, to illustrate how localization works in whatever language you use, I will describe whole process step by step. First, unpack and copy the appropriate files. tar -xzf Synchsets.tgz cp -r charsets/group5/* $SYBASE/charsets cp -r convtbls/group5/* $SYBASE/charsets cp -r locales/group5/* $SYBASE/locales Remember, don't copy the locales.dat file from the archive! It's very old. Fix files common.loc and server.loc in all subdirectories $SYBASE/locales/russian/--if you have an earlier version, you will need to change the version of these files to that of your server. Unpack the convtbls.zip archive and copy all tables of conversions utf8->russian: unzip convtbl.zip cp CONVTBLS/UNICODE/UTF8/CP866.CTB $SYBASE/charsets/utf8/cp866.ctb cp CONVTBLS/UNICODE/UTF8/KOI8.CTB $SYBASE/charsets/utf8/koi8.ctb cp CONVTBLS/UNICODE/UTF8/CP1251.CTB $SYBASE/charsets/utf8/cp1251.ctb Update the configuration file $SYBASE/charsets/utf8/utf8.cfg by adding these lines: convertto = koi8, table, MATCH, 3F convertto = cp1251, table, MATCH, 3F convertto = cp866, table, MATCH, 3F And update the file with locales descriptions $SYBASE/locales/locales.dat by adding into the [linux] section these lines: locale = ru_RU, russian, koi8 locale = ru_UA, russian, koi8 This will allow out Linux clients to operate more smoothly with the new language. Now, into the [natlang] section in the file $SYBASE/config/objectid.dat add: ; russian 1.3.6.1.4.1.897.4.9.2.182119 = russian Now, don't forget to do little cleanup: ln -s $SYBASE/locales/message/us_english $SYBASE/locales/messages/russian ln -s $SYBASE/locales/us_english/cp850 $SYBASE/locales/us_english/cp866 ln -s $SYBASE/locales/us_english/cp850 $SYBASE/locales/us_english/cp1251 ln -s $SYBASE/locales/us_english/cp850 $SYBASE/locales/us_english/koi8 The next major step to to load a new list of chars and their sort order. The easiest way is to use graphic utility that came with Sybase: su sybase $ cd ~ $ bin/sqlloc In the first window (shown in Figure 4), you have to choose your server. We do not have password for sa by default. So, just click on OK to open the Default Language dialog box (see Figure 5). And now let's configure the necessary localization. For example, to support the Windows codepage, with sorting, without dependence of lower/upper case we will choose these options in each respecitive field in the dialog: Russian, cp1251, Russian case-insensitive dictionary ordering. After clicking on OK, the Add and Remove Languages dialog will appear to will warn us that the codepage will be changed and it will suggest installing a new language (Russian). Again, click on OK. The Localization Summary dialog will appear (see Figure 6). The utility will start installing support for the Russian language, shown in the Status Output window. Eventually the Status Report window will close and you will be returned to the User Name and Password dialog. Choose Exit. When configuring the client (OpenClient) for Windows we need to remember to update $SYBASE/ini/objectid.dat. In the section [natlang] add: ; russian 1.3.6.1.4.1.897.4.9.2.182119 = russian Also, add identifers of Russian codepages (if you don't have such) in section [charset]: 1.3.6.1.4.1.897.4.9.1.50 = iso88595 1.3.6.1.4.1.897.4.9.1.51 = cp855 1.3.6.1.4.1.897.4.9.1.52 = cp866 1.3.6.1.4.1.897.4.9.1.53 = cp1251 1.3.6.1.4.1.897.4.9.1.55 = koi8 1.3.6.1.4.1.897.4.9.1.56 = mac_cyr
|