Install DB2V10 and DataStudioV3 in Linux (Ubuntu)

Source: Internet
Author: User
Tags db2 express db2 installation
This document describes how to install a DB2 database in Linux. The Linux release is Ubuntu12.04. The DB2 version is the DB2Express-CV10.1Linux32 bit edition, that is, the Community edition of DB2V10 (free version ). Get db21before installation. to IBM Official Website:

This document describes how to install a DB2 database in Linux. The Linux version used is Ubuntu 12.04. The DB2 version is DB2 Express-C V10.1 Linux 32-bit, that is, the Community version of DB2 V10 (free version ).

Preparations before installation

Obtain DB2

1. Go to the official IBM Website: download DB2 Express-C Linux (you need to register an IBM free account ).

2. the download page contains five files:

The first file is DB2 Express-C light, a lightweight version;

The second file is the full version of DB2 Express-C. Therefore, we recommend that you do not use the first file;

The third file is the Data Studio Administation Client, which is a separate database management software. Since DB2 V10 has started, the DB2 database has no longer integrated Control center (Control Centre) (this means that you can only use the command line method to manage the database by default). The GUI Management of DB2 is completed by a separate Data Studio tool. To facilitate the management of DB2 databases, we recommend that you download and install Data Studio. Only the management client version of Data Studio is provided here. You can also download the full version of Data Studio. Data Studio is provided for free.

The fourth file is Accessories Suit Text Search. This is a full text search component of DB2 and a powerful search component. Optional.

The fifth file is the National Language Pack for DB2, the localized Language Pack. It contains all the languages supported by DB2. Note: During the installation of DB2, the DB2 installation language is automatically selected based on the Operating System Language (of course, the English language is always installed). If your Linux environment is Chinese, the address of the Language Pack is required during the installation process (I do not know if the Language Pack is installed in English if it is not provided ). Therefore, we recommend that you download this Language Pack.

In addition, IBM supports downloading through HTTP or its own Download ctor. The latter requires the Java Runtime Environment.

Install necessary software

1. Since the DB2 installation package is RPM-based, you need to install an rpm-compatible installer. Alien is recommended for IBM. The installation command is:

Sudo apt-get install alien

2. Because the installation process of DB2 depends on gcc, libstdc ++ 5 and libaio-dev must be installed. The installation command is:

Sudo apt-get install libstdc ++ 5

Sudo apt-get install libaio-dev


Formal Installation

1.The downloaded db2_v101_linuxia32_expc.tar.gz is the DB2 installation package. You can decompress the file directly on the graphic interface to obtain the expc directory. You can also run the $ tar xzvf db2exc_91_LNX_x86.tar.gz command on the terminal to decompress the package. The following uses extracting the expc directory as an example.

2. Double-click the db2setup file in the expc directory to run it. Or jump to the expc directory under the terminal, and then type sudo./db2setup to start installation. Note: If the current Ubuntu user is not a root user, double-click the db2setupyunx installer to install it in a non-root mode. In the terminal, if you type sudo./db2setup, It is root installation (of course, if there is no sudo, it is also non-root installation ). Root installation is recommended. So the latter is used here.

3. The installation page will pop up later to officially start DB2 installation. Be sure not to close the above terminal!

