Sunday, February 23, 2014

Linux Hardware Information Collection Command

Recently, my most job context is related to Linux CentOS and MySQL with perl and python programming. However, when I install the MySQL server, there are some command could help me get more base information from the remote server that I am dealing with:
Show kernel version and system architecture
uname -a
Show name and version of distribution
head -n1 /etc/issue
Show all partitions registered on the system
cat /proc/partitions
Show RAM total seen by the system
grep MemTotal /proc/meminfo
Show CPU(s) info
grep "model name" /proc/cpuinfo
Show info about disk sda
hdparm -i /dev/sda

And after the hardware information, we use RPM command to review the package list on this machine:
rpm -qa | grep MySQL*
rpm -qa | grep percona*

If the some RPM package is missing from your wonder list, you could use yum command (with internet connection) or download the RPM package (be careful the Kernel version and OS distribution version) and use RPM command to install those dependencies:
rpm -ivh [wonder package]
For example, we need the crontab package for doing some schedule task on specific server. However, the crontabs require the cronie as dependency and cronie require sendmail as dependency and the dependent chaining is going further to procmail. Hence, below is the demonstration for installation of procmail, sendmain and final step with install crontabs related package at once (must have, because they seem to related in a cyclic check, you could not install single one of them without two others)

[root@ServerA ~]# rpm -ivh cronie-1.4.4-7.el6.x86_64.rpm
error: Failed dependencies:
        /usr/sbin/sendmail is needed by cronie-1.4.4-7.el6.x86_64
        dailyjobs is needed by cronie-1.4.4-7.el6.x86_64
[root@ServerA ~]# rpm -ivh sendmail-8.14.4-8.el6.x86_64.rpm
error: Failed dependencies:
        procmail is needed by sendmail-8.14.4-8.el6.x86_64

[root@ServerA ~]# rpm -ivh procmail-3.22-25.1.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:procmail               ########################################### [100%]
[root@ServerA ~]# rpm -ivh sendmail-8.14.4-8.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:sendmail               ########################################### [100%]
[root@ServerA ~]# rpm -ivh cronie-anacron-1.4.4-7.el6.x86_64.rpm crontabs-1.10-33.el6.noarch.rpm cronie-1.4.4-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:crontabs               ########################################### [ 33%]
   2:cronie                 ########################################### [ 67%]
   3:cronie-anacron         ########################################### [100%]

No comments:

Post a Comment