Wednesday, February 14, 2018

Linux command line proxy / docker proxy configuraiton

Linux command line proxy configuration 

 If your system  placed in the restricted network and it  require to connect Internet through proxy server then you need to setup proxy server configuration by exporting http_proxy  or https_proxy linux environment value.

syntax :

export http_proxy=http://username:password@proxyserver:proxyport

export https_proxy=https://username:password@proxyserver:proxyport

example:

export http_proxy=http://kamal:kamal@myproxy.mynetwork.com:8080

export https_proxy=http://kamal:kamal@myproxy.mynetwork.com:8443

if you want to revert http_proxy config then simply type  $unset http_proxy from linux command prompt .

Docker proxy configuration

Same way you need to setup proxy configuration for docker too so that you can download / search / push / pull docker images from public docker registry.

by default docker wont take proxy config from environment variable you need to config by creating http-proxy.config file in the docker service directory.

1) Create a directory path and config file as a root user ( remember your user need to be a member of docker group or you must be a root user to perform this docker config by default directory and configuration file doesn't exist  )

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

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

2) Edit docker proxy  config file
  
#vi /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment="HTTP_PROXY=http://kamal:durai@proxy.myserver.com:8080"

3)Reload systems daemon configurations

 #systemctl daemon-reload

4) Restart docker service
  #systemctl restart docker
  
5) Verify docker proxy config
  #systemctl show --property=Environment docker    

6) Search docker images from docker registry 

#docker search nginx 

now you can see number of  nginx docker iamges from varies registry   

Thursday, July 13, 2017

Ansible installation yum based

Ansible:-

 Ansible is a push method config management tool, Relay on ssh protocol and Python is required on master and other nodes,support windows too through winRM module.

Installation :

1) ansible package is available in EPEL repository so EPEL is required.
2)yum -y install ansible
3)boto module installation for aws modules support
4)pip install boto ; pip upgrade boto

Verification:
#ansible --version

user creation and access path creation 

Ansible master node public key needs to copy all the nodes and ansible user sudo access must create.

master node :
 #useradd ansible;passwd ansible;su - ansible;ssh-keygen ;ssh-copy-id -i id_pub ansible@node1
   visudo ; ansible ALL=(ALL)  NOPASSWD
node1:
 #useradd ansible;passwd ansible;su - ansible

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/

Monday, June 9, 2014

JRockit 1.6 64 bit installation on Redhat Linux 6 64 bit .

In production systems we use JRockit jvm for weblogic application server .

1)Copy bin format jrockit 1.6 installer into your linux box /opt directory .
     scp jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-x64.bin root@localhost:/opt 

2)Add execute file permission into installer.
   #chmod +x  jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-x64.bin

3)Execute jrokit 1.6 installer .
   #./jrockit-jdk1.6.0_37-R28.2.5-4.1.0-linux-x64.bin
  Follow the wizard  if you want to change installation location you can specify directory location during the installation .

eg: 

<------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.5 for Java SE 6 with JRMC 4.1 ------------------------>

Choose Product Installation Directory:
--------------------------------------

    "Product Installation Directory" = [Enter new value or use default "/root/jrockit-jdk1.6.0_37-R28.2.5-4.1.0"]

     Enter new Product Installation Directory OR [Exit][Previous][Next]> /opt/jrockit1.6.0_37

4)Once installation completed then check jrockit installed directory 
    eg 
      # ll /opt/jrockit1.6.0_37
       total 260
      drwxr-xr-x. 2 root root   4096 Sep 27  2012 bin
      drwxr-xr-x. 3 root root   4096 Sep 24  2012 include
      drwxr-xr-x. 3 root root   4096 Jun  9 14:02 inventory
      drwxr-xr-x. 4 root root   4096 Jun  9 14:02 jre
      drwxr-xr-x. 2 root root   4096 Sep 24  2012 lib
      drwxr-xr-x. 6 root root   4096 Jun  9 14:02 missioncontrol
      -rw-r--r--. 1 root root 239443 Sep 27  2012 THIRDPARTYLICENSEREADME.txt