Showing posts with label LINUX. Show all posts
Showing posts with label LINUX. Show all posts

Thursday, April 21, 2016

How To Create Local YUM Repository On RHEL 6

In this post, I will by showing how to create a yum local repository on RHEL 6


1) You must be having a RHEL cd with you for creating the YUM repository
-- Load the physical CD to your CD ROM, In case its a physical server, Mount the CD into a mount point (/mnt/cdrom)
-- In my case it is a VM so I have an ISO image (Virtual CD), which is loaded and mounted into a mount point (/mnt/cdrom)

[root@ajithpathiyil_MT1 rhel64]# cd /mnt/cdrom
[root@ajithpathiyil_MT1 cdrom]# ls -ltr
total 723
-rw-r--r-- 1 root root   1397 Jan 20  2011 RPM-GPG-KEY-oracle
-rw-r--r-- 1 root root   7897 Jan 20  2011 README-en.html
-rw-r--r-- 1 root root  18390 Jan 20  2011 GPL
-rw-r--r-- 1 root root   1397 Jan 20  2011 RPM-GPG-KEY
-rw-r--r-- 1 root root  22343 Jan 20  2011 RELEASE-NOTES-en
-rw-r--r-- 1 root root   3547 Jan 20  2011 README-en
-rw-r--r-- 1 root root   3334 Jan 20  2011 eula.py
-rw-r--r-- 1 root root   7041 Jan 20  2011 eula.en_US
-rw-r--r-- 1 root root   6830 Jan 20  2011 EULA-rw
-r--r-- 1 root root   5165 Jan 20  2011 blafdoc.css
-rw-r--r-- 1 root root    105 Jan 20  2011 supportinfo
-rw-r--r-- 1 root root  53377 Jan 20  2011 RELEASE-NOTES-en.html
drwxr-xr-x 4 root root 583680 Jan 20  2011 Server
drwxr-xr-x 3 root root   2048 Jan 20  2011 Cluster
drwxr-xr-x 3 root root   4096 Jan 20  2011 ClusterStorage
drwxr-xr-x 3 root root   8192 Jan 20  2011 VT
drwxr-xr-x 2 root root   2048 Jan 20  2011 isolinux
drwxr-xr-x 4 root root   2048 Jan 20  2011 images
-r--r--r-- 1 root root   4436 Jan 20  2011 TRANS.TBL

[root@ajithpathiyil_MT1 cdrom]# cd Server
[root@ajithpathiyil_MT1 Server]# ls -ltr
total 3359313
-rw-r--r-- 1 root root   168842 Apr  9  2009 munzip-5.52-3.0.1.el5.x86_64.rpm
-rw-r--r-- 1 root root    21468 Aug 26  2010 mirqbalance-0.55-16.el5.x86_64.rpm
-rw-r--r-- 1 root root    31791 Aug 28  2010 mmcelog-0.9pre-1.30.el5.x86_64.rpm
-rw-r--r-- 1 root root  2017333 Aug 28  2010 mnet-snmp-devel-5.3.2.2-9.0.1.el5_5.1.i386.rpm
-rw-r--r-- 1 root root  1336489 Aug 28  2010 mnet-snmp-libs-5.3.2.2-9.0.1.el5_5.1.i386.rpm
-rw-r--r-- 1 root root   735231 Aug 28  2010 mnet-snmp-5.3.2.2-9.0.1.el5_5.1.x86_64.rpm
..
..
..
..
..
..
..
-rw-r--r-- 1 root root   312714 Nov 17  2010 mjdom-javadoc-1.0-4jpp.1.x86_64.rpm
-rw-r--r-- 1 root root    14449 Nov 17  2010 mfinger-server-0.17-32.2.1.1.x86_64.rpm
-rw-r--r-- 1 root root    74271 Nov 17  2010 mxorg-x11-xfs-1.0.2-4.x86_64.rpm
-rw-r--r-- 1 root root     9901 Nov 17  2010 mxorg-x11-drv-dmc-1.1.0-2.x86_64.rpm
-r--r--r-- 1 root root   805397 Jan 20  2011 TRANS.TBL
[root@ajithpathiyil_MT1 cdrom]#

2) Make a local directory and copy the contents of (/mnt/cdrom/Server) to this newly created local directory

