How to install and configure DB2 Personal Edition Version 8.1.6 for Linux, and Java runtime environment
Level: primary
Ian shields
(IShields@us.ibm.com) Advanced programmer, IBM 2004 September
This article will guide you to easily complete the steps of installing the IBM DB2® Universal Database Personal Edition V8.1.6 and the IBM JavaTM Runtime Environment (JRE), java runtime environments The objects applicable herein are those developers who have just contacted Linux or UNIX operating systems. in
In the discussion Forum, you can share your questions and insights about this article with the author and other readers.
This article will show you how to complete the following tasks:
Check the space necessary in Linux and the package that must have, such as PDKSH. Install the IBM JDK with the RPM command. Install DB2 using the db2setup command. Add a tool directory to the existing DB2 installation. Install the DB2 Developer (Developer) tool. Start using DB2.
before the start
This article is a supplement to the Software Evaluation Kit (SEK) Linux Platform - 2H 2004 DVD (order free SEK) basic installation instructions. This article introduces you to the entire process of installing DB2 Personal Edition Version 8.1.6 for Linux on Red Hat Enterprise Linux V.3 (Rhel3) or SUSE Linux Enterprise Server 8 (SLES8).
note:
If your release version is use 2.4 kernel, this version is not listed in the support list of DB2 for Linux, so you don't necessarily use this version of DB2. Red Hat 9 is the release version that DB2 does not support. This version is not designed for 2.6 kernel. If you are using a 2.6 kernel system, then try DB2 UDB "Stinger" Open Beta.
Rhel3. If you install on Red Hat Enterprise Linux V3 (Rhel3), or use a 2.4 core with New Posix Thread Library (NPTL), then pay special attention to the part of the RHEL3 marked in this article.
SLES8. If you are installed on SUSE Linux Enterprise Server 8 (SLES8), or use a 2.4 core without NPTL, then pay special attention to the part of the SLES8 marked in this article.
To get information about other supported Linux release, see DB2 for Linux. If you are installed on another release, check the online document of this release.
If you just get in contact with Linux, you need to get help in root, mount CD, open the terminal window, etc., see the basic tasks for Linux development newbies, including these tasks and more.
Prerequisites In this article, we assume that you use RHEL3 installed with Update 1, or SLES8 for SP2A is installed. (If there is no additional annotation, the example in this article applies to the RHEL3 system installed with Update 1.) Log in as root and opens a terminal window. Then use the uname command that adds the -RV option to check if you have an appropriate 2.4 kernel level, use the getconf command or the rpm command to check if you have NPTL. Listing 1. Check the kernel and GLIBC version
Rhel3
[root @ irebird root] # uname -rv
2.4.21-15.0.3.el # 1 tue jun 29 18:17:52 Edt 2004
[root @ lyrebird root] # getconf gnu_libpthread_version
NPTL 0.60
[root @ irebird root] # rpm -q glibc
GLIBC-2.3.2-95.20
SLES8.
Lyrebird: ~ # uname -rv
2.4.21-231-Default # 1 MON Jun 28 15:39:14 UTC 2004
Lyrebird: ~ # getconf gnu_libpthread_version
GetConf: Unrecognized Variable `GNU_LIBPTHREAD_VERSION '
Lyrebird: ~ # rpm -q glibc
GLIBC-2.2.5-213
Note that NPTL is part of the GLIBC 2.3.2 package. When using getConf query libpthread_version, there is no NPTL system responding to an error. Have NPTL system or respond to NPTL versions, or respond to a tag to indicate that LinuxThreads compatible mode has been enabled for the terminal session.
Then, use the which command to check if the KSH (Korn shell) is installed. If you know the package name, you can use the RPM command.
Listing 2. Check the Korn Shell
[root @ lyrebird root] # Which ksh
/ bin / ksh
[root @ irebird root] # rpm -q pdksh
PDKSH-5.2.14-21
If you do not have a PDKSH package, please refer to "Install the necessary Linux package" before installing the IBM DB2 software.
To perform a typical installation, then at least 500MB free space is required in the / OPT file system, at least 50 MB of space should be used in the / home file system. In addition, you also need to prepare space for your database. The disk size is typically measured in a megabyte (multiplier using 1000, instead of many other computer metrics). All the size here refers to the passengers of 1000, so the megabytes are 1000000 bytes instead of 1048576 bytes.
Use the DF command to check your disk space. If downloaded to the same location, then make sure there is at least 1030MB free space. To obtain a multiplication using a multiple of 1000 rather than using a number of disk blocks using 1024, you need to add a -h option.
Listing 3. Check if there is enough free space
[root @ lyrebird root] # DF -H / OPT
FileSystem size used avail use% mounted ON
/ DEV / HDA10 17GB 5.1GB 11GB 32% /
[root @ lyrebird root] # DF -H / homefilesystem size used avail us% mounted on
/ DEV / HDA10 17GB 5.1GB 11GB 32% /
In this example, the / opt and / home file system is on the same partition with my root file system, ie / dev / hda10, which is my first IDE hard drive. A logical partition.
Installing JREDB2 V8.1.6 requires an IBM Java runtime environment. If the installation wizard can't find such an environment, it will install a version 1.3.1 in the / OPT / IBMJAVA2-131 directory.
SLES8 If your system does not use NPTL, you do not need to install Java separately.
RHEL3 RHEL3, including NPTL, does not support the IBM JRE version included with DB2. You can install silence (non-enter), then use only the command line tool, or you can install another IBM Development Toolkin as a working environment. The working environment is not supported, but it usually allows you to use the GUI installer and the GUI DB2 tool.
To install IBMJAVA2-SDK-1.4.1-2.0.i386.rpm, first open a terminal window, mount 2H 2004 SEK DVD, then switch the current directory to the root of the DVD (such as / mnt / cdrom). Then switch to the JDK141 directory on the DVD and run the rpm command.
Listing 4. Install IBM 1.4.1 JDK
.
[root @ lyrebird root] # CD / mnt / cdrom
[root @ lyrebird cdrom] # CD JDK141
[root @ lyrebird jdk141] # rpm -uvh * .rpm
Preparing ... #################################################### ]
1: IBMJAVA2-SDK ############################################### %]
Install DB2 for Linux Log in as root and opens a terminal window, or switch to root using the SU. You will use a graphical environment, so if you switch to the root user using the su command, make sure your display settings are correct. If you just start contacting Linux, refer to the basic task for Linux development newbie to obtain information about switching to another user ID and setting display, mounting CD-ROM, opening the terminal window, etc.
RHEL3 uses DB2 GUI to use DB2 GUI through the IBM JDK 1.4.1 installed above, you must set some environment variables before proceeding back. Listing 5. Export environment variables
EXPORT DB2USELOCALJRE = TRUE
Export Java_Home = / OPT / IBMJAVA2-141
Export ld_assume_kernel = 2.4.19
EXPORT RPM_FORCE_NPTL = 1 If these environment variables are not set, the installer may be extremely terminated or suspended, and the use of the RPM command may undermine your RPM database. Tip: If you have a three-way mouse (or you have already set up your mouse, use two keys to simulate the three-button - that is, press two keys at the same time), then you can press and hold the left button And drag on the text in the window, then use the midkey (or press two keys simultaneously on the two-key) to paste the text to the other part of the command. You can use this simple and convenient skill between the same window or different windows. Mount 2H 2004 SEK DVD and switch the current directory to the root of the DVD. Then switch to the DB2PE816 / PE directory on the DVD. Note that the root of your DVD driver may vary from the examples in Listing 6. Listing 6. Access DB2 installation files SLES8
Lyrebird: ~ # cd / media / cdrom1
Lyrebird: / Media / CDROM1 # CD DB2PE816 / PE
Lyrebird: / Media / CDROM1 / DB2PE816 / PE #
Rhel3
[root @ lyrebird root] # CD / mnt / cdrom
[root @ lyrebird cdrom] # CD DB2PE816 / PE
[root @ lyrebird pe] #
Enter the ./db2setup Start DB2 installation. For security considerations, you can't let root automatically run the program in the current directory, so you need the most in front. /. You should see a screen as follows: Figure 1. Start DB2Setup You can browse the installation instructions, if you want, you can quickly browse (Quick Tour). When you are ready, you can click Install Products to start installing. First choose DB2 Personal Edition. Then click Next. Figure 2. Select DB2 Personal Edition Installation When the installation wizard describes the screen load, you will see a splash screen and it will notice that there is a delay. Click Next. View and accept the license. Click Next again. Select the installation type; then select Typical. If you prefer, you can add "Data WareHousing". You can view the features that will be installed by clicking the View Features button, but if you need to change them, you should perform a Custom installation instead of a typical installation. When you are ready, click Next. Figure 3. Select the installation type Click Next to install the next NEXT, continue to the DAS user screen. (This may seem to be different from the previous DB2 installation.) Ensure a secure password. After successfully entered the password, click Next. Figure 4. Creating a DB2 Management Server User ID Receive (or select, if needed) Create an option to create a DB2 instance, and then click Next. Figure 5. Creating a DB2 instance This will take you to the first custom screen of the instance. The default instance name is DB2Inst1 and will create the same name system user. The instance's database will create in the user's home directory unless you specify another location when you create a database. Again, make sure to use a secure password and enter the password twice. Once you have successfully entered the password, click Next. Figure 6. Creating a DB2 Instance Owner User ID Specify a password in the same way for the protected user ID of DB2. User-defined functions will run under the ID of the protected user. For security, this ID should not be the same as the ID of the instance owner. Similarly, after successful input password, click Next. If this is your first DB2 database, it is recommended that you must create a tool directory (Tool Catalog). SLES8 If you want to create a tool directory now, select the Use A local Database option. RHEL3 If you try to create a tool directory as part of the initial DB2 system installation, the installation process will be hang. These steps show you how to create a tool directory later. If you are using an NPTL system, don't perform this step. Click Next. Figure 7. Create a DB2 tool directory If you want to create a tool directory now, you can accept the default values on the next screen, create the directory in your new instance, and click Next again. Next, you can specify the user ID to be notified. If the SMTP server is currently not run, you can still set a list of contacts, but to disable the Enable Notification check box. Figure 8. Specify the contact list Next, you can accept or change the default value of a certain identifier so that the identifier receives the health notification when it exceeds the database health threshold. After completing the health monitor selection, click Next. Figure 9. Start replication files You should see the summary of the options.
Review these options, then click Finish to start copying the file and set the system. Figure 10. Start replication files When you complete the installation, you should see a post-installed summary showing the steps that still need to be completed and installed. Figure 11. Summary of the installation Note: The document CD mentioned in the provision is not part of the 2H 2004 SEK issued. See Resources to get online DB2 documentation. RHEL3 If the Java version you are not using is not DB2 itself, then you should reconfigure DB2. Use the su command to switch to the user DB2Inst1, then use the command to stop the DB2 management server and DB2 instance. Finally, update the location of Java in DBM configuration and management management. Listing 7 shows the update command divided into two lines, which is just to adapt to the screen, you can enter them in the same row: DB2 Update DBM CFG Using JDK_PATH / OPT / IBMJAVA2-141DB2 UPDATE ADMJAVA2-141DB2 Update Admin CFG Using JDK_Path / OPT / IBMJAVA2-141 Listing 7. Update DB2 Java configuration [root @ lyrebird root] # su - db2inst1
[DB2Inst1 @ lyrebird db2inst1] $ ~ DASUSR1 / DAS / BIN / DB2ADMIN STOP
SQL4407W The DB2 Administration Server Was Stopped SuccessFully.
[DB2Inst1 @ lyrebird db2inst1] $ db2stop
SQL1064N DB2STOP Processing Was Successful.
[DB2Inst1 @ lyrebird db2inst1] $ db2 Update DBM CFG Using /
> JDK_PATH / OPT / IBMJAVA2-141
DB20000I THE Update Database Manager Configuration Command Complata
SuccessFully.
[DB2Inst1 @ lyrebird db2inst1] $ db2 Update Admin CFG Using /
> JDK_PATH / OPT / IBMJAVA2-141
DB20000i The Update Admin Configuration Command Complated SuccessFully.
Now, you have installed DB2 and its management servers and create an instance of DB2. If you need to add a part later, you can re-run db2setup at any time. The next section will show how to add a management tool directory.
Add a tool directory To add a tool directory to your new DB2 installation:
Use the command in Listing 8 to stop the DB2 management server and DB2 instance. A typical output is given in the last step of the previous section. Listing 8. Stop DB2 management server and instance
Su - db2inst1
~ Dasusr1 / Das / Bin / DB2Admin Stop
DB2STOP
Press CTRL-D to return to the terminal window to restore the root identity. If you are running the ./db2setup window, then you can now run it again. Otherwise, repeat the first few steps in the previous section to restart the DB2 installation. RHEL3 If the window you are using is different from the window to install, then you should remember to export the environment variables shown in the previous section. In the DB2 installation menu, select "Install Products" again, then move forward to the welcome screen. You can now choose to install other parts or operate DB2 instances. Click the "Create A New DB2 Instance" option to cancel the selection of this option, then click Next. Figure 12. Installing other DB2 components This time, click Select the "Use A local Database" option on the DB2 tool directory Prepare screen. Then click Next. Figure 13. Preparing the DB2 Tool Directory On the next screen, select the instance (DB2Inst1) created when the initial installation is selected in the drop-down list. Click Next to review the selected summary, then click Finish to install the tool directory. You will see a progress dialog, then a summary after installation, which is similar to the previous installation. Figure 14. Select DB2 instances for the Tool Directory If you wish to add a developer tool to your DB2, please continue the next section, if not, you can restart the management server before proceeding to DB2 First Steps And instances. Use the following command to restart the management server and DB2 instance. Listing 8. Restart management server and instance Su - DB2Inst1
~ Dasusr1 / Das / Bin / DB2Admin Start
DB2Start
Congratulations! Now you have installed the tool directory.
Add Developer Tool DB2 Application Program Development Client (DB2 Application Development Client) is a set of tools for developing DB2 applications. To add these developer tools to your new DB2 installation:
Stop the management server and DB2 instances like the first step in the previous section. Like the second step in the previous section, restart DB2Setup and proceed to the SETUP screen. On the SETUP screen, click to select the "DB2 Application Development Client" radial button. Figure 15. Selecting the DB2 instance for the Tool Directory Continue to pass the screen and accept the license screen. On the screen of the installation type, accept the default "type", then click Next. In the next screen, click Select "Configure New Function for An EXISTING DB2 Instance" and select "DB2Inst1" from the following list. Figure 16. Select DB2 instance for Tools Directory Click Next to review the selected summary, then click Finish to install the development client. You will see a dialog box, then a subsequent summary, which is similar to those seen in the previous step. Restart the management server and instance before proceeding to the DB2 First Steps section. You can use the following command to restart the management server and DB2 instance. Listing 9. Restart DB2 management server and instance
Su - db2inst1
~ Dasusr1 / Das / Bin / DB2Admin Start
DB2Start
Congratulations! Now you have installed the development client.
DB2 First Steps To start studying DB2, you should log out of the root identity and then log in with user DB2Inst1.
You will notice that there is a DB2 folder on your graphical desktop. Open this folder, you will see a lot of icons, as shown in Figure 15 (there is a part of the RHEL3 system GNOME desktop). Figure 17. DB2Inst1 Desktop and DB2 folder Double-click the "First Steps" icon, start the DB2 First Steps program, which will help you start using DB2. Figure 18. DB2 First Steps Congratulations! Now you have installed and configured DB2. You can study DB2 in depth by the following reference.
Reference
In a discussion for your Linux App Development, you can share your questions and opinions about this article with authors and other readers. DB2 documentation can be found at DB2 Information Center. From IBM Red Books Up and Running With DB2 for Linux, you can get more about your new DB2 installation. Red Hat Enterprise Linux 3 users should also view Frequently Asked Questions for IBM DB2 Universal Database Version 8.1on Red Hat Enterprise Linux 3 (RHEL 3). To get help with the installation of the PDKSH package, please refer to "Install the necessary Linux package". To get a help for installing SUSE SLES8, see Installing and Configuring SUSE Linux Enterprise Server (SLES) 8 (DeveloperWorks, 2003). To get help on performing tasks in Linux, review the basic tasks for developing novices to Linux (developerWorks, 2003). To learn how to use the VI editor on Linux, please refer to Tutorial VI Getting Started - Clearing Table Unilateral Law (DeveloperWorks, 2000). To be skilled using the Emacs editor to edit on Linux, see Life in Emacs (DeveloperWorks, 2002). Python is an excellent tool for use with DB2 Version 8. It can access DB2 databases easily and easily, or more complex tasks that require multi-purpose programming languages. You can learn the Python DB2 module through the Python and DB2 for Linux (DeveloperWorks) tutorial. You can get some help in preparing DB2 Version 8 Family Fundamentals (Exam 700) certification exam. Through the six series of tutorials (DeveloperWorks, 2003), you will make a solid foundation for every part of the exam. Also, see Certification Web Site for more information on exams. You can access the database in the JAVA program with JDBC and SQLJ. Tutorial Optimal DB2 Performance With SQLJ and JDBC (DeveloperWorks) describes some of the methods of obtaining optimal overall performance when accessing DB2 in a Java program. In the discussion forum, you can share your questions and insights on this article with the author and other readers. To learn from DB2 in depth, visit developerWorks DB2 Zone. You will find technical documentation, how-to articles, training, download, product information, and more. Please refer to your Linux application to get a refueling speed site to obtain other training and technical support reference materials. In the developerWorks Linux zone, you can find more reference materials for Linux developers. You can order the release of Linux books in the developer Bookstore Linux area.