Db2 Virtual Appliance
We created a virtual appliance file with Db2 installation on Ubuntu, which can be used directly. Alternatively, you can setup Db2 with your own VM environment.
- Run Db2 with virtual appliance
Download the virtual image of Db2 installation (12.8GB) on Ubuntu. Open it with VirtualBox or VMWare Fusion Pro. VMWare Fusion Pro supports both Intel and Apple Silicon Macs (M1 and M2). If you use VMWare Fusion, please request a license from the University.
There are three users: vboxuser (sudo), db2inst1 (db2 instance owner and sample database owner), db2admin (sudo). Passwd: userdb
You can use db2inst1 to do all homework.
DBeaver and JDK are also installed.
- Setup Db2 using VirtualBox
You can install Db2 on Ubuntu using VirtualBox or download the virtual image and load it with VirtualBox. You can also use VMware Fusion Pro (supporting both Intel and Apple Silicon Macs) .
A. First, you download and install VirtualBox and Ubuntu ISO file, and follow instructions to set it up.
B. Then install all dependent libraries for Db2:
sudo apt-get install libx32stdc++6
sudo apt-get install lib32stdc++6
sudo apt-get install libstdc++5 libstdc++6
sudo apt-get install libpam0g:i386
sudo apt-get install libaio1
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ksh
sudo apt-get install ksh9
sudo apt-get install binutils
C. After that, run db2prereqcheck to make sure all required libraries are installed. If all successful, you can proceed to install Db2.
D. Then following Db2 installation instructions to run db2setup:
sudo ./db2setup
You can use db2val to validate if the installation is successful.
E. If successful, run db2sampl using db2inst1.
To uninstall Db2, following these steps.
- Access your VM database from your host machine
You can work with your Db2 directly on your VM machine from VirtualBox by installing additional developing tools such as Eclipse for JDBC. Alternatively, you can access your database from your host machine, e.g., your MacOS.
To access Db2 VM from your host, you first need to create a host-only network adapter. Turn off your VM instance, at "Settings" -> "Network", Adapter 2, Enable Network Adapter, Choose "Host-only Adapter" and save it. Restart your VM instance.
Login to Ubuntu, check your IP address:
ip addr show (or hostname -I)
From your host, e.g., DBeaver, create a database connection using the new IP address.
If you are using VMWare Fusion, please refer to this guideline on "Sharing a network between your VMware Fusion Linux guest and your Mac OS X host".