Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, 27 September 2017

Removing OpenJDK and Installing Oracle JDK in Linux step by step

[root@oel641 ~]# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.0.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

[root@oel641 ~]# yum remove java*
Loaded plugins: refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6 will be erased
--> Processing Dependency: java-gcj-compat for package: 1:ecj-3.4.2-6.el6.x86_64
--> Processing Dependency: java-gcj-compat for package: 1:ecj-3.4.2-6.el6.x86_64
--> Processing Dependency: java-gcj-compat >= 1.0.70 for package: sinjdoc-0.5-9.1.el6.x86_64
--> Processing Dependency: java-gcj-compat >= 1.0.70 for package: sinjdoc-0.5-9.1.el6.x86_64
---> Package java-1.5.0-gcj-devel.x86_64 0:1.5.0.0-29.1.el6 will be erased
---> Package java-1.5.0-gcj-javadoc.x86_64 0:1.5.0.0-29.1.el6 will be erased
---> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.50.1.11.5.0.1.el6_3 will be erased
---> Package java-1.6.0-openjdk-devel.x86_64 1:1.6.0.0-1.50.1.11.5.0.1.el6_3 will be erased
---> Package java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.0-1.50.1.11.5.0.1.el6_3 will be erased
---> Package java-1.7.0-openjdk.x86_64 1:1.7.0.9-2.3.4.1.0.1.el6_3 will be erased
---> Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.9-2.3.4.1.0.1.el6_3 will be erased
---> Package java_cup.x86_64 1:0.10k-5.el6 will be erased
---> Package javassist.noarch 0:3.9.0-6.el6 will be erased
--> Running transaction check
---> Package ecj.x86_64 1:3.4.2-6.el6 will be erased
---> Package sinjdoc.x86_64 0:0.5-9.1.el6 will be erased
--> Processing Dependency: /usr/share/java/eclipse-ecj.jar for package: gcc-java-4.4.7-3.el6.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package gcc-java.x86_64 0:4.4.7-3.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                              Arch             Version                                      Repository                                                     Size
========================================================================================================================================================================
Removing:
 java-1.5.0-gcj                       x86_64           1.5.0.0-29.1.el6                             @hclrepo                                                      159 k
 java-1.5.0-gcj-devel                 x86_64           1.5.0.0-29.1.el6                             @hclrepo                                                       57 k
 java-1.5.0-gcj-javadoc               x86_64           1.5.0.0-29.1.el6                             @hclrepo                                                      236 M
 java-1.6.0-openjdk                   x86_64           1:1.6.0.0-1.50.1.11.5.0.1.el6_3              @hclrepo                                                       81 M
 java-1.6.0-openjdk-devel             x86_64           1:1.6.0.0-1.50.1.11.5.0.1.el6_3              @hclrepo                                                       33 M
 java-1.6.0-openjdk-javadoc           x86_64           1:1.6.0.0-1.50.1.11.5.0.1.el6_3              @hclrepo                                                      232 M
 java-1.7.0-openjdk                   x86_64           1:1.7.0.9-2.3.4.1.0.1.el6_3                  @anaconda-OracleLinuxServer-201302251503.x86_64/6.4            89 M
 java-1.7.0-openjdk-devel             x86_64           1:1.7.0.9-2.3.4.1.0.1.el6_3                  @hclrepo                                                       36 M
 java_cup                             x86_64           1:0.10k-5.el6                                @hclrepo                                                      544 k
 javassist                            noarch           3.9.0-6.el6                                  @hclrepo                                                      631 k
Removing for dependencies:
 ecj                                  x86_64           1:3.4.2-6.el6                                @hclrepo                                                      7.3 M
 gcc-java                             x86_64           4.4.7-3.el6                                  @hclrepo                                                      9.3 M
 sinjdoc                              x86_64           0.5-9.1.el6                                  @hclrepo                                                      2.3 M

Transaction Summary
========================================================================================================================================================================
Remove       13 Package(s)