[root@ajithpathiyil_MT1 cdrom]# mkdir -p /opt/yum/rhel64
[root@ajithpathiyil_MT1 cdrom]# cd /opt/yum/rhel64


[root@ajithpathiyil_MT1 Server]# cp -a *.rpm /opt/yum/rhel64/
[root@ajithpathiyil_MT1 Server]# uname -a
Linux ajithpathiyil_MT1.lab.com 2.6.32-100.26.2.el5 #1 SMP Tue Jan 18 20:11:49 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

3) Copy the comps-rhel5-server-core.xml file to your local directory as (/opt/yum/rhel64/repodata/comps.xml)

[root@ajithpathiyil_MT1 Server]# cd ..
[root@ajithpathiyil_MT1 Server]# cd repodata
[root@ajithpathiyil_MT1 repodata]# mkdir -p /opt/yum/rhel64/repodata
[root@ajithpathiyil_MT1 repodata]# ls -ltr *comps*xml
-rw-r--r-- 1 root root 1067627 Jan 20  2011 comps-rhel5-server-core.xml
[root@ajithpathiyil_MT1 repodata]# cp *comps*xml /opt/yum/rhel64/repodata/comps.xml

4) Install the createrepo-0.4.11-3.el5.noarch rpm if not installed already.

[root@ajithpathiyil_MT1 repodata]# cd /opt/yum/rhel64/
[root@ajithpathiyil_MT1 rhel64]# rpm -ivh create*
warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing..#################################################################################[100%]
       package createrepo-0.4.11-3.el5.noarch is already installed
[root@ajithpathiyil_MT1 rhel64]# createrepo -g repodata/comps.xml .
                                                                               
1/3247 - cdparanoia-alpha9.8-27.2.x86_64.rpm
                                                                               
2/3247 - libXfixes-4.0.1-2.1.i386.rpm
                                                                               
3/3247 - libdmx-1.0.2-3.1.i386.rpm
                                                                               
4/3247 - smartmontools-5.38-2.el5.x86_64.rpm
                                                                                
5/3247 - nss_ldap-253-37.el5.i386.rpm
..                                                                             
..
..
..
..
..
..
..
3242/3247 - libsoup-devel-2.2.98-2.el5_3.1.x86_64.rpm
                                                                               
3243/3247 - perl-5.8.8-32.0.1.el5_5.2.x86_64.rpm
                                                                               
3244/3247 - mesa-libGL-devel-6.5.1-7.8.el5.x86_64.rpm
                                                                               
3245/3247 - eel2-devel-2.16.1-1.el5.x86_64.rpm
                                                                               
3246/3247 - adaptx-javadoc-0.9.13-3jpp.1.x86_64.rpm
                                                                               
3247/3247 - ipa-pmincho-fonts-003.02-2.1.el5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata

5) Create a local repository file

[root@ajithpathiyil_MT1 rhel64]# cat /etc/yum.repos.d/rhel-local.repo
name=RHEL 6.4 local repository
baseurl=file:///opt/yum/rhel64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@ajithpathiyil_MT1 rhel64]#

[root@ajithpathiyil_MT1 rhel64]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything
root@ajithpathiyil_MT1:/opt/yum/rhel64
[root@ajithpathiyil_MT1 rhel64]#

6) Load the local repository with all the RPMs, Beautifully loading the local repository.


[root@ajithpathiyil_MT1 rhel64]# yum repolist
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
rhel6.4-local                                                  | 1.1 kB     00:00    
rhel6.4-local/primary                                          | 1.4 MB     00:00    

