How to create DB2 Instance on Linux

DB2 Instance:

DB2 Instance is a run time environment under which database runs. Instance is used to configure run time environment using Database Manager Configuration (DBM) parameters and registry variables. You can have multiple instance on same server depending upon your server resource configuration. Databases are unique within the instance. You cannot have 2 database with same name in one instance but you can have 2 database with same name in different instance on same server. E.g. You cannot have 2 database with same name i.e. TESTDB in one instance i.e. db2i1 but you can have 2 database with same name i.e. TESTDB in two instance on server i.e. db2i1 and db2i2. In this blog we will see step by step procedure to create DB2 Instance on Linux server. This same steps can be followed for not only Linux environment but it is applicable for any unix environment which is supported by DB2.

Prerequisite :

To create DB2 instance on linux server you would need 2 OS user (instance id and fenced id)  which is not mapped with any other DB2 instance.
DB2 instance username should not be more than 8 character long. If you want to use more than 8 character long username for DB2 instance then ensure your operating system supports long ids.
DB2 Instance username cannot be GUESTS, LOCAL, PUBLIC, USERS, ADMINS. It cannot begin with IBM, SQL, SYS

Creating OS Users:

useradd -d <user home directory> <username>
-d option is optional

Set password for both user (instance and fenced user) using passwd command

Instance Creation:

To create DB2 instance in non-root installation you would need root privilege.
Change working directory to <db2 installation folder>/instance
To get db2 installation path use db2ls command

Under instance directory list db2icrt file
ls -lrt db2icrt

Execute db2icrt to create instance

./db2icrt -u <fenced id> <db2instance id>

Connect to DB2 instance

su - <db2instance id>

After successful instance creation in your instance user home directory you would find sqllib directory.

Start DB2 Instance


As I have installed trail version of DB2 11.1 I got warning message.

If you liked this blog and interested in knowing more about DB2, please subscribe by clicking on Subscribe to by Email.


  1. This is very helpful for beginners as well as professionals.

  2. Superb!! Great initiative.It will really helpful...👍

  3. it was really helpful sumit, thank you for the blog and support which you provided me.

  4. Very helpful blog Sumit. Thanks

  5. Sumit,

    Great, thanks for the hardwork

    After installation of DB2 on linux, what will be the Endian format of the database.

    1. Linux x86-64 system it will be Little endian.