Installed size: 726 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : java-1.5.0-gcj-devel-1.5.0.0-29.1.el6.x86_64                                                                                                        1/13
  Erasing    : java-1.5.0-gcj-javadoc-1.5.0.0-29.1.el6.x86_64                                                                                                      2/13
  Erasing    : javassist-3.9.0-6.el6.noarch                                                                                                                        3/13
  Erasing    : 1:java-1.6.0-openjdk-javadoc-1.6.0.0-1.50.1.11.5.0.1.el6_3.x86_64                                                                                   4/13
  Erasing    : 1:java-1.7.0-openjdk-devel-1.7.0.9-2.3.4.1.0.1.el6_3.x86_64                                                                                         5/13
  Erasing    : 1:java-1.7.0-openjdk-1.7.0.9-2.3.4.1.0.1.el6_3.x86_64                                                                                               6/13
  Erasing    : gcc-java-4.4.7-3.el6.x86_64                                                                                                                         7/13
  Erasing    : 1:ecj-3.4.2-6.el6.x86_64                                                                                                                            8/13
  Erasing    : 1:java_cup-0.10k-5.el6.x86_64                                                                                                                       9/13
  Erasing    : sinjdoc-0.5-9.1.el6.x86_64                                                                                                                         10/13
  Erasing    : java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64                                                                                                             11/13
  Erasing    : 1:java-1.6.0-openjdk-devel-1.6.0.0-1.50.1.11.5.0.1.el6_3.x86_64                                                                                    12/13
  Erasing    : 1:java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.0.1.el6_3.x86_64                                                                                          13/13
  Verifying  : 1:java-1.6.0-openjdk-javadoc-1.6.0.0-1.50.1.11.5.0.1.el6_3.x86_64                                                                                   1/13
  Verifying  : javassist-3.9.0-6.el6.noarch                                                                                                                        2/13
  Verifying  : sinjdoc-0.5-9.1.el6.x86_64                                                                                                                          3/13
  Verifying  : 1:java-1.7.0-openjdk-devel-1.7.0.9-2.3.4.1.0.1.el6_3.x86_64                                                                                         4/13
  Verifying  : java-1.5.0-gcj-devel-1.5.0.0-29.1.el6.x86_64                                                                                                        5/13
  Verifying  : gcc-java-4.4.7-3.el6.x86_64                                                                                                                         6/13
  Verifying  : 1:java_cup-0.10k-5.el6.x86_64                                                                                                                       7/13
  Verifying  : java-1.5.0-gcj-javadoc-1.5.0.0-29.1.el6.x86_64                                                                                                      8/13
  Verifying  : 1:java-1.6.0-openjdk-devel-1.6.0.0-1.50.1.11.5.0.1.el6_3.x86_64                                                                                     9/13
  Verifying  : 1:java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.0.1.el6_3.x86_64                                                                                          10/13
  Verifying  : 1:ecj-3.4.2-6.el6.x86_64                                                                                                                           11/13
  Verifying  : 1:java-1.7.0-openjdk-1.7.0.9-2.3.4.1.0.1.el6_3.x86_64                                                                                              12/13
  Verifying  : java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64                                                                                                             13/13

Removed:
  java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6                                          java-1.5.0-gcj-devel.x86_64 0:1.5.0.0-29.1.el6
  java-1.5.0-gcj-javadoc.x86_64 0:1.5.0.0-29.1.el6                                  java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.50.1.11.5.0.1.el6_3
  java-1.6.0-openjdk-devel.x86_64 1:1.6.0.0-1.50.1.11.5.0.1.el6_3                   java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.0-1.50.1.11.5.0.1.el6_3
  java-1.7.0-openjdk.x86_64 1:1.7.0.9-2.3.4.1.0.1.el6_3                             java-1.7.0-openjdk-devel.x86_64 1:1.7.0.9-2.3.4.1.0.1.el6_3
  java_cup.x86_64 1:0.10k-5.el6                                                     javassist.noarch 0:3.9.0-6.el6

Dependency Removed:
  ecj.x86_64 1:3.4.2-6.el6                            gcc-java.x86_64 0:4.4.7-3.el6                            sinjdoc.x86_64 0:0.5-9.1.el6

Complete!
[root@oel641 ~]# java -version
-bash: /usr/bin/java: No such file or directory
[root@oel641 ~]#


Install the Oracle JDK:

