IBM buys Redhat in US$34 Billion deal

In one of the largest software M&A ever, IBM has paid US$34 billion in cash to acquire the Enterprise opensource OS company Redhat. The merger was announced few hours before and has come as a shock to many a companies.

This marks a new era in IBM’s cloud push, but what would be interesting is to watch how IBM would treat Redhat’s cash cow Redhat Enterprise Linux. Will it let Redhat run as an independent entity or start tightly coupling it with IBM’s Power cpu architecture.

You can read more on the news in the link below:

https://www.businessinsider.com.au/ibm-is-reportedly-nearing-a-deal-to-acquire-redhat-the-software-company-valued-at-20-billion-2018-10?r=US&IR=Tred_hat_logo

 

Install Oracle 18c(18.3) on CentOS 7.5 Silent Mode

Linux Version : CentOS 7.5
Oracle Version : 18c (18.3.0.0)

1. Download the Zip file from Oracle Website and create groups and oracle user(https://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle18c-linux-180000-5022980.html ) ##

groupadd oinstall
groupadd dba

useradd oracle -g oinstall -G dba
passwd oracle

Create .bash_profile , in my test server i use 3 different Oracle homes and versions, so the bash profile looks a bit extra funky 😉

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
export CATALINA_HOME=/home/oracle/apache-tomcat
PATH=/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/bin/bash:$CATALINA_HOME/bin.
export PATH
EDITOR=vi
export EDITOR=vi

if [ -s “$MAIL” ] # This is at Shell startup. In normal
then echo “$MAILMSG” # operation, the Shell checks
fi # periodically.

echo ” ”
echo ” ”
echo ” ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo ” Database options”
echo ” ”
echo ” ”
echo ” 1) DATABASE 12cR2″
echo ” ”
echo ” 2) DATABASE 12cR1″
echo ” ”
echo ” 3) DATABASE 18.3″
echo ” ”
echo ” ”
echo ” ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~”
echo ” ”
echo ” ”
echo ” Enter Choice:\c”
read env
if [ $env -eq 1 ] ; then
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=ora12c
PS1=’$PWD:12cR2–>’

else
if [ $env -eq 2 ] ; then
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=moovorix
PS1=’$PWD:12cR1–>’
fi

if [ $env -eq 3 ] ; then
export ORACLE_HOME=/u01/app/oracle/product/18.3.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=ora18c
PS1=’$PWD:18c–>’
fi
fi
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/lib
export LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib:/lib
export PATH=$PATH:$ORACLE_HOME/bin:/u01/app/12.1.0.2/grid/bin:$ORACLE_HOME/OPatch
stty erase ^?
TMOUT=0;TIMEOUT=600;export readonly TMOUT TIMEOUT
set -o vi

echo ”
echo ”
clear
echo
echo “ORACLE_SID=$ORACLE_SID”
echo

alias tsmd=’cd /opt/tivoli/tsm/client/oracle/bin64/’
alias ob=’cd $ORACLE_BASE’
alias oh=’cd $ORACLE_HOME’
alias tns=’cd $ORACLE_HOME/network/admin’
alias ch=’cd $CATALINA_HOME’
alias envo=’env | grep ORACLE’
alias sqld=’rlwrap sqlplus “/as sysdba”‘
alias cpu=”cat /proc/cpuinfo | awk ‘/^processor/{print $3}’ | wc -l”
alias py=’/usr/bin/python3.6′
alias py2=’/usr/bin/python’
export PATH
umask 022

envo

2. Install all the pre-requisites, if your on Oracle Linux there is an RPM you can install : oracle-database-preinstall-18c

Else if you prefer do the pre-requisites manually (Which I do)

Check for missing packages

rpm -q –qf ‘%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n’ binutils \
compat-libcap1 \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
libXext \
libXtst \
libX11 \
libXau \
libxcb \
libXi \
sysstat \
unixODBC \
unixODBC-devel

Install missing packages with Yum
eg:
rpm -Uvh compat-libcap1

Update Kernel Parameters

Open sysctl.conf file and add the kernel parameters

vi /etc/sysctl.conf

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

Add Limits for Oracle user

Open file limits.conf and add below parameters

vi /etc/security/limits.conf

–shell limits for users oracle 18c

oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768

3. Silent Installation of 18c Software, the new installer is a zipped Oracle Home which you need to unzip to your Oracle Home directory and installation command just relinks all libraries. The installation is super quick due to this, afer this installation you are never going back to the normal runInstaller again

mkdir -p /u01/app/oracle/product/18.3.0/dbhome_1/

unzip -q LINUX.X64_180000_db_home.zip -d /u01/app/oracle/product/18.3.0/dbhome_1/

