Tuesday, May 12, 2020

Ubuntu 20.4 manual ip config

1) cat /etc/netplan/00-installer-config.yaml 
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
      dhcp4: no
      addresses: [192.168.0.200/24]
      gateway4: 192.168.0.1  
      nameservers:
              addresses: [8.8.8.8,8.8.4.4]
  version: 2
2) netplan apply

3) ip a

Saturday, October 19, 2019

ocp 3.9 origin installation on centos 7

1) install required packages 

yum install -y wget git  nano net-tools docker-1.13.1 bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct openssl-devel httpd-tools NetworkManager python-cryptography python-devel python-passlib java-1.8.0-openjdk-headless "@Development Tools";

2) Add ansible repo for 2.6 version 

[ansible]
name = Ansible Repo
baseurl = https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/
enabled = 1
gpgcheck =  0

3) update centos 7

yum update -y

4) start and enable docker 

systemctl start docker && systemctl enable docker && systemctl status docker

5) install ansible 2.6 required for ocp 3.9 ansible playbook 

yum -y install ansible-2.6* pyOpenSSL

6) clone ansible repository 

git clone https://github.com/openshift/openshift-ansible.git -b release-3.9

7) create ssh key and copy to target system 

ssh-keygen
ssh-copy-id   master infra worker

7) edit inventory ini for 1 master 1 worker and 1 infra node without LB


8) Run playbooks

ansible-playbook -i inv.ini playbooks/prepare.yml
ansible-playbook -i inv.ini playbooks/deploy_cluster.yml

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