Wednesday, January 27, 2016

Yum

                                                                  YUM 


Yum is an interactive, rpm-based package manager. It can automatically perform system updates, including dependency analysis and processing based on "repositorymetadata. It can perform installation of new packages, removal of old packages and perform queries on the installed and/or available packages among many other commands available.

The configuration file for Yum and related utilities is located at /etc/yum.conf . All the repositories new or existing are with .repo file extension under /etc/yum.repo.d/ directory.

For example I created below repo  :

[root@node4 ~]# cat /etc/yum.repos.d/maprtech.repo
[maprtech]
name=MapR Technologies
baseurl=http://package.mapr.com/releases/v4.0.1/redhat/
enabled=1
gpgcheck=0
protect=1

Here  :
Name - Human readable name of the repository
Baseurl - URL to the repodata directory ( I.e where all the rpm's are hosted )
Enabled - Enable repository when performing updates and installs (enabled=1)
Gpgcheck - Enable/disable GPG signature checking (gpgcheck=0  disables GPG-checking)
Protect - To protect a repository ( mainly protect existing package being updated from existing repo by package in Non-standard repo )


Some Common examples and tricks to use Yum :

1) List all spark packages available from repo .

[root@node4 ~]# yum list | grep mapr-spark
mapr-spark.noarch                           1.5.2.201512161339-1         maprecosystem
mapr-spark-historyserver.noarch             1.5.2.201512161339-1         maprecosystem
mapr-spark-master.noarch                    1.5.2.201512161339-1         maprecosystem

2) Erase installed/erase package with dependencies .

yum install mapr-spark  ( This will only install latest Spark version if multiple avail in Repo )
yum erase mapr-spark 

3) If you want to install specific version of spark .

a)  List all Spark package version.
[root@node4 ~]# yum --showduplicates list mapr-spark
Available Packages
mapr-spark.noarch                                                                1.0.2.201408081440-1                                                                maprecosystem 
mapr-spark.noarch                                                                1.1.0.201411081007-1                                                                maprecosystem 
mapr-spark.noarch                                                                1.2.1.201506091827-1                                                                maprecosystem 
mapr-spark.noarch                                                                1.3.1.201506011823-1                                                                maprecosystem 
mapr-spark.noarch                                                                1.4.1.201509021818-1                                                                maprecosystem 
mapr-spark.noarch                                                                1.5.2.201512161339-1                                                                maprecosystem 

b) Now if you like to install specific version of package you can append the version info to the name of the package as  yum install <package name>-<version info>

yum install mapr-spark-1.2.1.201506091827-1   ( This will install spark-1.2 instead of latest)

4) Now incase you have some repo with outdated links causing issues , we can ignore all other repo except MAPR_CORE via below command.


yum --disablerepo=* --enablerepo=MapR_CORE install mapr-fileserver 

Monday, January 25, 2016

Identify SSD drives V/S Hard disks

                                      Identify SSD drives V/S Hard disks

Quick way to identify if disks are SSD's or Hard Drives by viewing the content of /sys/block/sd*/queue/rotational file, If this file has value 1 it indicates its Hard Drive while if it has 0 for SSD's .

Like in below example sda is hard drive while sdb-sdg are SSD drives .

[root@tss2-18 ~]# ls -l /sys/block/sd*/queue/rotational
-rw-r--r-- 1 root root 4096 Jan 25 23:08 /sys/block/sda/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdb/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdc/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdd/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sde/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdf/queue/rotational
-rw-r--r-- 1 root root 4096 Dec 25 22:02 /sys/block/sdg/queue/rotational
[root@tss2-18 ~]# cat /sys/block/sd*/queue/rotational
1
0
0
0
0
0
0

Another way to find this out would be via "lsblk" command as below .

[root@tss2-18 ~]# lsblk -d -o name,rota
NAME ROTA
sdb     0
sdc     0
sdd     0
sde     0
sdf     0
sdg     0
sda     1

Note :  ROTA means rotational device  ( 1 if true, 0 if false)

For above command to work we have to make sure "util-linux" package is installed which provides "lsblk" utility .

[root@tss2-18 ~]# which lsblk
/bin/lsblk
[root@tss2-18 ~]# rpm -qf /bin/lsblk
util-linux-ng-2.17.2-12.18.el6.x86_64