cd /u01/app/oracle/product/18.3.0/dbhome_1/

sed -e ‘/\s*#.*$/d’ -e ‘/^\s*$/d’ install/response/db_install.rsp > install/response/db_18c.rsp

cat install/response/db_18c.rsp
## Remove all other parameters and just leave the below ##

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v18.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/18.3.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba

## If an error “[WARNING] [INS-13001] Oracle Database is not supported on this operating system 18c” pops up; the use parameter ignoreInternalDriverError in the runinstaller ##

./runInstaller -silent -responseFile install/response/db_18c.rsp -ignoreInternalDriverError

## As Root User ##
sh /u01/app/oracle/product/18.3.0/dbhome_1/root.sh

4. Silent Creation of Database using dbca silent mode

dbca -createDatabase -silent -gdbName ora18c -templateName General_Purpose.dbc -sysPassword sys123 -systemPassword sys123 -dbsnmpPassword sys123 -datafileDestination /u01/oradata -storageType FS -memoryPercentage 20 -emConfiguration NONE -sampleSchema false

[FATAL] [DBT-50000] Unable to check for available memory.
[FATAL] [DBT-50001] Unable to check the value of kernel parameter {0}

While creating a on-premise 18c (18.3) database with DBCA in the silent mode If you get above error. Then use the parameter -J-Doracle.assistants.dbca.validate.ConfigurationParams=false ; it can be used both in cli and gui ##

dbca -createDatabase -silent -gdbName ora18c -templateName General_Purpose.dbc -sysPassword sys123 -systemPassword sys123 -dbsnmpPassword sys123 -datafileDestination /u01/oradata -storageType FS -memoryPercentage 20 -emConfiguration NONE -sampleSchema false -J-Doracle.assistants.dbca.validate.ConfigurationParams=false

5. Create Listener for 18c

cd /u01/app/oracle/product/18.3.0/dbhome_1/admin/network

vi listener.ora

SID_LIST_LISTENER_18C =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ora18c)
(ORACLE_HOME = /u01/app/oracle/product/18.3.0/dbhome_1)
(SID_NAME = ora18c)
)
)

LISTENER_18C =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 103.42.111.196)(PORT = 1523))
)
)

lsnrctl start LISTENER_18C

Checking from SQL*PLUS

SQL*Plus: Release 18.0.0.0.0 – Production on Mon Aug 13 04:03:10 2018
Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 – Production
Version 18.3.0.0.0

SQL> select name,open_mode from v$database;

NAME OPEN_MODE
——— ——————–
ORA18C READ WRITE

Dkam7GRUwAA3XXJ.jpg large

SCP and Pass Variable in Bash Script


#!/bin/bash

read -p 'Enter the Files to be Send to Remote Host: ' files
destination_directory='/home/oracle'

scp -i /Users/shadab/wha.pem $files oracle@192.168.1.200:$destination_directory

## SAMPLE USAGE ##
# shadabs-MacBook-Pro:~ shadab$ ./scp_files.sh
#Enter the Files to be Send to Remote Host: *.sh
#scp_files.sh 100% 344 39.1KB/s 00:00
#scp_files_gone.sh 100% 344 52.3KB/s 00:00
#
#
#shadabs-MacBook-Pro:~ shadab$ ./scp_files.sh
#Enter the Files to be Send to Remote Host: scp_files.sh
#scp_files.sh 100% 434 80.5KB/s 00:00

You can now add alias for this script in .bashrpc file

alias scpo=’sh /Users/shadab/scp_files.sh’

A Very Cool Oracle Bash Profile


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=easyoradba.com
export ORACLE_UNQNAME=ora12c
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_SID=ora12c
export CATALINA_HOME=/home/oracle/apache-tomcat

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin:$CATALINA_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias ob='cd $ORACLE_BASE'
alias oh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias ch='cd $CATALINA_HOME'
alias envo='env | grep ORACLE'
alias sqld='rlwrap sqlplus "/as sysdba"'

umask 022

envo

Create pem file for SSH access Linux

It is always good practice to lock down password based logins and SSH using keys. We can use pem files to login to remote server from local machines. Infact if you use AWS, the only way to SSH into the server is using pem files.

This procedure can be done on any server cloud based or sitting on your LAN

1. On your local Machine from where you require access, I prefer to keep it in the home directory of the user

# cd $HOME

# ssh-keygen -t rsa -b 2048

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/shadab/.ssh/id_rsa): wha
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in wha.
Your public key has been saved in wha.pub.
The key fingerprint is:
SHA256:*******************************
The key’s randomart image is:
+—[RSA 2048]—-+
| |
| . |
|= o |
|oB . . |
| o+ .o S |
|.+.o= .. |
|+ o*.Xo.+ |
|o =o&.BO o |
| + E+X++=.. |
+—-[SHA256]—–+

