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

Tuesday, September 13, 2011

Linux - system analysis/debugging

Useful for finding out bottlenecks -    disk/storage, CPU, memory, network

#top
#vmstat; vmstat -m; vmstat -a
# w username
# uptime
# ps -A; ps -Al
# ps -AlF; ps -AlFH; ps -AlLm
# ps ax; ps axu; ps axjf
# ps -ejH
# pstree
# ps -eo euser,ruser,suser,fuser,f,comm,label    ###show Security info
# ps axZ
# ps -eM
# ps -U -u u

Set Output In a User-Defined Format
# ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
# ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
# ps -eopid,tt,user,fname,tmout,f,wchan

Display Only The Process IDs of process-name
# ps -C process-name -o pid=
OR
# pgrep process-name

# ps -p -o comm=      ###show the Name of PID
# ps -auxf | sort -nr -k 4 | head -10    ###Top 10 Memory Consuming Process
# ps -auxf | sort -nr -k 3 | head -10    ###10 CPU Consuming Process
#free - Memory Usage

Monday, September 12, 2011

Creating local yum repositories using ISO files

Create repository location (any suitable location) and change directory
#mkdir -p /var/ftp/pub/yumrepo
#cd /var/ftp/pub/yumrepo

Create directory for RPM packages
#mkdir CentOS
Create mount point for ISO disks
#mkdir disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8

Mount ISO disks and loop
#mount -r -o loop  disk1
... 
#mount -r -o loop  disk8 


Copy RPM packages 
#cp disk*/CentOS/* .
#cp disk1/repodata/comps.xml   .


Install createrepo package
#rpm -Uvh CentOS/createrepo*


Create repository
#createrepo -g comps.xml   .

Configure yum to use the newly created repo. Can use command line or GUI