Thursday, November 14, 2013

Remote Display using ssh - xterm issue

When you try to access remote system display through ssh you may get below error .

$ xterm
xterm Xt error: Can't open display: 
xterm:  DISPLAY is not set
CHECKING REMOTE DISPLAY CONFIGURATION 

$ echo $DISPLAY

CHANGE BELOW VALUES IN THE FILE 

$ VI /etc/ssh/sshd_config 
X11Forwarding yes
X11DisplayOffset 10
RESTART THE SSHD SERVICE
#service sshd restart 
CONNECT REMOTE SERVER 
#ssh -X root@remoteserver.com
TEST X SERVER DISPLAY
#xterm

Monday, September 30, 2013

Linux Simple NFS Sharing (Redhat/Centos/etc..)

This procedures for  simple nfs sharing

Server Side : (192.168.0.1)

1) Install nfs package (nfs,nfs utils,rpcbind are packages are required )
    #yum install nfs*

2) Export nfs sharing folders
    #vi /etc/exports
 
  eg : /nfs folder export to all network with read and write access
               # cat  /etc/exports
                      /nfs *(rw)
3)start the nfs services (nfs using rpcbind port number 2049)

#service rpcbind start
#service nfs start
#chkconfig rpcbind on
#chkconfig nfs on

4)exporting the  shares

   #exportfs -av
 
5)verifying  exports

  #showmount -e localhost
 
Client Side : (192.168.0.2)
  mounting NFS sharing  to local machine 
 
1)create mount directory
   #mkdir /nfs
 
2)installing nfs packages

   #yum install nfs*
 
3)staring the nfs service (first we need to start rpcbind as nfs using rpcbind port number 2049)

   #service rpcbind start
   #service nfs start
   #chkconfig rpcbind on
   #chkconfig nfs on

4)mounting nfs share

  #mount -t nfs 192.168.0.1:/nfs  /nfs

5)check the mount points

  #mount  
  

WLST access using key files


1) connect the server and store the user credentials as a key file

             connect("weblogic","Webl0gic","t3://192.168.1.10")
             storeUserConfig('/opt/oracle/user.config','/opt/oracle/user.key')

2) example to  connect the server  using key files

connect(userConfigFile='/opt/oracle/user.config',userKeyFile='/opt/oracle/user.key',url='t3://192.168.1.10')

Sunday, September 22, 2013

Apache Tips

Some of my Apache works

1)fix for apache error 'Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using sso.linux.com for ServerName'

add below properties in /etc/httpd/conf/httpd.conf file


ServerName localhost

2)Disable default html index file
  

comment out all the lines in /etc/httpd/conf.d/welcome.conf


3) Directory Listening using virtual host and alias  example





NameVirtualHost *:808

Alias /logs  "/test"

<VirtualHost *:808>

<Directory /test>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>
</VirtualHost>


4)Apache Reverse proxy Configuration example
 <VirtualHost *:8446>
  SSLEngine On
  SSLCertificateFile /home/apache/ssl_certs/server.crt
  SSLCertificateKeyFile /home/apache/ssl_certs/server.key
  ProxyPass    /app01/    http://10.0.1.1:808/logs/
  ProxyPassReverse     /app01/    http://10.0.1.1:808/logs/
  ProxyPass    /app02/    http://10.0.1.2:808/logs/
  ProxyPassReverse     /app02/    http://10.0.1.2:808/logs/
</VirtualHost>

5) Apache 2.4 virtual host directory sharing config for ansible
 
http://localhost:81/opt/repo  should work fine for file sharing  

 Listen 81
<VirtualHost *:81>
DocumentRoot "/"
<Directory "/opt/repo">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>
<Directory "/foo">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>
</VirtualHost>
 

Weblogic Application deployment using maven plugin

1)create a "weblogic" maven plug-in

 i) change webloigc library directory

      #cd MW_HOME/wlserver_10.3/server/lib/

 ii)create a plug-in using wljarbuilder

      #java -jar wljarbuilder.jar -profile weblogic-maven-plugin

 iii)now you can see the weblogic maven plugin file "weblogic-maven-plugin.jar"