The file which i chose to create is “wha”, this will create 3 files “wha”, “wha.pem”, “wha.pub”

wha.pem is empty for now
wha : is your private key
wha.pub : is your public key

 

 

2. Keep the private key (wha) as it is and create a pem file from it

# rsa -in wha -outform pem > wha.pem

writing RSA key

Now the pem file is created. Next step to copy public key to remote server

Note: If you dont have rsa utility on your local machine, with a simple copy command also you can create the pem file.

# cp -p wha wha.pem

 

 

3. Copy the public key to your remote server, which needs to be accessed

# ssh-copy-id -i wha.pub root@1.0.0.1

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “wha.pub”
The authenticity of host ‘1.0.0.1 (1.0.0.1)’ can’t be established.
ECDSA key fingerprint is SHA256:*************************.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
root@1.0.0.1 password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘root@1.0.0.1′”
and check to make sure that only the key(s) you wanted were added.

 

 

4. Change the permissions of your local machine pem file

# chmod 400 wha.pem

 

 

5. Login to remote server with pem file to check

# ssh -i /Users/shadab/wha.pem root@1.0.0.1

 

6. Disable SSH Access to server

On the remote server with root user

# vim /etc/ssh/sshd_config

Change parameter PasswordAuthentication yes to PasswordAuthentication no

Restart SSH Daemon

# systemctl restart sshd

or

# service sshd restart

 

P.S: If you need to do the same for any other user on the remote server. you just have to
copy the public key file with that user on the remote server

 

ssh-copy-id -i wha.pub oracle@1.0.0.1

ssh -i /Users/shadab/wha.pem oracle@1.0.0.1

 

 

Column count of mysql.user is wrong. Expected 42, found 39. Created with MySQL 50173, now running 50560. Please use mysql_upgrade to fix this error.

This error occurred in my environment when i tried to create a user in MySQL, most likely you have upgraded MySQL Server (51. to 5.6  in my case) . After upgrading your MySQL you have to run  mysql_upgrade to fix any incompatibilities in System tables. If it finds any errors it automatically repairs it and upgrades all the internal data dictionary.

Just run the below command after upgrading your MySQL, restart MySQL and it will fix the issue.

# mysql_upgrade –force -u root -p

# service mysqld restart

Documentation#1193 – Unknown system variable ‘lc_messages’

This error you would usually see when you login to phpMyAdmin after an upgrade. This is related to your MySQL version, in my case I had upgraded my phpMyAdmin but the MySQL version was still on 5.1, after upgrading to MySQL 5.6 it solved the issue

You can upgrade MySQL to the latest version by downloading the latest rpm’s or use repository for the upgrade. I prefer to use the mysql repo’s as it is the best source of the latest release.

https://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html

 

Install NodeJS on CentOS 6 – 7

Install Latest NodeJS on CentOS 6 or 7
————————————–

1. Add Repo and Install NodeJS

For Stable Release:-

$ yum install -y gcc-c++ make
$ curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash –

$ yum install nodejs

 

2. Check the version for Node and NPM

$ node -v

v8.11.1

$ npm -v

5.6.0

 

3. Create a Demo Server

$ vim demo_server.js

add below lines

