This paper describes what DB2 database installation process in the Linux environment. Linux release you are using Ubuntu 12.04. DB2 version of DB2 Express-C V10.1 Linux 32-bit version that DB2 V10 Community Edition (free version).
1. Go to IBM's official website: http: //www-01.ibm.com/software/data/db2/express/download.html download DB2 Express-C Linux version (you need to register a free account IBM).
2. Download Page for a total of five files:
The first file is the DB2 Express-C light, a lightweight version;
The second file is the full version of DB2 Express-C, it is recommended not the first one, the second one on the list;
The third file is the Data Studio Administation Client, this is a separate database management software, DB2 V10 due from the beginning, DB2 database is no longer integrated control center (Control Centre) a (means default only use the command line database management ), the GUI of DB2 management is done by way of a separate Data Studio tools. Therefore, in order to facilitate the management of DB2 database, it is recommended Data Studio also download and install. Here are just managing client version of Data Studio, you can also choose to download the full version of Data Studio. Data Studio is available for free.
The fourth document is Accessories Suit Text Search. This is a full-text search components of DB2, a very powerful search component. Can install time to install.
The fifth document is the National Language Pack for DB2, namely localized language pack. Which contains all the languages supported by DB2. To Note: Because DB2 automatically according to the language of the operating system to select the DB2 installation language when you install (of course, the English language is always installed), if you are using Linux environment is Chinese, then the installation process will ask for language packs address (do not know if you do not provide a language pack is not on the installation into English). Therefore, it is recommended to download the language pack.
In addition, IBM supports the use of HTTP download or use its own Download Director to download. The latter requires the Java Runtime Environment.
Install the necessary software
1. Since DB2 installation package is based on RPM, so you need to install a rpm compatible installer. IBM recommended alien. Install command is:
sudo apt-get install alien
2. As the DB2 installation process need to rely on gcc, so also need to install libstdc ++ 5 and libaio-dev. Install command is:
sudo apt-get install libstdc ++ 5
sudo apt-get install libaio-dev
1. Download is obtained db2_v101_linuxia32_expc.tar.gz DB2 installation package. You can unzip the graphical interface to give expc directory. It may be in a terminal, run the command $ tar xzvf db2exc_91_LNX_x86.tar.gz complete decompression. Here direct unzipped directory expc example.
2. Double-click the file db2setup expc directory operation. Jump to the next or the terminal expc directory, and then type sudo ./db2setup start the installation. Here we must note: if the current user is not root Ubuntu user, simply double-click the installer db2setupyunx word is a non-root install. And a terminal type sudo ./db2setup is performed root installation (of course, if you do not have sudo same non-root installation). Recommended root installation. So here the use of the latter.
3. Install page pops up later, started DB2 installation. Note that must not be above the terminal turned off!
4. click on "Install products", accept the license agreement, the default installation type (typical) installation, operation and the default (response file), the default installation directory (root installation installs to the root directory, a non-root installation installs to the current user home directory). Then DAS user settings. DAS is a database management server, where you can create new users by default, or you can use an existing user.
New user can specify your own user name, UID, group name, GID and the user's home directory. These can use the default value, only you need to set a password on it.
Users will need to use an existing note: The specified user must have a minimum set of privileges. Ie do not use the root account. Also, the same user DAS instance owner user can not be specified later.
Since the user does not need to go to special management, use the default mode, create a new user on the list.
5. Then enter the instance settings page, DB2 must have at least one instance of the job, create a DB2 instance is created or after the installation is completed when you can choose to install. After selecting the installation created behind it there is no instance of a user and set the content of the fenced user, but is created immediately after the completion of the terminal needs to be installed manually instances and examples of users, etc., will take some work. So when you choose to install to create here.
6. Then enter the instance settings page. This is the DB2 installation process is the most important part, and the same user settings and DAS, DB2 instance owner can create a new user, you can also use an existing user directly.
If you create a new user, you can specify their own user names, group names, and other user's home directory. DB2 default instance name and the instance owner user name is the same, such as the default to create a user named db2inst1 user, the instance name is db2inst1.
If you use an existing user directly, you can specify an existing user, such as direct as the current user. Using existing users are mainly based on the consideration of convenience. Of course, the instance name will be created and the specified user name as an existing user.
To note: the Linux environment, DB2 instances and is directly associated with a user, an instance of the instance owner must correspond to a user and a fenced user (of course instance owner user and fenced user can be the same user), a users can only have one DB2 instance. You want to create multiple instances on the need to create multiple users. For ease of use, where the direct use of the current user as the instance owner user, that is, before the user create a DB2 instance. (If another user creates an instance, the current user is logged but also for the user to switch to use the DB2 database)
7. Set user fenced. Introduced above, it corresponds to an instance of an owner user and a fenced user. Role fenced user is the user perform an unstable stored procedure or function, when the error does not affect the instance itself. (Similar Sandbox)
Set by the owner and user settings protect the user, as here, it is still set to the current user (there is a warning, ignore).
8. All configuration is ready to begin the installation. The installation process may require a language pack image. After the language pack before downloading codecs, specify the mirror directory for the unzipped directory on the line.
9. The installation is complete!
Start / switch Example:
If you are creating a new instance owner such as db2inst1, while the user is currently logged on maple, to start the db2inst1 instance, you need to enter the following command at the terminal to start (the following is an instance handover command, because at the same time allows only one instance is active ):
su db2inst1 (switch to the db2inst1 user)
. ~ / Sqllib / db2profile (transferred to the user configuration script, set db2inst1 instance is the current instance)
db2start (start of the current instance)
If the currently logged on user maple, maple and maple instance-owning user, will have to start maple instance, you need to enter a terminal command is:
db2start (direct start an instance of the current user)
If we want an instance to start automatically each time the system starts, you can use the following command:
Such as: instance db2inst1 want to start automatically, the command is: db2iauto -on db2inst1
If you want to turn off the automatic startup instance, you can use the following command:
Start the above example is based on the premise of an existing instance, if you choose to install DB2 instance is set after the DB2 installation is complete, you'll need to create an instance after the installation is complete. Of course, if you need to create multiple instances of the same is to perform the following operations. Note that the implementation of the following actions need root mode.
1. Create a user group (DAS group, examples of the group owner, fenced user group):
sudo groupadd -g 999 db2iadm1
sudo groupadd -g 998 db2fadm1
sudo groupadd -g 997 dasadm1
2. Create a user (DAS user, the instance owner, fenced 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 DAS Server:] (If you had to create a DAS server management, they do not re-create, a computer can have only one DAS server that can manage all DB2 instances)
sudo /opt/ibm/db2/V10.1/instance/dascrt -u dasusr1 (position where dascrt command for DB2 installation directory, dasusr1 for the DAS user you just created)
Also: closing and opening needs DAS server DAS user to switch to the next 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 (position db2icrt command for DB2 installation directory, db2fenc1 for the fenced user you just created, db2inst1 as the owner of the user just created)
5. Start to start an instance method according to the above examples.
Create a sample database
DB2 V10 after installation default is not created Sample database, create the Sample database command:
Make sure Sample is created before the current database instance name, to avoid creating a database on another instance, the command displays all database instances are db2ilist: attention. Command displays the current database instance is
db2 get instance
When you need to create a database to another instance, refer to the previous instance startup / content switching on the first instance of switching line.
Finally paste introduced in Linux DB2 user groups:
1, DB2 Administration Server (DAS) user account
2, DB2 UDB instance owner user account
3, DB2 UDB fenced user account
By default, DB2 Setup wizard creates the users and group accounts will automatically DB2 UDB server installation process. You can also specify an existing user account during the installation process.
[DB2 Universal Database: DB2 Universal Database refers to three systems running on LUW DB2 database, Acronym DB2 UDB. ]
Instance Owner (instance owner) user account:
DB2 UDB instance is created in the instance owner's home directory. The User Account Control all DB2 UDB process, with the instance contains all the files used by the database system and equipment. In DB2 UDB installation DB2 UDB instance owner to use the default user ID is db2inst1, the default group is db2iadm1. If the user name already exists, DB2 Setup wizard will increase the default name behind a number of 1-99, until it encounters a user ID does not exist.
A good approach is to limit the instance owner user account in the instance owner's group, not in any other group that contains it. This helps control the number of instances or instance can be modified in user accounts and groups of any object.
DB2 Administration Server (DAS) user account:
DB2 Administration Server (DAS) user account on the system running for the DAS process. The default installation process creates default user ID is dasusr1, the default group is dasadm1. DB2 UDBGUI tool also uses the DAS account to the local server database instances and perform administrative tasks. On each machine requires only a DAS. It can manage all instances defined on the server. DAS user account must be different from the instance owner user account.
Once the account is activated DAS process, you must also use that account to stop. Therefore, in Linux or UNIX, you must use the su - command to switch to the DAS user account in order to start and stop the DAS process.
Fenced (fenced) user account:
Fenced user account for DB2 UDB engine address space outside (memory) to run user-defined function (UDF) and stored procedures. Sometimes, if a procedure or function in unstable or testing, it should be defined as FENCED, so that you can run in its own process address space. Thus, if the function or process crash or abort, nor have any impact on other instances of processes. The default user account created by the user is fenced db2fenc1, the default group is db2fadm1. For security reasons, we recommend not to use the instance owner account for the fenced user account. If you do not need this level of security, for example, is run in a test environment, or not going to use fenced UDF or stored procedure, you can use the instance owner account directly without having to create another user account. When you create a new instance, you must specify the instance creation command fenced user account (db2icrt ... -u).
Install Data Studio
After the installation is complete DB2 V10, Data Studio now be installed in the Linux environment. Here is a selection of Data Studio V3.1.1 full version, download address:
Specific steps are as follows:
1. will be downloaded to the archive decompression. (For convenience, the unzipped folder rename studio)
2. Open a terminal, cd to jump to the next / disk1 / InstallerImage_linux directory. Then type the command: sudo ./install to start the installation (root still be installed):
To explain: the default mode Data Studio installation is to run the setup file studio directory directly in the terminal via the launchpad to start the installation, but may be due to browser support, and can not start the installation program normally, so we used directly Data Studio installation script to install.
(Installation of IBM software usually start their launchpad to install, but sometimes launchpad will fail to start, so skip the launchpad, run the installer directly within the software will be able to properly install)
In addition, install Data Studio will be forced to install an IBM Installer Manager tool, this is the IBM Installation Manager software to help users to install a variety of software for all of IBM.
After the installer starts, the remaining work is very simple, do not want to customize the installation, it has been "the next step" on the line. Not much explanation
Data Studio installation is complete!
Connecting to a DB2 database in Data Studio
After starting the Data Studio, right-click on the left side of the Explorer in "All Databases" and select "New Database Connection", as shown by Sample database connection configuration (note to fill the database user name and password to connect).