2)weblogic plugin  configuration and installaion in to maven ".m2" repository

    i)extract pom file from weblogic plug-in

      #jar xvf weblogic-maven-plugin.jar META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml
  
   ii)copy the pom file from extract location to local location .
    
      #cp META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml .

   iii)add "com.oracle.weblogic" in pluginGroups to the maven settings.xml as follow
  
            <pluginGroups>
                  <pluginGroup>com.oracle.weblogic</pluginGroup>
             </pluginGroups>

  iV)change the weblogic-maven-plugin.jar pom.xml file as follows
         <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
          http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.oracle.weblogic</groupId>
        <artifactId>weblogic-maven-plugin</artifactId>
        <packaging>maven-plugin</packaging>
        <version>10.3.4</version>
        <name>Maven Mojo Archetype</name>
        <url>http://maven.apache.org</url>
        <dependencies>
           <dependency>
               <groupId>org.apache.maven</groupId>
               <artifactId>maven-plugin-api</artifactId>
               <version>2.0</version>
           </dependency>
        </dependencies>
        <build>
        <plugins>
          <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>2.3</version>
           <configuration>
             <goalPrefix>weblogic</goalPrefix>
           </configuration>
          </plugin>
        </plugins>
        </build>
        </project>
   v) install weblogic-maven-plugin file and pom file .
  
       #mvn install:install-file -Dfile=weblogic-maven-plugin.jar -DpomFile=pom.xml  

3)verify weblogic plug-in

   i)execute below file will show weblogic help
    
     #mvn weblogic:listapps


4)sample maven for undeploy , deploy and list the applications in cluster

<?xml version="1.0" encoding="windows-1252" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>application</groupId>
  <artifactId>applicationEar</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>ear</packaging>
 
  <dependencies>
    <dependency>
          <groupId>application</groupId>
          <artifactId>applicationViewController</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          <type>war</type>
    </dependency>
  </dependencies>
 
  <build>
    <resources>
          <resource>
            <directory>../.adf</directory>
            <includes>
              <include>**/*</include>
            </includes>
            <targetPath>adf</targetPath>
          </resource>
          <resource>
            <directory>../src/META-INF</directory>
            <includes>
              <include>**/*</include>
            </includes>
            <targetPath>META-INF</targetPath>
          </resource>
     </resources>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
              <finalName>application</finalName>
              <earSourceDirectory>${project.build.directory}/classes</earSourceDirectory>
              <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
              </archive>
              <modules>
                <webModule>
                  <groupId>application</groupId>
                  <artifactId>applicationViewController</artifactId>
                  <contextRoot>application</contextRoot>
                </webModule>
              </modules>
              <defaultLibBundleDir>lib</defaultLibBundleDir>
            </configuration>
          </plugin>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>10.3.6.0</version>
<configuration>
<adminurl>t3://10.0.1.40:7001</adminurl>
<user>wldeployer</user>
<password>wldeployer123</password>
<upload>true</upload>
<target>vfccare</target>
<verbose>true</verbose>
<source>${project.build.directory}/application.ear</source>
<stage>true</stage>
<name>application</name>
<failonerror>false</failonerror>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>undeploy</goal>
<goal>deploy</goal>
<goal>list-apps</goal>
</goals>
</execution>
</executions>
</plugin>

    </plugins>
   
  </build>
 
  <parent>
    <groupId>application</groupId>
    <artifactId>application</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
 
</project>

Tuesday, August 6, 2013

Key Less linux root login using moba - Xterm


MobaXterm is powerful ssh client for linux and it's better then putty !!!

1) download and install mobaxterm personal edition  from website http://mobaxterm.mobatek.net/

2)log into linux box as a root .

3)generate private / public ssh key without passphrace

   #ssh-keygen -t rsa

  below three files will create under .ssh directory

   /root/.ssh/
                id_rsa   - private key
                id_rsa.pub - public key
                known_hosts - know host file

4)copy the public key to  login as a root user

 #ssh-copy-id -i /root/.ssh/id_rsa.pub root@master.linux.com

the above command will create authorized_keys file under /root/.ssh/ folder to authenticate key less ssh login

5)copy the private key in to your local windows machine

  eg : -

[root@master .ssh]# cat id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQEA9vrrNhbh9qjagzn+s88C4Jlpp1H2ABZ+h2ExN3uvRAi0mHd7
Jgm+T1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RiG5HtIOWlf5DDIHlEk9n0
/LCTW1pXQPCok4MGncU4rnccMk//B0GmlQ5f0cuoAgHzNVzRe9AKKhbvjiqAYK6Z
EmXfLkuvuO2FXwudlqg9AoGAHHsKAQFyZdVGlaPY2cE7cqoQbk3ih/0g0mEs3Nlq
XqFGLu4+AOoDLf5zSo6zdLZYAXK3/B/PQXi1Mb7yuzFf0L9flMnz7inYXbCVmZ0b
ShE8VPIFrNqU4kTR7XE4Ckbw1N5afrHqkxXLGUcnvmgtJvnFSHo9kxcLVNEaN9Ba
/CsCgYA3xCp5THCtBLpEphP1oIixIYdERHpHOLdL+rQM5LUtvAZ02pHj0GfBaRtQ
i5Rs2wbigmbY2dZJotWY/WZRXQvUgsiyyhzPthw8JI7ZuNQsHBMFmhRXZJ7xHb4v
hPPRpP/XuhKVxqWiROcBnRDt8vK+Bh47jFWDZViO7N/n70RllQ==
-----END RSA PRIVATE KEY-----
[root@master .ssh]#