var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Welcome To EasyOraDBA’);
}).listen(3005, “127.0.0.1”);
console.log(‘Server is running at http://127.0.0.1:3005/’);

4. Start the Node Server

[root@easyoradba CordovaApps]# node demo_server.js
Server is running at http://127.0.0.1:3005/

Go to your Browser and Paste the URL, your WebServer has been started on port 3005

Execute Windows Commands from Linux using winexe. Connect from Linux to Windows without SSH

Winexe – is a software on Linux which uses RPC to run remote commands and might even come with your distribution’s packages. It depends on Samba for running rpc commands

Edit: even if your distro does not have it precompiled and you do not want to compile yourself, you should check out the Build Service – it is likely to have the binary version you would need for your system.

First Install samba-common on your Linux machine before beginning winexe

Use below article to check WinEXE installation

https://www.kickass.se/?p=189

Winexe is a GNU/Linux based application that allows users to execute commands remotely on WindowsNT/2000/XP/2003/Vista/7/8 systems. It installs a service on the remote system, executes the command and uninstalls the service. Winexe allows execution of most of the windows shell commands.

How to install:
You can download the source package from here [Current version is winexe-1.00.tar.gz]

  1. tar -xvf winexe-1.00.tar.gz
  2. cd winexe-1.00/source4/
  3. ./autogen.sh
  4. ./configure
  5. make basics bin/winexe
  6. make “CPP=gcc -E -ffreestanding” basics bin/winexe (For X64 bit)

this will create a [ winexe ] binary file in the bin folder. You can use that binary to execute the windows commands from Linux.

or else there are some compiled version of binary itself available for download. You can download and use it from here.

The above version of winexe works only till version Windows Server 2012. For Windows Server 2012R2 requires below method to make winexe work with latest version of windows. Below method will get the code for samba and winexe from the github repository and we will have to build it for it to work.

Alternate Method (Best Method to Work with Latest Version of Windows 10 and Windows Server 2012R2)

http://rand0m.org/2015/08/05/winexe-1-1-centos-6-and-windows-2012-r2/

  1. Install Samba on Linux

yum install samba-common

2.      fixup a bunch of samba dependencies

yum install gcc perl mingw-binutils-generic mingw-filesystem-base mingw32-binutils mingw32-cpp mingw32-crt mingw32-filesystem mingw32-gcc mingw32-headers mingw64-binutils mingw64-cpp mingw64-crt mingw64-filesystem mingw64-gcc mingw64-headers libcom_err-devel popt-devel zlib-devel zlib-static glibc-devel glibc-static python-devel

yum install git gnutls-devel libacl1-dev libacl-devel libldap2-dev openldap-devel

  1. As per the docs, remove libbsd-devel if installed

yum remove libbsd-devel

  1. Clone the git repos. samba is huge, like 280MB

cd /usr/src

git clone git://git.code.sf.net/p/winexe/winexe-waf winexe-winexe-wafgit clone git://git.samba.org/samba.git samba

  1. per winexe bug 64, samba needs to be reverted to a6bda1f2bc85779feb9680bc74821da5ccd401c5

cd /usr/src/samba

git reset –hard a6bda1f2bc85779feb9680bc74821da5ccd401c5

  1. Fixup the build deps

cd /usr/src/winexe-winexe-waf/source

vi wscript_build

# modify ‘wscript_build’, and at the very end …stlib=’smb_static bsd z resolv rt’lib=’dl gnutls’

7.     Build it! his does a huge configure, then also compiles samba, which takes a while. 

./waf –samba-dir=../../samba configure build

8.     Executable should be  /usr/src/winexe-winexe-waf/source/build/winexe-static

cd /usr/src/winexe-winexe-waf/source/build/

cat </dev/null | ./winexe-static -U ‘domain\admin%$PWD’ //iihoserver01 “ipconfig -all”

cat </dev/null | ./winexe-static -U ‘domain\admin%$PWD’ //iihoserver01 “ipconfig -all” -d99

Sample on How to use it to Check Service on Linux :

export CHECK_COMMAND=’sc query “Notification Service”‘

export STOP_COMMAND=’sc stop “Notification Service”‘

export START_COMMAND=’sc start “Notification Service”‘

## Check Service Status ##

cat </dev/null | ./winexe-static -U ‘domain\admin%$PWD’ //iihoserver01 –interactive=0 “$CHECK_COMMAND”

## Check with Debug ##

cat </dev/null | ./winexe-static -U ‘domain\admin%$PWD’ //iihoserver01 –interactive=0 “$CHECK_COMMAND” -d99

## Run powershell script or command on windows then like below ##

winexe -U administrator%$PWD //$IP “powershell -Command & {(c:\User\administrator\powershell.ps1)}”

 

## Stop and Start Service ##

export CHECK_COMMAND=’sc query “Browser”‘

export STOP_COMMAND=’sc stop “Browser “‘

export START_COMMAND=’sc start “Browser “‘

cat </dev/null | ./winexe-static -U ‘domain\admin%$PWD’ //iihoserver01 –interactive=0 “$CHECK_COMMAND”

cat </dev/null | ./winexe-static –U ‘domain\admin%$PWD’ //iihoserver01 –interactive=0 “$STOP_COMMAND”

cat </dev/null | ./winexe-static -U ‘domain\admin%$PWD’ //iihoserver01 –interactive=0 “$START_COMMAND”

 

 

Compare 2 Servers RPM and Install RPM from Text File List

1. Generate RPM list on Old Server

rpm -qa –queryformat=’%{NAME}\n’ | sort > serverold.txt

2. Generate RPM list on New Server

rpm -qa –queryformat=’%{NAME}\n’ | sort > servernew.txt

3. Copy File to New Server and use diff comand to get differences

diff serverold.txt servernew.txt > diff.txt

4. Get list of packages missing in new Server

cat diff.txt | grep “<” > difference.txt

vi difference.txt

%s,< ,

## save and exit

5. Install missing packages on new server

yum -y install $(cat difference.txt)