From https://serverfault.com/questions/380856/how-to-undo-apt-get-remove
echo '#!/bin/bash' > restore
echo sudo apt-get install `grep Remove /var/log/apt/history.log | tail -1 | sed -e 's|Remove: ||g' -e 's|([^)]*)||g' -e 's|:[^ ]* ||g' -e 's|,||g'` >> restore
chmod +x restore
./restore
June 30, 2020
[Note] DB2 in Docker
Before moving to Ubuntu, I set up DB2 in VBox on Win10 + Ubuntu 18 VM.
https://blog.keithkim.com/2020/02/note-install-db2-express-c-on-ubuntu-18.html
With Ubuntu + Docker -- things are a lot easier. See below:
[1] Get DB2 docker image
$ docker pull ibmcom/db2
[2] Create database volume directory
$ mkdir -p /data/db/db2
[3] Run DB2
$ docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=<choose an instance password> -e DBNAME=testdb -v /data/db/db2:/database ibmcom/db2
[4] Monitor
$ docker logs -f db2
Wait until DB2 is running and database is created.
$ docker exec -ti db2 bash -c "su - db2inst1"
https://blog.keithkim.com/2020/02/note-install-db2-express-c-on-ubuntu-18.html
With Ubuntu + Docker -- things are a lot easier. See below:
Steps
[1] Get DB2 docker image
$ docker pull ibmcom/db2
[2] Create database volume directory
$ mkdir -p /data/db/db2
[3] Run DB2
$ docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=<choose an instance password> -e DBNAME=testdb -v /data/db/db2:/database ibmcom/db2
[4] Monitor
$ docker logs -f db2
Wait until DB2 is running and database is created.
Misc
Connect to DB2 container:$ docker exec -ti db2 bash -c "su - db2inst1"
REFERENCE
- https://hub.docker.com/r/ibmcom/db2
- Use Oracle SQL Developer to access DB2 - https://www.db2tutorial.com/getting-started/sql-developer-db2/
June 29, 2020
[Note] Oracle in Docker
I've moved to Ubuntu (20.04 ) from Windows 10. On Windows, I used VirtualBox + CentOS for running Oracle DB. More modern way is using docker -- and here is a note on installing it. Since there is no Oracle database Xe docker image you can download. It requires to build and it's pretty simple.
[1] Download Oracle XE
https://www.oracle.com/database/technologies/xe-downloads.html
I got 18c Express for Linux x64,
https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm
[2] Get docker image builder code from github, created by Oracle
$ git clone https://github.com/oracle/docker-images.git
[3] Build docker image
Copy the downloaded Oracle RPM file file to this directory of the code that's from github,
$ cp ~/Download/racle-database-xe-18c-1.0-1.x86_64.rpm ~/workspace/local/docker-images/OracleDatabase/SingleInstance/dockerfiles/18.4.0
$ cd ~/workspace/local/docker-images/OracleDatabase/SingleInstance/dockerfiles
$ ./buildDockerImage.sh -v 18.4.0 -x
[4] Verify
(base) kkim@cherry:~/workspace/local/docker-images/OracleDatabase/SingleInstance/dockerfiles$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/database 18.4.0-xe 072b9c161782 2 hours ago 5.87GB
oraclelinux 7-slim 7442ca158991 2 weeks ago 120MB
[5] Run
$ docker run --name oracledb -d -p 51521:1521 -p 55500:5500 -e ORACLE_PWD=<your new admin pw> -e ORACLE_CHARACTERSET=AL32UTF8 oracle/database:18.4.0-xe
For more detailed step by step, see this page:
https://blogs.oracle.com/oraclemagazine/deliver-oracle-database-18c-express-edition-in-containers
Steps
[1] Download Oracle XE
https://www.oracle.com/database/technologies/xe-downloads.html
I got 18c Express for Linux x64,
https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm
[2] Get docker image builder code from github, created by Oracle
$ git clone https://github.com/oracle/docker-images.git
[3] Build docker image
Copy the downloaded Oracle RPM file file to this directory of the code that's from github,
$ cp ~/Download/racle-database-xe-18c-1.0-1.x86_64.rpm ~/workspace/local/docker-images/OracleDatabase/SingleInstance/dockerfiles/18.4.0
$ cd ~/workspace/local/docker-images/OracleDatabase/SingleInstance/dockerfiles
$ ./buildDockerImage.sh -v 18.4.0 -x
[4] Verify
(base) kkim@cherry:~/workspace/local/docker-images/OracleDatabase/SingleInstance/dockerfiles$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/database 18.4.0-xe 072b9c161782 2 hours ago 5.87GB
oraclelinux 7-slim 7442ca158991 2 weeks ago 120MB
[5] Run
$ docker run --name oracledb -d -p 51521:1521 -p 55500:5500 -e ORACLE_PWD=<your new admin pw> -e ORACLE_CHARACTERSET=AL32UTF8 oracle/database:18.4.0-xe
For more detailed step by step, see this page:
https://blogs.oracle.com/oraclemagazine/deliver-oracle-database-18c-express-edition-in-containers
REFERENCE
- https://blogs.oracle.com/oraclemagazine/deliver-oracle-database-18c-express-edition-in-containers
- https://mobiliardbblog.wordpress.com/2017/10/27/oracle-xe-docker-image-including-database-in-less-than-1-4gb-yes-you-can/
[Note:Ubuntu] move docker storage location
Default docker image location => /var/lib/docker
Want to move it to => /data/docker
$ sudo -i
$ systemctl stop docker
$ vi /lib/systemd/system/docker.service
Find this line:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Change it to:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -g /data/docker
$ sudo -i
$ mkdir -p /data/docker
$ rsync -aqxP /var/lib/docker/ /data/
$ systemctl daemon-reload
$ systemctl start docker
Check the change:
$ ps aux | grep -i docker | grep -v grep
root 32597 4.0 0.1 1082988 82332 ? Ssl 14:24 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -g /data/docker
Reference:
Subscribe to:
Posts (Atom)