sudo apt-get update
1. update your Source-List /etc/apt/source.list, uncommnent the following lines:
deb http://archive.canonical.com/ubuntu lucid partner deb-src http://archive.canonical.com/ubuntu lucid partner
2. install db2express-c:
sudo apt-get install db2exc
3. if you met error like below,then make sure you have memory larger than 512MB. I met the error when I gave my VM 256MB memory (the official requirements said it is 256MB/512MB...). Another solution could be found here (saying you need to run db2start one more time).
Message: SQL1042C An unexpected system error occurred. SQLSTATE=58004
4. verify installation:
# login as db2 instance owner sudo su - db2inst1 # create sample database db2sampl # connect to sample database db2 connect to sample # list tables and query by db2 command line interface (CLI) db2 list tables db2 "select * from emp"
5. create sample database user
# exit the login of db2inst1 exit # create a new Ubuntu user since db2 use system authentication sudo useradd -d /home/db2user db2user # set password for db2user sudo passwd db2user # login as db2inst1 again to grant privilege to new user "db2user" sudo su - db2inst1 db2 connect to sample db2 grant DBADM on database to user db2user
6. change db2inst1 password:
# i'm not sure what the default password is # but you'd better change it to make your system safe sudo passwd db2inst1
more information:
the user name "db2inst1" may be different if you have installed db2 in your system before. (the last number '1' will increase by your installations)
if you met any other problems check the diagnostic log first:
/home/db2inst3/sqllib/db2dump/db2diag.log
IBM Official DB2 for Ubuntu Wiki