Tuesday, December 8, 2015

Docker installation and proxy settings from docker site (Cent OS)

I - Installation :-

1)Adding docker yum repository to your local machine.

#vi  /etc/yum.repos.d/docker.repo

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
#Proxy config -- optional
#proxy=http://192.168.1.1:80
#proxy_username=domainname\username
#proxy_password=password

2)Install docker throught yum

#yum install docker-engine

3)start & check status of docker service using systemctl

#systemctl start docker.service
#systemctl status  docker.service

II - Docker Proxy configuration for  docker image :- 

1)create a directory for docker service

#mkdir /etc/systemd/system/docker.service.d

2)Add proxy settings in config file

#vi /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="http_proxy=http://domainname\username:password@192.168.1.1:80"

3)Reload docker config and restart docker service

  # systemctl daemon-reload
  # systemctl show docker --property Environment
  # systemctl restart docker

4)Check docker service and pull ubuntu image

  #docker run hello-world
  #docker run -it ubuntu bash

5)check docker version
 
  #docker info

Monday, October 26, 2015

Raspberry PI static IP setup - Wireless wlan0


1)Edit network card and add ip / broadcast / gateway address

pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.33
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

pi@raspberrypi ~ $

2) Add wifi router name & password

pi@raspberrypi ~ $ sudo cat  /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="hubname"
        psk="password"
        key_mgmt=WPA-PSK
}
pi@raspberrypi ~ $

3)View your ip


pi@raspberrypi ~ $ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr
          inet addr:192.168.1.33  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:915 errors:0 dropped:148 overruns:0 frame:0
          TX packets:329 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:202526 (197.7 KiB)  TX bytes:49840 (48.6 KiB)

pi@raspberrypi ~ $

simple google search can fetch lots of results  but this post is for my reference :) ,Today My Raspberry PI2 DAY :)




Wednesday, April 8, 2015

Tomcat startup script - Tomcat V6/7/8 - Linux

Tomcat startup script :-

Script based  Tomcat lifecycle management is good in Production and test environment,Befor starting  Tomcat server we have to export Tomcat variables in system level

most common varialbes are :-

1)CATALINA_BASE     - Tomcat installation location
2)CATALINA_HOME   - Tomcat instance location if you are running multible instance in same machine .
3)CATALINA_OPTS    - Server scope java options  eg time zone ,language support etc
4)CATALINA_OUT      - Catalina.out file location - jvm output will be store in this file
5)CATALINA_PID        - Tomcat server process id file
6)JAVA_HOME             - Java home
7)JAVA_OPTS              - Java options - JVM options , heapsize ,minimum & maximum memor size , tunning parameters

Sample  bash script which is used to start  owcs 11g  hosted tomcat instance .

startup.sh

#!/bin/sh

FW_UID=11112

if [[ $EUID -ne $FW_UID ]]; then
  echo "This script must be run as  tomcat user"  1>&2
  exit 1
else

CATALINA_OUT=/owcs/logs/dev/editorial/catalina.out
CATALINA_BASE=/owcs/dev/editorial/cs_tomcat
CATALINA_HOME=/owcs/apache-tomcat-6.0.37
CATALINA_PID=/owcs/pids/dev_editorial_pid
JAVA_HOME=/owcs/jdk1.6.0_45
CLASSPATH=$CATALINA_HOME/lib/ojdbc6.jar:$CATALINA_BASE/cs_tomcat/webapps/cs/WEB-INF/lib/MSXML.jar:/owcs/dev/owcs-editorial/bin:$JAVA_HOME/lib/tools.jar
JAVA_OPTS="-Xms2048m -Xmx2048m -Xss512k -Xloggc:/owcs/logs/dev/editorial/verbosegc.$$ -XX:PermSize=512m -XX:MaxPermSize=650m -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Duser.timezone=Europe/London -Dcom.sun.management.jmxremote -Dfile.encoding=UTF-8 -Dcs.useJavaURLDecoder=false -Dcs.useEhcache=true -Dnet.sf.ehcache.enableShutdownHook=true -DenableErrorPropagation=true -Djava.library.path=/owcs/dev/owcs-editorial/bin -Djava.awt.headless=true"

export CATALINA_OUT CATALINA_BASE CATALINE_HOME CATALINA_PID JAVA_HOME JAVA_OPTS CLASSPATH

case $1 in
'start')
        exec "$CATALINA_HOME"/bin/catalina.sh start "$@"
        ;;

'stop')
        exec "$CATALINA_HOME"/bin/catalina.sh stop -force "$@"
        ;;

*)
        echo "usage: $0 {start|stop}"
        rval=1
        ;;
esac
fi

Reference :-

http://tomcat.apache.org/tomcat-6.0-doc/index.html

Monday, April 6, 2015

Yum based Docker installation (Redhat EL 6.6 )

Yum based Docker installation :-

Requirements :

1)Redhat linux 6.5 or above
2) EPEL Repository

Procedure :-

1) Download EPEL 6 - 64 bit repository 

#rpm -ivh  http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
#yum update
#yum repolist

2) Install docker-io through yum 

#yum -y install docker-io

3) Disable selinux 

#SELINUX=disabled in  /etc/selinux/config file and reboot system

4) Start and enable docker daemon 

#service docker start
#chkconfig docker on
#service docker status

6) Check docker installation - 250 MB download from internet depends on your download speed

# docker run -i -t fedora /bin/bash

Unable to find image 'fedora:latest' locally
fedora:latest: The image you are pulling has been verified

511136ea3c5a: Pull complete
00a0c78eeb6d: Pull complete
834629358fe2: Pull complete
Status: Downloaded newer image for fedora:latest


Reference :-

1) http://docs.docker.com/installation/rhel/