Merge "Create DIB elements for DB2 Express-C on Ubuntu"
This commit is contained in:
36
scripts/files/elements/ubuntu-db2/README.md
Normal file
36
scripts/files/elements/ubuntu-db2/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
Creates an image for DB2 Express-C v10.5
|
||||
|
||||
The packages for DB2 Express-C can be downloaded from:
|
||||
http://www-01.ibm.com/software/data/db2/express-c/download.html
|
||||
and click on the link "DB2 Express-C for Linux 64-bit".
|
||||
New users can either get an IBM ID or click on the "Proceed without an
|
||||
IBM ID". User is provided with a registration form which needs to be
|
||||
completed in order to proceed further to download the DB2 Express-C
|
||||
packages. After accepting the license agreement, user can download the
|
||||
the DB2 Express-C package (.tar.gz file).
|
||||
|
||||
There are 2 options for making the DB2 Express-C package accessible to
|
||||
the Trove disk-image building process:
|
||||
- place the package in a private repository and set the environment
|
||||
variable DATASTORE_PKG_LOCATION with the url to this private
|
||||
repository.
|
||||
e.g. export DATASTORE_PKG_LOCATION="http://www.foo.com/db2/v10.5_linuxx64_expc.tar.gz"
|
||||
|
||||
- download the package and place it in any directory on the local
|
||||
filesystem that the trove-integration scripts can access. Set the
|
||||
environment variable DATASTORE_PKG_LOCATION with the full path to
|
||||
the downloaded package.
|
||||
e.g. export DATASTORE_PKG_LOCATION="/home/stack/db2/v10.5_linuxx64_expc.tar.gz"
|
||||
|
||||
The environment variables used are as follows:
|
||||
|
||||
DATASTORE_PKG_LOCATION - is the place where user stores the DB2
|
||||
Express-C package after registration. This can either be a
|
||||
url to a private repository or the full path to the
|
||||
downloaded package on a local filesystem.
|
||||
DATASTORE_DOWNLOAD_OPTS - defines any wget options user wants to specify
|
||||
like user,password, etc. This is an optional variable and is
|
||||
needed only if specifying a private repository to download
|
||||
the packages from.
|
||||
e.g. export DATASTORE_DOWNLOAD_OPTS="--user=foo --password='secret'"
|
||||
|
||||
25
scripts/files/elements/ubuntu-db2/extra-data.d/20-copy-db2-pkgs
Executable file
25
scripts/files/elements/ubuntu-db2/extra-data.d/20-copy-db2-pkgs
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
# CONTEXT: HOST prior to IMAGE BUILD as SCRIPT USER
|
||||
# PURPOSE: Download the DB2 Express-C v10.5 packages to a directory on the local filesystem or
|
||||
# to a private repository. The download location is specified using the env variable:
|
||||
# DATASTORE_PKG_LOCATION
|
||||
|
||||
[ -n "${TMP_HOOKS_PATH}" ] || die "Temp hook path not set"
|
||||
[ -n "${DATASTORE_PKG_LOCATION}" ] || die "DATASTORE_PKG_LOCATION not set"
|
||||
|
||||
# First check if the package is available on the local filesystem.
|
||||
if [ -f "${DATASTORE_PKG_LOCATION}" ]; then
|
||||
echo "Found the DB2 Express-C packages in ${DATASTORE_PKG_LOCATION}."
|
||||
dd if="${DATASTORE_PKG_LOCATION}" of=${TMP_HOOKS_PATH}/db2.tar.gz
|
||||
# else, check if the package is available for download in a private repository.
|
||||
elif wget ${DATASTORE_DOWNLOAD_OPTS} "${DATASTORE_PKG_LOCATION}" -O ${TMP_HOOKS_PATH}/db2.tar.gz; then
|
||||
echo "Downloaded the DB2 Express-C package from the private repository"
|
||||
else
|
||||
echo "Unable to find the DB2 package at ${DATASTORE_PKG_LOCATION}"
|
||||
echo "Please register and download the DB2 Express-C packages to a private repository or local filesystem."
|
||||
exit -1
|
||||
fi
|
||||
43
scripts/files/elements/ubuntu-db2/install.d/10-db2
Executable file
43
scripts/files/elements/ubuntu-db2/install.d/10-db2
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/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}
|
||||
|
||||
tar -xvzf /tmp/in_target.d/db2.tar.gz
|
||||
|
||||
# installing dependencies
|
||||
apt-get install libaio1
|
||||
apt-get install libstdc++6
|
||||
|
||||
# start the installation process. Accepts the default installation directory '/opt/ibm/db2/V10.5'
|
||||
${DB2_PKG_LOCATION}/expc/db2_install -b /opt/ibm/db2/V10.5 -f sysreq -l ${DB2_PKG_LOCATION}/db2_install.log
|
||||
|
||||
# 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
|
||||
/opt/ibm/db2/V10.5/instance/db2icrt -a server -u db2fenc1 db2inst1
|
||||
/opt/ibm/db2/V10.5/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"
|
||||
@@ -52,7 +52,7 @@ function build_guest_image() {
|
||||
exit 1
|
||||
fi
|
||||
SERVICE_TYPE=$1
|
||||
VALID_SERVICES='mysql percona redis cassandra couchbase mongodb postgresql couchdb vertica'
|
||||
VALID_SERVICES='mysql percona redis cassandra couchbase mongodb postgresql couchdb vertica db2'
|
||||
if ! [[ " $VALID_SERVICES " =~ " $SERVICE_TYPE " ]]; then
|
||||
exclaim "You did not pass in a valid image type. Valid types are:" $VALID_SERVICES
|
||||
exit 1
|
||||
|
||||
@@ -55,7 +55,12 @@ ESCAPED_PATH_TROVE=`echo $PATH_TROVE | sed 's/\//\\\\\//g'`
|
||||
ESCAPED_REDSTACK_SCRIPTS=`echo $REDSTACK_SCRIPTS | sed 's/\//\\\\\//g'`
|
||||
TROVE_AUTH_CACHE_DIR=${TROVE_AUTH_CACHE_DIR:-/var/cache/trove}
|
||||
TROVE_LOGDIR=${TROVE_LOGDIR:-$DEST/logs}
|
||||
DATASTORE_PKG_LOCATION=${DATASTORE_PKG_LOCATION:-$DEST/packages}
|
||||
# DATASTORE_PKG_LOCATION defines the location from where the datastore packages
|
||||
# can be accessed by the DIB elements. This is applicable only for datastores
|
||||
# that do not have a public repository from where their packages can be accessed.
|
||||
# This can either be a url to a private repository or a location on the local
|
||||
# filesystem that contains the datastore packages.
|
||||
DATASTORE_PKG_LOCATION=${DATASTORE_PKG_LOCATION:-}
|
||||
|
||||
# Load functions devstack style
|
||||
. $REDSTACK_SCRIPTS/functions
|
||||
@@ -321,6 +326,9 @@ function cmd_set_datastore() {
|
||||
elif [ "$DATASTORE_TYPE" == "vertica" ]; then
|
||||
PACKAGES=${PACKAGES:-"vertica"}
|
||||
VERSION="7.1"
|
||||
elif [ "$DATASTORE_TYPE" == "db2" ]; then
|
||||
PACKAGES=${PACKAGES:-""}
|
||||
VERSION="10.5"
|
||||
else
|
||||
echo "Unrecognized datastore type. ($DATASTORE_TYPE)"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user