4. click "Install product" and accept the license agreement. The default installation type is (typical). The default installation operation is (Response file). The default installation directory is (root installation will be installed under the root directory, non-root installation will be installed in the current user's home directory ). And then the DAS user settings. DAS is a database management server. By default, you can create new users or use existing users.

You can specify the username, UID, group name, GID, and user home directory by yourself. You can use the default values for all these settings. You only need to set a password.

When using existing users, note that the specified user must have the lowest privilege set. Do not use the root account. Also, the DAS user cannot be the same as the instance owner user specified later.

Because this user does not need to be specially managed, use the default method to create a new user.

5. Go to the instance settings page. DB2 must have at least one instance. You can choose to create a DB2 instance or create a DB2 instance after installation. If you select "create after installation", there will be no setup content for the instance user and the protected user. However, you need to manually create instances and instance users in the terminal immediately after the installation is complete, which requires some trouble. So select create at installation.

6. Go to the instance settings page. This is the most important part of the DB2 installation process. Like the DAS user settings, the DB2 instance owner can be a new user created or can directly use existing users.

If you create a new user, you can specify the user name, group name, user home directory, and so on. The default Instance name of DB2 is the same as the owner User Name of the instance. For example, if you create a user named db2inst1 by default, the Instance name is db2inst1.

If you use an existing user directly, you can specify an existing user. For example, you can specify it as the current user. The use of existing users is mainly based on convenience considerations. Of course, the created instance name will be the same as the user name of the specified existing user.

Note: in Linux, DB2 instances are directly associated with users, an instance must correspond to one instance owner user and one protected user (of course, the instance owner user and the protected user can be the same user). A user can have only one DB2 instance. To create multiple instances, you must first create multiple users. For ease of use, the current user is directly used as the instance owner user, that is, the former user creates a DB2 instance. (If you use another user to create an instance, you must perform a user switch after logging on to the current user to use the DB2 database)

7. Set protected users. As mentioned above, an instance corresponds to one owner user and one protected user. A protected user executes an unstable stored procedure or function. If an error occurs, the instance itself is not affected. (Similar to sandbox)

The settings of the protected user are the same as those of the owner user. Here, the user is still set as the current user (a warning will appear, ignoring it ).

8. Everything is ready for installation. A Language Pack image may be required during installation. After extracting the downloaded Language Pack, specify the image directory as the extracted directory.

9. The installation is complete!


Subsequent Configuration

Start/switch instance:

If a new instance owner is created, such as db2inst1, and the current logon user is maple, to start the db2inst1 instance, enter the following command to start the instance (instance switching is also the following command, because only one instance is allowed to be active at the same time ):

Su db2inst1 (switch to db2inst1 user)

.~ /Sqllib/db2profile (call this user configuration script and set db2inst1 as the current instance)

Db2start (start the current instance)

If the current logon user is maple and the maple User owns the maple instance, start the maple instance. The command to be entered on the terminal is:

Db2start (directly start the instance of the current user)

If you want an instance to automatically start after each system startup, run the following command:

Db2iauto-on <实例名>

For example, if you want the instance db2inst1 to be automatically started, run the command db2iauto-on db2inst1.

To disable automatic startup of an instance, run the following command:

Db2iauto-off <实例名>

######################################## ######################################## ##

The above instance is started on the premise that the instance already exists. If you choose to set the instance after the DB2 installation is complete, you need to create the instance after the installation is complete. Of course, to create multiple instances, perform the following operations. Note that the following operations must be performed as root.

1. Create a user group (DAS group, instance owner group, protected User Group ):

Sudo groupadd-g 999 db2iadm1

Sudo groupadd-g 998 db2fadm1

Sudo groupadd-g 997 dasadm1

2. Create a user (DAS user, instance owner, protected user ):

Sudo useradd-u 1002-g dasadm1-m-d/home/dasusr1 dasusr1-p password2

Sudo useradd-u 1003-g db2fadm1-m-d/home/db2fenc1 db2fenc1-ppassword3

Sudo useradd-u 1004-g db2iadm1-m-d/home/db2inst1db2inst1-p password4

[3. Create a DAS Management Server:] (if you have created a DAS management server, you do not need to create it again. A computer can only have one DAS server, which can manage all DB2 instances)

Sudo/opt/ibm/db2/V10.1/instance/dascrt-u dasusr1 (here the dascrt command is located in the DB2 installation directory, and dasusr1 is the created DAS user)

In addition, to disable and enable the DAS server, you need to switch to the DAS user for execution.

/Opt/ibm/db2/V10.1/das/bin/db2admin stop or/opt/ibm/db2/V10.1/das/bin/db2admin start

4. Create an instance:

Sudo/opt/ibm/db2/V10.1/instance/db2icrt-u db2fenc1 db2inst1 (the location of the db2icrt command is the DB2 installation directory, and db2fenc1 is the protected user just created, db2inst1 is the created owner user)

5. Start the instance according to the above method.

######################################## ######################################## ##


Create a sample database

After DB2 V10 is installed, no Sample database is created by default. The command for creating a Sample database is:


Note: before creating the Sample database, confirm the name of the current instance to avoid creating the database on another instance. The command for displaying all database instances is db2ilist. The command for displaying the current database instance is

Db2 get instance

If you want to create a database for another instance, refer to the previous instance start/switch content for instance switching.

For more details, refer to the highlights on the next page.: Http://

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.