6)open new session in mofa-xterm in windows and do  below six steps for key less authentication

   i) create a .ssh directory in home folder
          #mkdir ~/.ssh
   2) create a private authantication key file in .pem file format
          #vi ~/.ssh/master.pem
   3) copy the above step 5 private key from Begin line to end line in to ~/.ssh/master.pem

   4) just verify the key file
           #cat  ~/.ssh/master.pem
             -----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQEA9vrrNhbh9qjagzn+s88C4Jlpp1H2ABZ+h2ExN3uvRAi0mHd7
Jgm+T1ank9Tr2H6DwEDoSyAIckaVtroJnA66vYbG8qvHjaRuQzH+a/voL6647xXX
TirmlPexiVE8kGmRu04nVy9rmgvbWcLXwVXX3LNjECh3ejmTUFTPAb0Uu5UkemxN
37ixedJ3YKPQ5P5WydWautlnrjPrZKwY0bk2qPyZp8ZiL8CKTZge+CIoSV3td6++
FRAwxYV3yZFa7u8wrNRkgyW/3sS154KCPgaEJ8m1khu9BwemWYX+uhxGyhSZMRus
Qn5oZOJFj5zhc7q7AX2X36wYj3015teC/gfdWwIBIwKCAQEAok0e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CsCgYA3xCp5THCtBLpEphP1oIixIYdERHpHOLdL+rQM5LUtvAZ02pHj0GfBaRtQ
i5Rs2wbigmbY2dZJotWY/WZRXQvUgsiyyhzPthw8JI7ZuNQsHBMFmhRXZJ7xHb4v
hPPRpP/XuhKVxqWiROcBnRDt8vK+Bh47jFWDZViO7N/n70RllQ==
-----END RSA PRIVATE KEY-----

  5)change the file permission read and write only for user

     #chmod 600 ~/.ssh/master.pem

  6) create a login config file for ssh

     #vi ~/.ssh/config
     
      host master
      hostname 192.168.0.30
      user root
      IdentityFile ~/.ssh/master.pem

7)run below command it will take  to your linux box (192.168.0.30) without any key

    #ssh master

Tuesday, July 30, 2013

Weblogic Admin server startup service script

1) create a file in this path   /opt/init.d/wlsdomains

2)copy the below script
#!/bin/bash
#
# Weblogic Admin Server Startup Script
#
# chkconfig: 345 94 06
# description: Weblogic
# processname: Java

# Source function library
. /etc/rc.d/init.d/functions

WLS_HOME=/opt/apps/wls/Oracle/Middleware/
WLS_USER=wlsadmin
DOMAIN_HOME=/opt/apps/wls/domains
DOMAIN=test
#set the return value of the script to 0, which means no error.
RETVAL=0

prog="WebLogic Admin Server"
PIDFILE=$DOMAIN_HOME/$DOMAIN/wls_pid

function pidfile()
{
    PID=`cat $PIDFILE`
    echo "PID=$PID"
}

start() {
echo -n $"Starting $prog: "
nohup su - $WLS_USER -c $DOMAIN_HOME/$DOMAIN/startWebLogic.sh  > /tmp/$DOMAIN.log &
echo $! > $PIDFILE
echo "Starting $prog: $DOMAIN.... OK"
}

stop() {
echo -n $"Stopping $prog: "
nohup su - $WLS_USER -c $DOMAIN_HOME/$DOMAIN/bin/stopWebLogic.sh > /tmp/$DOMAIN.log &
echo "Shutting down $prog: $DOMAIN... OK"
rm -rf $PIDFILE
}

restart() {
  stop
  sleep 10
  start
}

reload() {
        restart
}

case "$1" in
start)
        start
pidfile
        ;;
stop)
pidfile
stop
        ;;
reload)
        reload
        ;;
restart)
        restart
        ;;
status)
#STATUS=`ps -ef | grep java | grep weblogic | wc -l`
PID=`cat $PIDFILE`
if `ps -p $PID > /dev/null`; then
             echo "$prog: $DOMAIN is running, PID=$PID ok."
        else
             echo "$prog: $DOMAIN is not running ..."
        fi
;;
*)

echo $"Usage: $prog {start|stop|status|restart|reload}"
esac

exit 1

3) chang the file permission
  #chmod  +x /etc/init.d/wlsdomains

4) add in to service 
  #cd /etc/init.d
  #chconfig --add wlsdomains
  #chkconfig wlsdomains on
  #service wlsdomains start