[root@oel641 repo]# cd /dumps/
[root@oel641 dumps]# ll
total 2146584
-rwxr-xr-x. 1 root root  122639592 Mar 11  2014 jdk-7u51-linux-x64.rpm
-rwxr-xr-x. 1 root root 1068506707 Sep 22 00:13 wls1036_generic.jar

[root@oel641 dumps]# rpm -ivh jdk-7u51-linux-x64.rpm
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...
[root@oel641 dumps]#
[root@oel641 dumps]#

[root@oel641 dumps]# javac -version
javac 1.7.0_51

[root@oel641 dumps]# java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

Tuesday, 26 September 2017

Create yum repository in Linux step by step

Create yum repository

  • mkdir /repo (repository folder where we will copy packages from dvd)
  • cp /media/Server/Packages/*.rpm    /repo/
  • cd /etc/yum.repos.d
  • vi hcl.repo
          [hclrepo]
          name=repo from RHEL iso
          baseurl=file:///repo
          ##path of location folder. in my case it is /repo
          ##http://
          ##ftp://192.168.1.1
          enable=1
          gpgcheck=0
          #0- will not check digitally signed or not
          #1- every time it will check digitally signed

cd /repo
Install create repo package:-
rpm -ivh ./deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
rpm -ivh ./python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
rpm -ivh ./createrepo-0.9.9-17.el6.noarch.rpm

  • createrepo /repo - this will create repository.
  • yum clean all - clear cache.
  • yum update 
  • yum repolist - this will load all the repositories available on the server.
  • yum -y install kdebase - if you want to set default answer "Y" for package installation.
  • yum install
  • yum install vsftpd

Thursday, 6 April 2017

How to change server host name in linux

1.  /etc/hosts

192.168.1.1     oel6.localdomain      oel6

2. /etc/sysconfig/network

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME="oel6.localdomain"
GATEWAY="192.168.1.1"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"

3. Set hostname
echo "oel6.localdomain" > /proc/sys/kernel/hostname


4. Restart Network Service
service network restart
  

The primary network configuration files are as follows:

/etc/hosts
The main purpose of this file is to resolve host names that cannot be resolved any other way.
It can also be used to resolve host names on small networks with no DNS server.
Regardless of the type of network the computer is on, this file should contain a line specifying the IP address of the loopback device (127.0.0.1) as localhost.localdomain.


/etc/resolv.conf
This file specifies the IP addresses of DNS servers and the search domain. Unless configured to do otherwise, the network initialization scripts populate this file. For more information about this file, see the resolv.conf(5) manual page.

/etc/sysconfig/network
This file specifies routing and host information for all network interfaces. It is used to contain directives which are to have global effect and not to be interface specific. For more information about this file and the directives it accepts, see Section D.1.13, “/etc/sysconfig/network”.

/etc/sysconfig/network-scripts/ifcfg-interface-name
For each network interface, there is a corresponding interface configuration script. Each of these files provide information specific to a particular network interface.


To permanently change the static host name, change the HOSTNAME directive in the /etc/sysconfig/network file. For example:

HOSTNAME=oel641.sg.com

To change the host name using the /etc/hosts file, add lines to it in the following format:
192.168.1.1 oel641.sg.co.in oel641

i.e.
# Public
192.168.1.101    oel641.sg.co.in        oel641
192.168.1.102    oel642.sg.co.in        oel642

# Virtual
192.168.1.103    oel641-vip.sg.co.in    oel641-vip
192.168.1.104    oel642-vip.sg.co.in    oel642-vip

# Private
192.168.2.101    oel641-priv.sg.co.in   oel641-priv
192.168.2.102    oel642-priv.sg.co.in   oel642-priv

# SCAN
192.168.1.105   oel64-scan.sg.co.in        oel64-scan
192.168.1.106   oel64-scan.sg.co.in        oel64-scan
192.168.1.107   oel64-scan.sg.co.in        oel64-scan

Thursday, 30 March 2017

Setup Apache Server on Linux Step by Step

The Apache HTTP Server is an open-source HTTP server for modern operating systems including UNIX, Microsoft Windows, Mac OS/X and Netware. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services observing the current HTTP standards. Apache has been the most popular web server on the Internet since April of 1996.

Development:

  • Programming language: C 

Apache HTTP Server 2.4.25 is available for download from:


Setup Apache Server on Linux Step by Step

-login as root or administrator
-Download the latest release from http://httpd.apache.org/download.cgi#apache24
-/dumps/apache-server

-Extracting the source from the Apache HTTP Server tarball is a simple matter of uncompressing, and then untarring:

gzip -d httpd-2.4.25.tar.gz
tar xvf httpd-2.4.25.tar
cd httpd-2.4.25

-If PREFIX is not specified, it defaults to /usr/local/apache2.
./configure --prefix=/etc/apache2

[root@oel11 httpd-2.4.25]# ./configure --prefix=/etc/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.
Got above error.
If you are using 2.4 than you can go to apr.apache.org and download the latest apr and apr-util. unpack them and move them into the apache source file into /srclib. make sure they are named apr and apr-util not apr.x.x.x. then you can use the --with-included-apr flag
download to "/dumps/apache-server"

tar -xvzf apr-1.5.2.tar.gz
tar -xvzf apr-util-1.5.4.tar.gz
Rename apr-1.5.2 to apr and apr-util-1.5.4 to apr-util. Move it under httpd-2.4.25/srclib/ folder.
[root@oel11 httpd-2.4.25]# pwd
/dumps/apache-server/httpd-2.4.25
[root@oel11 httpd-2.4.25]# ./configure --prefix=/etc/apache2 --with-included-apr
[root@oel11 httpd-2.4.25]#
-Now you can build the various parts which form the Apache package by simply running the command:
make
-Now it's time to install the package under the configured installation PREFIX (see --prefix option above) by running:
make install
-Next, you can customize your Apache HTTP server by editing the configuration files under PREFIX/conf/.
vi /etc/apache2/conf/httpd.conf
-Now you can start your Apache HTTP server by immediately running:
/etc/apache2/bin/apachectl -k start
/etc/apache2/bin/apachectl -k stop

Install Apache 2.4.25 by rpm in linux

rpmbuild -tb apr-1.5.2.tar.bz2
rpm -ivh /root/rpmbuild/RPMS/x86_64/apr*.rpm
rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr*.rpm


[root@oeldev apache-server]# rpmbuild -tb apr-util-1.5.4.tar.bz2
error: Failed build dependencies:
        freetds-devel is needed by apr-util-1.5.4-1.x86_64
[root@oeldev apache-server]# yum install freetd
Loaded plugins: refresh-packagekit, security
Setting up Install Process
No package freetd available.
Error: Nothing to do
[root@oeldev apache-server]# rpm -ivh freetds-0.91-2.el6.x86_64.rpm
warning: freetds-0.91-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:freetds                ########################################### [100%]
[root@oeldev apache-server]# rpm -ivh freetds-devel-0.91-2.el6.x86_64.rpm
warning: freetds-devel-0.91-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:freetds-devel          ########################################### [100%]
[root@oeldev apache-server]#
[root@oel11 apache-server]# rpmbuild -tb apr-util-1.5.4.tar.bz2
[root@oeldev apache-server]# rpm -Uvh  /root/rpmbuild/RPMS/x86_64/apr-util*.rpm
Preparing...                ########################################### [100%]
   1:apr-util               ########################################### [  8%]
   2:apr-util-dbm           ########################################### [ 17%]
   3:apr-util-devel         ########################################### [ 25%]
   4:apr-util-freetds       ########################################### [ 33%]
   5:apr-util-ldap          ########################################### [ 42%]
   6:apr-util-mysql         ########################################### [ 50%]
   7:apr-util-nss           ########################################### [ 58%]
   8:apr-util-odbc          ########################################### [ 67%]
   9:apr-util-openssl       ########################################### [ 75%]
  10:apr-util-pgsql         ########################################### [ 83%]
  11:apr-util-sqlite        ########################################### [ 92%]
  12:apr-util-debuginfo     ########################################### [100%]
[root@oeldev apache-server]#
[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2

cd /root/rpmbuild/SOURCES
wget ftp://ftp.gmd.de/…/source/SRPMS/d/distcache-1.4.5-23.src.rpm
rpmbuild --rebuild distcache-1.4.5-23.src.rpm

[root@oeldev SOURCES]# rpm -ivh /root/rpmbuild/RPMS/x86_64/distcache*.rpm
Preparing...                ########################################### [100%]
   1:distcache              ########################################### [ 33%]
   2:distcache-devel        ########################################### [ 67%]
   3:distcache-debuginfo    ########################################### [100%]
[root@oeldev SOURCES]#

[root@oeldev SOURCES]# cd /dumps/apache-server/
[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2

Getting Error:

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib64/httpd/modules/mod_proxy_hcheck.so

[root@oel11 apache-server]# tar xjf httpd-2.4.25.tar.bz2

Open httpd.spec file
Add
%{_libdir}/httpd/modules/mod_proxy_hcheck.so
missing in the %dir after
%{_libdir}/httpd/modules/mod_proxy_ftp.so
Save file

[root@oel11 apache-server]# tar -cjvf httpd-2.4.25.tar.bz2 httpd-2.4.25

[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2
...
...
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-devel-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-manual-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_authnz_ldap-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_lua-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_proxy_html-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_socache_dc-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-debuginfo-2.4.25-1.x86_64.rpm


[root@oel11 apache-server]#

yum install /root/rpmbuild/RPMS/x86_64/httpd-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-devel-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-manual-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_authnz_ldap-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_lua-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_proxy_html-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_socache_dc-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-debuginfo-2.4.25-1.x86_64.rpm

Completed!

Linux File System

Every thing in unix and linux is a file. 
/   root
|_/bin/ - all the system binaries exists. i.e. cat, chgrp, chmod, cp, data, dd, df, dmesg, echo, false, hostname, kill, ln, login, ls, mkdir, mknod, more, mount, mv, ps, pwd, rm, rmdir, sed, sh, stty, su, synch, true, umount, uname.

|_/opt/ -  config file for add on application software.

|_/boot/ - static files of boot loader. i.e. kernel, sstem.map, vmlinuz, initrd, grub, module.info, boot.

|_/root/ -

|_/dev/ -all of the devices on the computer. i.e. mouse, keyboard, monitor etc.

|_/sbin/ -

|_/etc/ -host specific system config. csh.login, exports, fstab, ftpusers, gateways, gettydefs, group, host.conf, hosts, hosts.allow, hosts.deny, hosts.equiv, hosts.lpd, inetd.conf, inittab, issue, ls.so.conf, motd, mtab, mtools, networks, passwd, printcap, profile, protocols, resolv.conf, rpc, securetty, services, shells, syslog.conf.

|_/srv/ -

|_/home/ -

|_/tmp/ -

|_/lib/ -

|_/usr/ -sharable and readonly data.
        |_/local - local software
        |_/bin/ - most users command
        |_/include/
        |_/lib/    
        |_/sbin/

|_/media/

|_/var/
         |_/cache/
         |_/log/        
         |_/spool/
         |_/tmp/

|_/mnt/

Tuesday, 28 March 2017

Linux Package Management with RPM and YUM

RPM :- Redhad Package Manager

rpm just install the single rpm file. It does not take care of dependency packages.
yum take care of denpendency packages.

ftp                 = vsftpd-2.2.2-11.el6.x86_64.rpm
apache server = httpd-2.2.15-26.0.1.el6.x86_64.rpm
telnet             = telnet-0.17-47.el6_3.1.x86_64.rpm

format:
--..rpm

RPM Features


Provides package management
  • Install
  • Remove or Uninstall
  • Query 
  • Upgrade
  • Verify   
Automatically verifies packages using GPG, MD5, SHA1SUMs
Automatically reports on unresolved dependencies. 

Find out the installed packages

rpm -qa
-q = query package
-a = all installed packages

[root@oel11 yum.repos.d]# rpm -qa vsftpd
vsftpd-2.2.2-11.el6.x86_64
[root@oel11 yum.repos.d]# rpm -qa telnet
[root@oel11 yum.repos.d]#

Here vsftp returns packages that means this is installed on our server. In second command telnet doesnt returns any row and show not installed on the server.

Search specific rpm package

[root@oel11 yum.repos.d]# rpm -qa | grep vsftp
vsftpd-2.2.2-11.el6.x86_64 

[root@oel11 etc]# rpm -qa | grep httpd
httpd-manual-2.2.15-26.0.1.el6.noarch
httpd-tools-2.2.15-26.0.1.el6.x86_64
httpd-2.2.15-26.0.1.el6.x86_64

Get information about the package

rpm -qi httpd
rpm -qi httpd-2.2.15-26.0.1.el6.x86_64

[root@oel11 etc]# rpm -qi httpd-2.2.15-26.0.1.el6.x86_64
Name        : httpd                        Relocations: (not relocatable)
Version     : 2.2.15                            Vendor: Oracle America
Release     : 26.0.1.el6                    Build Date: Sat 23 Feb 2013 01:32:52 AM IST
Install Date: Tue 28 Feb 2017 01:03:23 AM IST      Build Host: ca-build44.us.oracle.com
Group       : System Environment/Daemons    Source RPM: httpd-2.2.15-26.0.1.el6.src.rpm
Size        : 3074819                          License: ASL 2.0
Signature   : RSA/8, Sat 23 Feb 2013 01:33:03 AM IST, Key ID 72f97b74ec551f03
URL         : http://httpd.apache.org/
Summary     : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.

List all files from the package

[root@oel11 yum.repos.d]# rpm -ql vsftpd-2.2.2-11.el6.x86_64
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-2.2.2
/usr/share/doc/vsftpd-2.2.2/AUDIT
/usr/share/doc/vsftpd-2.2.2/BENCHMARKS
/usr/share/doc/vsftpd-2.2.2/BUGS
/usr/share/doc/vsftpd-2.2.2/COPYING
/usr/share/doc/vsftpd-2.2.2/Changelog
/usr/share/doc/vsftpd-2.2.2/EXAMPLE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.2.2/FAQ
/usr/share/doc/vsftpd-2.2.2/INSTALL
/usr/share/doc/vsftpd-2.2.2/LICENSE
/usr/share/doc/vsftpd-2.2.2/README
/usr/share/doc/vsftpd-2.2.2/README.security
/usr/share/doc/vsftpd-2.2.2/REWARD
/usr/share/doc/vsftpd-2.2.2/SECURITY
/usr/share/doc/vsftpd-2.2.2/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.2.2/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.2.2/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.2.2/SECURITY/TRUST
/usr/share/doc/vsftpd-2.2.2/SIZE
/usr/share/doc/vsftpd-2.2.2/SPEED
/usr/share/doc/vsftpd-2.2.2/TODO
/usr/share/doc/vsftpd-2.2.2/TUNING
/usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

How to install package

rpm -ivh
-i = Install the rpm
-v = verbose 
-h = display progress

- first identify where the package exists.
- linux media contains all the packages. user can download it from internet or linux dvd.
- rpm does not install the dependency packages. for this we use yum. 

How to upgrade package

rpm -qa vsftpd
rpm -Uvh vsftpd-2.2.2-11.el6.x86_64.rpm

Erase package

rpm -e
-e = Erase the package. just give package name without ".rmp"

rpm -e vsftpd
or
rpm -e vsftpd-2.2.2-11.el6.x86_64
rpm -qa vsftpd

Check apache service status

service httpd status

Start and Enable SSH Server

chkconfig sshd on
service sshd start

Check port 22 is open

netstat -tulpn | grep :22

Start/ Stop/ Status iptables service

service iptables status
service iptables start
service iptables stop

Wednesday, 8 February 2017

Linux Kernal Parameters

These values will allow these resources to grow larger if necessary but if the resources are not requested then these larger values will not significantly impact the systems resources.

Increase the blow parameters in /etc/sysctl.conf

Use the command "ipcs -l" to show the current IPC limits.

# raise max open fd limits
fs.file-max = 65536
# use wider range for local ports
net.ipv4.ip_local_port_range = 1024 65000
# allow more/larger IPC message queues
kernel.msgmni = 1024
kernel.msgmax = 131072
kernel.msgmnb = 131072
# allow more/larger IPC shared memory blocks
kernel.shmmni = 4096
kernel.shmmax = 1073741824
kernel.shmall = 2097152
# adjust IPC semaphore settings
kernel.sem = 250 256000 64 1024   

shmmax - Maximum size of a shared memory segment. Databases like Oracle and UDB recommend that this be set to 256 Mb or 90% of memory, whichever is higher. The 2.2 Linux kernel had a limit of 1 Gb for this value.

sem - This file contains four values that correspond to:
1. maximum number of semaphores per array (semmsl on Solaris)
2. maximum number of semaphores in the system (semmns)
3. maximum operations per semop call (semopm)
4. maximum number of semaphore arrays (semmni).

msgmax - Maximum size of a message.
msgmnb - Maximum number of bytes on a message queue.
msgmni - Maximum number of message queues in the system. The value of this setting depends on the number of PeopleSoft processes that are running, in addition to what other processes are running. The value above is usually sufficient.

maxfiles - Soft file limit per process.
maxuprc - Maximum number of simultaneous user processes per userid.
nfile - Maximum number of simultaneously open files systemwide at any given time.
nproc - Maximum number of processes that can exist simultaneously in the system.
shmall - This parameter sets the total amount of shared memory pages that can be used system wide. Hence, shmall should always be at least ceil(shmmax/page_size).
shmmax - The maximum size(in bytes) of a single shared memory segment.
shmmin - The minimum size(in bytes) of a single shared memory segment.
shmmni - The number of shared memory identifiers.
shmseg - The maximum number of shared memory segments that can be attached by a process.
semmns - The number of semaphores in the system.
semmni - The number of semaphore set identifiers in the system; determines the number of semaphore sets that can be created at any one time.
semmsl - The maximum number of sempahores that can be in one semaphore set. It should be same size as maximum number of Oracle processes.

Monday, 6 February 2017

Set ulimits for root user in Linux 6 and Higher

Set ulimits for root user in Linux 6 and Higher

The difference between the hard and soft limits is that the soft limit can be changed as required by the user as long as it no larger than the hard limit which is the maximum setting allowed.

Here is defined a soft and a hard limit. The "soft limit" defines the number of file handles or open files that a user will have after login, the "hard limit" defines the maximum number of file handles (or open files) are possible for the user's shell account. If the  user gets error messages about running out of file handles, then the user can increase the number of file handles like in this example up to the "hard limit" (in this example case 63536) by executing the following command:
ulimit -n 63536

To Check Open Files
 lsof -p
"lsoft -p process_id" - Files open by process id
"lsof -u user" - Files open by user
"lsof -u user -a -i" - Open TCP and UDP sockets for the user.

Steps to set ulimits for root user:

1. Edit /etc/security/limits.d/90-nproc.conf
[root@hrmsdcapp1 security]# vi /etc/security/limits.conf
hrprd              soft    nproc   3072
hrprd              hard    nproc   16384
hrprd              soft    nofile  3072
hrprd              hard    nofile  65536
hrprd              soft    stack   10240


2. Edit /etc/security/limits.d/90-nproc.conf
[root@hrmsdcapp1 limits.d]# vi /etc/security/limits.d/90-nproc.conf
*          soft    nproc     1024
root       soft    nproc     unlimited
#nofile will effect from here for root user
root       soft    nofile    3072
root       hard    nofile    65536

3. Verify the new limits
ulimit -Hn
ulimit -Sn
ulimit -Hu
ulimit -Su

Linux Commands

OS monitoring tools: top, vmstat, iostat, mpstat, ipcs

[root@hrmsdcapp1 limits.d]# cat /etc/issue
Oracle Linux Server release 6.4
Kernel \r on an \m


[root@hrmsdcapp1 limits.d]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)


[root@hrmsdcapp1 limits.d]# uname -a
Linux hrmsdcapp1.denabank.co.in 2.6.39-400.264.13.el6uek.x86_64 #1 SMP Thu Jan 7 15:49:50 PST 2016 x86_64 x86_64 x86_64 GNU/Linux


[root@hrmsdcapp1 limits.d]# uname -r
2.6.39-400.264.13.el6uek.x86_64


To see what executable the process 1234 is running:
ls -l /proc/1234/exe
If you want to see what files that process has open:
ls -l /proc/1234/fd
If you want to see the full command line with arguments:
tr '\0' '\n' </proc/1234/cmdline 

Jenkins Startup and Configuration

Steps to setup jenkins on ubuntu:- -After installation. check the jenkins services running on not on the server. sudo service jenk...