rhel6.4-local: [                                                          ] 1/3247
rhel6.4-local: [#                                                         ] 33/3247
rhel6.4-local: [###                                                       ] 99/3247
rhel6.4-local: [#####                                                     ] 166/3247
rhel6.4-local: [########                                                  ] 266/3247
rhel6.4-local: [##########                                                ] 332/3247
rhel6.4-local: [############                                              ] 398/3247
rhel6.4-local: [##############                                            ] 464/3247
rhel6.4-local: [################                                          ] 531/3247
....................................................................................
....................................................................................
....................................................................................
rhel6.4-local: [######################################################    ] 3114/3247
rhel6.4-local: [########################################################  ] 3181/3247
rhel6.4-local: [##########################################################] 3246/3247
rhel6.4-local                                                               3247/3247
repo id                                   repo name                         status
rhel6.4-local                             RHEL 6.4 local repository         enabled: 3,247
repolist: 3,247
root@ajithpathiyil_MT1:/opt/yum/rhel64
[root@ajithpathiyil_MT1 rhel64]#

Thursday, November 6, 2014

Extending Or Resizing root (/) File System in Linux



Recently, I wanted add some additional space to the root file system of 30GB in one of my virtual machine, and this is how I did that, It might be helpful for someone who is trying to do the same.




1) Logged into the linux box to check if the new device is added properly.



2) Create new partition to the newly added device (/dev/sdb).



3) Verify the new Linux LVM partition created on the new disk (/dev/sdb)


4)  Check the details of the existing volume group & its name.



 5) Create a physical volume on the newly partitioned device (/dev/sdb)


  No change seen yet..


6) Extend the volume group with the newly added disk space.


7) We are able to see the physical volume added to the volume group now










8) Extend the logical volume using below command




9) Resize the filesystem with below command.


10) Now, as required our root(/) filesystem size is increased.






HAPPY LEARNING!

Monday, May 26, 2014

Understanding CPU Utilization & CPU Capacity


Hi Friends,

Recently, I had an opportunity to attend the Online trainings provided by "OraPub © OnlineInstitute"

 All the seminars are fast-paced one hour seminars segmented into 8 to 10 digestible modules for Oracle DBAs and Developers designed and presented by Craig Shallahamer.
 
I would strongly recommend these seminars for all DBAs & SysAdmins who wants to become a super DBA/SysAdmin. I am hereby sharing the power packed sample of how Craig Shallahamer explains the contents to us. End of the day, You will feel like a mathematician playing with numbers.

(1) What Is Utilization?














Utilization (U) = Requirement(R)/Capacity(C)  = 500ML/700ML = 0.71  = 71% 
(The glass seems to be filled by 71%, The pic is for representation only)




Busy%                               +                        idle%   = 100
User % + System%                    +                         wio%   = 100
User%  +  Nice%     +  System%      +        Steal%     +     wio%   = 100

  • NICE TIME= When a process is nice-ed, its priority is large-ed, So it is nicer to other processes
  • STEAL TIME=Virtual machine has stolen or given more time from another VM
  • IDLE TIME= CPUs are idle sometimes waiting for an IO (wio)
(2)  Where OS tools Collect Performance Data?

Common OS tools:-
Note:- SAR is not default, systat rpm should be install.
•sar -u 3 9
•vmstat 3 9
•top
Where do these tools get the raw data from?
strace vmstat 2 3

•For IO    - IOSTAT
•For Memory  - SAR
•For Network  -NETSTAT


(3) How Oracle Database Collects The Server Metrics?

       STRACE is a debugging utility for Linux and some other Unix-like systems to monitor the system calls used by a program and all the signals it receives, similar to "truss" utility in other Unix systems. This is made possible by a kernel feature known as ptrace.
        
       MMNL The Memory Monitor Light (MMNL) process is a new process from 10g and higher versions which works with the Automatic Workload Repository new features (AWR) to write out full statistics buffers to disk as needed. 
[ajithpathiyil1:oracle]> ps -ef|grep mnl
oracle  3334     1   0   Mar 22 ?         188:00 ora_mmnl_ajithrac1
oracle 21355 16615   0 08:26:34 pts/15      0:00 grep mnl
[ajithpathiyil1:oracle]>

[ajithpathiyil1:oracle]> strace -p 3334 3>&1 2>&1 |grep '/proc/stat'
       The file number was 15 and the reopen cycled every 15 seconds
[ajithpathiyil1:oracle]> strace -p 3334 3>&1 2>&1 |grep 'read(15, "cpu'
       The file number was 15 and the read occured every 15 seconds


(4) Simulate SAR – Using /proc FS


#/bin/ksh
#Sample Shell Script :- cpuinfo.sh
#Usage:-  [ajithpathiyil1:oracle]>  ./cpuinfo.sh
#Author:- Craig Shallahamer

interval=$1
echo "user nice system wio idle“
while [ 1 = 1 ]
do
cpu_all_t0=`cat /proc/stat |head -1`
cpu_usr_t0=`echo $cpu_all_t0 |awk'{print $2}'`
cpu_nic_t0=`echo $cpu_all_t0 |awk'{print $3}'`
cpu_sys_t0=`echo $cpu_all_t0 |awk '{print $4}'`    
cpu_idl_t0=`echo $cpu_all_t0 |awk '{print $5}'`
cpu_wio_t0=`echo $cpu_all_t0 |awk '{print $6}'`
sleep $interval
cpu_all_t1=`cat/proc/stat |head -1`
cpu_usr_t1=`echo $cpu_all_t1 | awk '{print $2}'`
cpu_nic_t1=`echo $cpu_all_t1 | awk '{print $3}'`
cpu_sys_t1=`echo $cpu_all_t1 | awk '{print $4}'`
cpu_idl_t1=`echo $cpu_all_t1 | awk '{print $5}'`
cpu_wio_t1=`echo $cpu_all_t1 | awk '{print $6}'`
usr=`echo $cpu_usr_t1-$cpu_usr_t0 | bc`
nic=`echo $cpu_nic_t1-$cpu_nic_t0 | bc`
sys=`echo $cpu_sys_t1-$cpu_sys_t0 | bc`
idl=`echo $cpu_idl_t1-$cpu_idl_t0 | bc`
wio=`echo $cpu_wio_t1-$cpu_wio_t0 | bc`
tot=`echo $usr+$nic+$sys+$idl+$wio | bc`
usr_pct=`echo "scale=2;$usr/$tot" | bc`
nic_pct=`echo "scale=2;$nic/$tot" | bc`
sys_pct=`echo "scale=2;$sys/$tot" | bc`
idl_pct=`echo "scale=2;$idl/$tot" | bc`
wio_pct=`echo "scale=2;$wio/$tot" | bc`
echo "$usr_pct  $nic_pct  $sys_pct  $idl_pct  $wio_pct"
done
  
(5) Calculating OS CPU Utilization: OraPub Core Method

       OS CPU Utilization using the core method completely from v$ views especially v$osstat.
U=R/C
1 CPU core,   1 minute =   60    Secs
1 CPU core,   2 minute =   120  Secs
2 CPU cores, 1 minute =   120  Secs
2 CPU cores, 2 minute =    240 Secs

       CAPACITY
Elapsed Time(Duration) X CPU cores = Capacity
12 X 3600 Secs               = 43200 sec (Of CPU)
24 x 60 X 60 Secs/min     = 86400 sec (Of CPU)

       REQUIREMENTS
AWR Report = NUM_CPUS & ELAPSED (60 Mins or 3600 Secs)
num_cpus, cpu_cores, cpu_sockets, vcpus, lcpus, num_cores, num_threads
Note:- AWR- OS Statistics - BUSY_TIME (in centiseconds) divide by 100 to get in secs



 

Utilization            = Requirements / Capacity

                           = time used / time available

* time used         = v$osstat.busy_time /100

                                  = 1913617 cs / 100 = 19136 seconds

                                               

* time available = duration X v$osstat.num_cpus
                           = 60 min X 60 sec/min X 24
                                   = 86400 sec

U   = 19136 sec / 86400 sec
      = 0.22
      = 22%  (Average CPU utilization for that 60 min of AWR data)
 



 

(5) Calculating OS CPU Utilization : OraPub Busy:Idle Method

Utilization        = Requirements / capacity
                        = time used / time available

* time used       = v$osstat.busy_time
                                    = 1913617 cs

* time available           = v$osstat.busy_time + v$osstat.idle_time
                        = 1913617 cs + 7159367 cs
                        = 9072984 cs

Utilization        = 1913617 cs / 9072984 cs
                        = 0.21
                        = 21%
Source: Delta values from v$osstat found in all AWR reports
This is Interesting. Just watch this J
1,913,617/(1,913,617 + 7,159,367) = 0.21
1,913/(1,913 + 7,159) = 0.21
19/(19 + 72) = 0.21
 
 

(6) Find The True Units of Power In DB Server

True units of power in DB server
U    = R/C
       = busy_time/(busy_time+idle_time)

            - Formula used by OraPub Core method
       = busy_time/(duration X units_of_power) 
            - Formula used by OraPub Busy-Idle method
                       
units_of_power = busy_time+idle_time/duration


\

 

If you notice carefully, NUM_CPUS seems to be the actual unit of power in your server.

HAPPY LEARNING!