trove/integration/scripts/files/elements/ubuntu-db2/install.d/10-db2
Gaetan Trellu c334c5e46d Accept the IBM DB2 license during the DIB process
During the DB2 installation, the db2_install
process asks a question about the license. Disk
Image Builder will hang until "yes" or "no" is
manually entered.

db2_install script provides the "-y" option to
accept automatically the license.

From db2_install help:
  Specifies that you have read and agreed to the
  license agreement file in the db2/license
  directory on the CD. This parameter is mandatory
  when -n is specified.

Change-Id: I8a8330adc41cbed60c8472f925b10cf816aed44e
Closes-Bug: #1747031
2018-02-02 11:12:02 -05:00

56 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
set -e
set -o xtrace
# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Uncompress the DB2 packages and install and configure DB2 on Ubuntu.
# DB2_PKG_LOCATION points to the directory where the DB2 packages
# are located to install.
DB2_PKG_LOCATION="/db2"
mkdir ${DB2_PKG_LOCATION}
cd ${DB2_PKG_LOCATION}
# DB2 install location
DB2_INSTALL_LOCATION="/opt/ibm/db2/current"
# DB2 install requires the hostname to be resolved correctly
host_name=`hostname`
echo "127.0.0.1 ${host_name}" >> /etc/hosts
tar -xvzf /tmp/in_target.d/db2.tar.gz
# installing dependencies
apt-get --allow-unauthenticated install libaio1
apt-get --allow-unauthenticated install libstdc++6
# start the installation process. Accepts the default installation directory '/opt/ibm/db2/current'
${DB2_PKG_LOCATION}/expc/db2_install -b ${DB2_INSTALL_LOCATION} -f sysreq -l ${DB2_PKG_LOCATION}/db2_install.log -y
# create the DB2 users.
# DB2 instance owner - db2inst1
# DB2 fence user - db2fenc1
# DB2 admin user - db2das1
useradd -m db2inst1
useradd -m db2fenc1
useradd -m db2das1
# Create the DB2 server instance
${DB2_INSTALL_LOCATION}/instance/db2icrt -a server -u db2fenc1 db2inst1
${DB2_INSTALL_LOCATION}/cfg/db2ln
# Configure DB2 server instance to communicate via TCP/IP on a particulat port.
echo 'db2c_db2inst1 50000/tcp # DB2 connection service port' >> /etc/services
# Configure DB2 to use the TCP/IP settings defined above.
su - db2inst1 -c "db2 update database manager configuration using svcename db2c_db2inst1"
# Start the actual TCP/IP communication.
su - db2inst1 -c "db2set DB2COMM=tcpip"
# DB2 requires the hostname to be resolved correctly. Delete this entry from the
# /etc/hosts since this is the hostname of the instance where the image is being
# built. The correct hostname will be set in the guest agent.
sed -i "/127.0.0.1[[:space:]]*${host_name}/d" /etc/hosts