Installation
Pre-requisites
For installing DB2 we would need Virtual Machine with any one of Linux/Unix distro (Ubuntu, CentOS, Fedora) installed in it.
Next we require the DB2 installation binaries that can be downloaded from the following links. You have two options to install on your system, The DB2 Express-C(free) edition or the DB2 Sever(90 day trial edition). As of now you are recommended to install the Express-C edition as it's more than sufficient to learn DB2 although it does not contain all the advance features.
Installation Methods
There are three methods that can be used to install DB2
- Data Setup Wizard
- This is a GUI based installation.
- This technique can also be used to generate a response file what can be used for silent installation.
- This method would hardly be used in work environments.
- The DB2 Install wizard
- This installation method is run on the terminal.
- It's an interactive utility where you need to enter various responses to the options put forth by this utility.
- It does not perform user and group creation, instance creation, or configuration.
- Response File
- A response file is a text file that contains setup and configuration values.
- This is the most preferred method of installation in work environments.
- A response file is a script that is passed to the db2setup wizard for installing DB2 product.
- This method is most useful when you want to install DB2 on multiple system as a single response file can be used to setup the database server on different systems with same configurations.
- Data Studio is used to create a response file.
Root and Non-root installation.
You can install DB2 as a root user or a non-root user.
It's always recommended to install DB2 server as a root user as it avoids any restrictions.
Below is a comparison of root vs non-root installation.
| Criteria | Root installations | Non-root installations |
|---|---|---|
| User can select installation directory | Yes | No. Db2 database products are installed under the user's home directory. |
| Number of Db2instances allowed | Multiple | One |
| Files that are deployed during installation | Program files only. Instances must be created after installation. | Program files and instance files. The Db2 database product is ready for use immediately after installation. |
| Upgrade version and instance | No | No need to uninstall the old version before you install the new version. Install new version, and upgrade the instance, together. |
Installing DB2
Now we have a Virtual Machine available along with the DB2 binaries file we downloaded from the IBM website.
Below steps need to be performed to install DB2
Note:I have used the server edition installation file for demonstration, You can use either the server edition of the free express edition for installation.
Extract the v11.1_linuxx64_expc.tar.gz file using the below command
"tar -xvzf v11.1_linuxx64_server_t.tar.gz"
This would create a directory server_t in the same directory
Prerequisite check
Upon entering the server_t directory you can see various files that were extracted in the previous step.
Before installing DB2 you need to check if you machine passes the pre-requisites to install the software.
This can be done using the db2prereqcheck utility situated in the server_t directory
Run the following command on your terminal to begin the pre-requisites check
"[root@localhost server_t]# ./db2prereqcheck"
You need to install any missing packages that db2prereqcheck utility recommends(some of the packages can be ignored and you can process with the installation)
Installing DB2 using a GUI(Generating a response file)
- We need to run the db2setup wizard that is located in the directory where the installation file was extracted.
#./db2setup
- This would open a GUI where you can choose the various product and features available for installation.
- While installing we need to select the DB2 server edition option as shown in Figure 1.2
- Next we need to choose the base installation directory for our product(Figure 1.3).
- Select or de-select all the features as per requirements. For now, we will be selecting all the features.
- Next we can select any additional languages that we might require.
- Next we can choose if we want the documentation to be downloaded on the local machine.
- Finally, we can view the full summary of our installation and then opt to either install it or generate a response file. For now, we would be saving our installation inforamation in a response file which would most likely be created in the root directory
- Eg: /root/db2server.rsp
| Figure 1.1-Selecting a new Install option |
| Figure 1.2-Selecting a product for installation |
| Figure 1.3-Option for customizing the installation |
| Figure 1.4-Selecting all the required features |
| Figure 1.5-Selecting the Languages that are required |
| Figure 1.6 |
| Figure 1.7-Finalizing the installation or generating a response file |
Installing DB2 using a response file.
Now we will perform the DB2 server installation using a DB2 response file that was generated in the previous section using the GUI.
As all the customizations for the installation of our product is already saved in a response file, we just need to run the db2setup wizard from the terminal and pass the response file as a parameter to it.
The command to install DB2 using a response file is below.
"./db2setup -r <location of the generated response file>"
Eg: ./db2setup -r /root/db2server.rsp
Below is a sample response file.
Installing DB2 using DB2_Install wizard.
We can use the db2_install wizard located in the server_t directory to install DB2.
It's a CLI based interactive tool.
To begin installation enter the following command in the terminal window.
./db2_install
I will ask you various questions like to read and accept the license agreement, entering the full path of the installation directory, specifying the DB2 product that needs to be installed etc.
This utility provides very less options to customize your DB2 product installation.
Post Installation
There is a log file generated after the installtion completes that can be viewed if the DB2 encountered any errors during installation.
The log file can be found in the /tmp directory.
Uninstalling DB2
In order to uninstall DB2 we need to run the db2_deinstall utility located in the server_t directory.
We need to give a response file that was used for installation as a parameter to this script
./db2_deinstall -r /root/db2server.rspUpon entering the above command, we are asked to enter the full path of the base installation directory Eg: /opt/ibm/db2/V11.1.
The uninstallation will now proceed.
After the uninstall was completed successfully, we can view the log file "/tmp/db2setup.log" generated for any post uninstallation recommendations(This mostly includes deleting all the DB2 related files from the system manually).
Comments
Post a Comment