1. 2016-12-30 - Oracle 12c on CentOS; Tags: Oracle 12c on CentOS

    Oracle 12c on CentOS

    Installing Oracle DB 12c on a virtual machine for testing and developing purposes has it advantages. The installation is quite invasive and when it’s done in a virtualbox, it does no harm to your host system at work, which is btw. Windows and a total mess itself. If you follow the installation instructions and restarted the virtual machine I notice few things that didn’t work by trying to access the database from a SQL client.

    First of all, the Oracle DB instance is not automatically started. IMHO it is good, since I don’t frequently use Oracle DB. If used, it allocates a lot of resources of my notebook.

    Environment Settings

    The Oracle user needs some environment variables set, to work properly. I named the file oracle_schrott

    >TMPDIR=$TMP; export TMPDIR ORACLE_BASE=/var/opt/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME ORACLE_SID=saa; export ORACLE_SID PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

    You can source this file for instance within your .bash_profile.

    [vinh@localhost ~]$ cat .bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    # User specific environment and startup programs
    source ~/oracle_schrott
    export PATH

    Start Instance

    If you have the proper settings you have the command dbstart available. The proper call is however this:

    vinh@localhost ~]$ dbstart $ORACLE_HOME

    Now you can connect to the Oracle DB system

    [vinh@localhost ~]$ sqlplus / as sysdba
    SQL*Plus: Release Production on Thu Dec 29 17:46:26 2016
    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
    Connected to an idle instance.

    :question: Idle instance. Yes you need to startup.

    SQL> startup
    ORACLE instance started.
    Total System Global Area 2432696320 bytes
    Fixed Size                  2927288 bytes
    Variable Size             654312776 bytes
    Database Buffers         1761607680 bytes
    Redo Buffers               13848576 bytes
    Database mounted.
    Database opened.
    SQL> select current_date from dual;

    If you can startup, you can also shutdown.

    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.


    If you add the natting rule to virtualbox for the db port 1521, you will notice a connection problem. CentOS needs to be configured for that. First, check!

    [root@localhost ~]# firewall-cmd --get-active-zones
      interfaces: enp0s3

    Add Oracle ports

    [root@localhost ~]# firewall-cmd --zone=public --add-port=1521/tcp --add-port=5500/tcp --add-port=5520/tcp --add-port=3938/tcp --permanent
    [root@localhost ~]# firewall-cmd --reload
    [root@localhost ~]# firewall-cmd --list-ports
    1521/tcp 5520/tcp 3938/tcp 5500/tcp

    After that you can use the DB from the Windows host.

  2. 2016-12-30 - netstat on CentOS; Tags: netstat on CentOS

    netstat on CentOS

    Doing some Oracle DB Installation on CentOS, netstat is an essential tool for checking ports. On the minimal installation it is not installed. Check out how to install it.

    This approach failed:

    # yum install netstat

    yum provides the command whatprovides, and it will give you the package name.

    [root@localhost logs]# yum whatprovides netstat
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.bio.lmu.de
     * epel: epel.besthosting.ua
     * extras: artfiles.org
     * updates: centos.copahost.com
    net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
    Repo        : base
    Matched from:
    Filename    : /bin/netstat

    Install it:

    # yum install net-tools

    After that you use it:

    [root@localhost logs]# netstat -na | grep 1521
    tcp6       0      0 :::1521                 :::*                    LISTEN     
    tcp6       0      0 ::1:1521                ::1:50024               ESTABLISHED
    tcp6       0      0 ::1:50024               ::1:1521                ESTABLISHED
    unix  2      [ ACC ]     STREAM     LISTENING     65658    /var/tmp/.oracle/sEXTPROC1521
  3. 2016-12-29 - Install VirtualBox Guest Additions on CentOS; Tags: Install VirtualBox Guest Additions on CentOS

    Install VirtualBox Guest Additions on CentOS

    The guest additions of VirtualBox require DKMS (Dynamic Kernel Module Support). After every kernel update the modules for VirtualBox are automatically built. Therefore we need to install dkms which is outside the default repository, but in the EPEL (Extra Packages for Enterprise Linux) repository.

    Install it

    # yum install epel-release 
    # yum install dkms

    Mount the additions ISO and install it.

    # mkdir -p /media/cdrom 
    # mount -o loop /dev/cdrom /media/cdrom 
    # /media/cdrom/VBoxLinuxAdditions.run
  4. 2016-12-27 - Install docker on CentOS as virtual machine; Tags: Install docker on CentOS as virtual machine

    Install docker on CentOS as virtual machine

    Working with Windows sucks. Working with Docker and Windows also sucks. Working in a company with Docker and Windows sucks big time. Besides security and proxy everything is a hassle, because connectivity, filesystem or permissions might not work out of a box. Too many workarounds for docker freshmen. So I decided to run docker in a CentOS virtual machine. That is the closest thing to RHEL. This post demonstrates how to get Docker installed and properly configured, so you can work with docker with great pleasure :wink: .



    First step is to create a custom repo for docker:

    >[root@localhost vinh]# sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' > [dockerrepo] > name=Docker Repository > baseurl=https://yum.dockerproject.org/repo/main/centos/7/ > enabled=1 > gpgcheck=1 > gpgkey=https://yum.dockerproject.org/gpg > EOF [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg

    Download latest repo information

    [root@localhost vinh]# yum update
    Loaded plugins: fastestmirror
    dockerrepo                                                                                             | 2.9 kB  00:00:00
    dockerrepo/primary_db                                                                                  |  25 kB  00:00:00
    Loading mirror speeds from cached hostfile
     * base: centos.schlundtech.de
     * extras: centos.mirror.net-d-sign.de
     * updates: centos.bio.lmu.de
    No packages marked for update

    Install Docker

    [root@localhost vinh]# yum install docker-engine
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.schlundtech.de
     * extras: centos.mirror.net-d-sign.de
     * updates: centos.bio.lmu.de
    Resolving Dependencies
    --> Finished Dependency Resolution
    Dependencies Resolved
     Package                              Arch                 Version                             Repository                Size
     docker-engine                        x86_64               1.12.5-1.el7.centos                 dockerrepo                19 M
    Installing for dependencies:
     audit-libs-python                    x86_64               2.6.5-3.el7                         base                      70 k
     checkpolicy                          x86_64               2.5-4.el7                           base                     290 k
     docker-engine-selinux                noarch               1.12.5-1.el7.centos                 dockerrepo                28 k
     libcgroup                            x86_64               0.41-11.el7                         base                      65 k
     libseccomp                           x86_64               2.3.1-2.el7                         base                      56 k
     libsemanage-python                   x86_64               2.5-4.el7                           base                     103 k
     libtool-ltdl                         x86_64               2.4.2-21.el7_2                      base                      49 k
     policycoreutils-python               x86_64               2.5-9.el7                           updates                  444 k
     python-IPy                           noarch               0.75-6.el7                          base                      32 k
     setools-libs                         x86_64               3.3.8-1.1.el7                       base                     612 k
    Transaction Summary
    Install  1 Package (+10 Dependent packages)
    Total download size: 21 M
    Installed size: 85 M
    Is this ok [y/d/N]: y

    Service Configuration

    Enable service

    [root@localhost vinh]# sudo systemctl enable docker.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

    Start docker

    [root@localhost vinh]# sudo systemctl start docker

    Run Hello Docker

    Run hello world

    [root@localhost vinh]# docker run --rm hello-world
    Unable to find image 'hello-world:latest' locally
    Pulling repository docker.io/library/hello-world
    docker: Error while pulling image: Get https://index.docker.io/v1/repositories/library/hello-world/images: dial tcp getsockopt: connection refused.
    See 'docker run --help'.

    Bypass with proxy

    This section assumes you are using CNTLM as single proxy solution. Otherwise you need to replace it with your real proxy data.

    Create custom settings for docker

    [root@localhost vinh]# mkdir /etc/systemd/system/docker.service.d

    We add the proxies for http and https. Additionally if you run an internal docker registry, put it on the NO_PROXY line.

    [root@localhost vinh]# vim /etc/systemd/system/docker.service.d/http-proxy.conf
    Environment="HTTP_PROXY=" "HTTPS_PROXY=" "NO_PROXY=localhost,,artifactory.cinhtau.net"

    Reload and check

    [root@localhost vinh]# systemctl show --property=Environment docker
    Environment=HTTP_PROXY= HTTPS_PROXY= NO_PROXY=localhost,,artifactory.six-group.net

    It it mandatory to restart

    [root@localhost vinh]# systemctl restart docker

    Run hello world again

    [root@localhost vinh]# docker run --rm hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    c04b14da8d14: Pull complete
    Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
    Status: Downloaded newer image for hello-world:latest
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    Share images, automate workflows, and more with a free Docker Hub account:
    For more examples and ideas, visit:

    Have fun with Docker under Linux!

  5. 2016-12-23 - Setup keyboard language in CentOS; Tags: Setup keyboard language in CentOS

    Setup keyboard language in CentOS

    Got a weird situation, my keyboard is US_EN and it appears the shell has CH_DE.

    I figured it out by how to change it, by installing

    yum install system-config-keyboard

    Invoke than system-config-keyboard and than you can change the keyboard layout.

    Keyboard System Configuration