Thursday, August 2, 2012

Rolling back yum packages RedHat/CentOS/Fedora


*To configure yum to save rollback information, add the line tsflags=repackage to /etc/yum.conf.

*To configure command-line rpm to do the same thing, add the line %_repackage_all_erasures 1 to /etc/rpm/macros (If does not exist, just create it).

*If/when you want to rollback to a previous state, perform an rpm update with the --rollback option followed by a date/time specified. 

Some examples: 
rpm -Uhv --rollback '10:00 am'
rpm -Uhv --rollback '6 hours ago'
rpm -Uhv --rollback 'july 25'.

enabling rollbacks will consume additional disk space in the /var filesystem.

Wednesday, August 1, 2012

Create you own repo server CentOS/RedHat/Fedora


The reposync command provides a few major advantages over an rsync based approach:
reposync uses HTTP by default, so it is easier on firewalls you probably already have outbound ports 80/443 open  reposync can use multiple mirrors, as specified in the ‘mirrorlist’ directive. So there is no longer a dependency on a single server on the remote end to be up and running Lastly, and not technically an advantage of reposync itself, but there are significantly more HTTP mirrors than rsync ones, so my reposync scripts can play nicely and distribute the load over a larger number of servers.


On your local server, install reposync


yum install yum-utils -y


For CentOS /Redhat 


# reposync --gpgcheck -l --repoid=rhel-x86_64-server-5 --download_path=/repo-rpms


# cd /repo-rpms


createrepo


Then configure the repository on the client system want to update.


For Feodra



Next, tell reposync to pull down the content


# reposync -r f16-x86-64-release -p /repo-rpms/


Lastly, recreate the yum metadata.


# createrepo /repo-rpm/f16-x86_64-release/

Monday, July 30, 2012

Openmeetings installation Redhat/CentOS/Fedora


OpenMeetings is a free browser-based software that allows you to set up instantly a conference in the Web. You can use your microphone or webcam, share documents on a white board, share your screen or record meetings. It is available as hosted service or you download and install a package on your server with no limitations in usage or users.

Make sure the following firewall ports are open
1935 (RTMP), 8088 (RTMP-Over HTTP), 5080 (HTTP), 4445 (Desktop Sharing), 8443 (RTMP over SSL)


Install the rpmforge repo 32 bit repo

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Install the rpmforge repo 64 bit repo

 rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

All of the various dependancies need to be installed

yum install -y mysql mysql-server httpd php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy phpmyadmin freetype freetype-devel fontconfig fontconfig-devel java-1.6.0-openjdk-devel libtiff libtiff-devel libjpeg-devel libjpeg giflib giflib-devel libpaper libpaper-devel xml-commons-apis libpng libpng-devel libxml2 libxml2-devel fftw3 fftw3-devel cairo cairo-devel flac flac-devel wavpack wavpack-devel libsndfile libsndfile-devel libmad libmad-devel yasm-devel yasm gcc gcc-c++  ghostscript lame swftools ImageMagick ffmpeg sox openoffice.org-base openoffice.org-headless openoffice.org-writer openoffice.org-impress openoffice.org-calc openoffice.org-headless

Edit /etc/rc.local
/usr/lib/openoffice.org3/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &
or
/usr/lib64/openoffice.org3/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

Download OpenMeetings package

cd /usr/src
wget http://code.google.com/p/openmeetings/downloads/detail?name=openmeetings_1_9_1_r4707.zip

unzip openmeetings_1_9_1_r4707.zip -d

cd /usr/src/om/webapps/openmeetings/conf
cp mysql_hibernate.cfg.xml hibernate.cfg.xml

Edit OpenMeetings config file /usr/src/om/webapps/openmeetings/conf/hibernate.cfg.xml,
add your mysql credentials (username and password).

openmeetings is the database address and name (you can create an empty database before the installation)

cd /usr/src/om
nohup ./red5.sh &

Start OpenOffice service

nohup /usr/lib/openoffice.org3/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

or

nohup /usr/lib64/openoffice.org3/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard &

To start install OpenMeetings, type in the following address
http://www.<yourdomain>.com:5080/openmeetings/install

Saturday, July 28, 2012

Turning off un-wanted services on Redhat/CentOS/Fedora


chkconfig atd  off
chkconfig auditd  off
chkconfig avahi-daemon  off
chkconfig bluetooth  off
chkconfig cgconfig  off
chkconfig cgred  off
chkconfig cups  off
chkconfig dc_client  off
chkconfig dc_server  off
chkconfig dnsmasq  off
chkconfig ebtables  off
chkconfig firstboot  off
chkconfig gpsd  off
chkconfig haldaemon  off
chkconfig ip6tables  off
chkconfig iptables   off
chkconfig irda  off
chkconfig iscsi  off
chkconfig iscsid  off
chkconfig ksm  off
chkconfig ksmtuned  off
chkconfig libvirt-guests  off
chkconfig libvirtd  off
chkconfig lvm2-monitor  off
chkconfig mdmonitor  off
chkconfig NetworkManager  off
chkconfig netconsole  off
chkconfig netfs  off
chkconfig nfs  off
chkconfig nfslock  off
chkconfig nmb  off
chkconfig ntpd  off
chkconfig ntpdate  off
chkconfig openct  off
chkconfig openvpn  off
chkconfig pcscd  off
chkconfig portreserve  off
chkconfig psacct  off
chkconfig rdisc  off
chkconfig restorecond  off
chkconfig rpcbind  off
chkconfig rpcgssd  off
chkconfig rpcidmapd  off
chkconfig rpcsvcgssd  off
chkconfig rsyslog  off
chkconfig saslauthd  off
chkconfig sendmail  off
chkconfig smb  off
chkconfig smolt  off
chkconfig snmpd  off
chkconfig speech-dispatcherd  off
chkconfig snmptrapd  off
chkconfig squid  off
chkconfig svnserve  off
chkconfig vboxdrv  off
chkconfig vboxweb-service  off
chkconfig wicd  off
chkconfig wpa_supplicant  off
chkconfig ypbind off
===========================================================

Following services for Apache and Mysql running on the same server.
chkconfig abrtd  on
chkconfig httpd  on
chkconfig network  on
chkconfig mysqld  on
chkconfig sshd  on
chkconfig udev-post  on
chkconfig xinetd on

Monday, July 16, 2012

How to track down a high server load RedHat/CentOS/Fedora/SuSe


Line 1 - General server information - Current time, uptime (since last restart of server), number of users logged on (other than yourself), and the load average for the last 1, 5, and 15 minutes
Line 2 - Tasks - Number of processes, number of actively running processes, sleeping process, stopped process, and zombie processes
Line 3 - CPU usage info (User, System, Nice, Idle, Waiting, Hardware Interrupts, Software Interrupts).  Just worry about Idle, user, system, and waiting.
Line 4 - Memory usage
Line 5 - Swap usage (used should be almost 0 if not 0)
Table header for process list (Process ID, User, Priority, Nice, Virtual Memory, Resident Size, Shared Size, , State, CPU, Memory, CPU Time used, Command)
The processes themselves



login as: root
Access denied
root@192.168.200.102's password:
Last login: Tue Jul  3 02:47:21 2012 from 192.168.200.1

[root@openstack ~]# top -b -i -n 20 >> ./server-load

[root@openstack ~]# cat server-load
top - 00:55:00 up 4 min,  3 users,  load average: 1.84, 1.09, 0.49
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  7.5%us, 20.0%sy,  0.0%ni, 58.7%id,  7.0%wa,  6.1%hi,  0.7%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23112k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203320k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2908 1020  796 R  3.7  0.1   0:00.06 top


top - 00:55:03 up 4 min,  3 users,  load average: 1.84, 1.09, 0.49
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.0%us,  8.9%sy,  0.0%ni, 86.8%id,  0.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23112k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203336k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.08 top


top - 00:55:06 up 4 min,  3 users,  load average: 1.85, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  8.7%sy,  0.0%ni, 84.7%id,  3.3%wa,  2.7%hi,  0.0%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23120k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203328k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.10 top


top - 00:55:09 up 4 min,  3 users,  load average: 1.85, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  9.6%sy,  0.0%ni, 86.0%id,  0.0%wa,  3.3%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23120k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203336k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.12 top


top - 00:55:12 up 4 min,  3 users,  load average: 1.79, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.3%us,  9.9%sy,  0.0%ni, 80.9%id,  3.3%wa,  3.3%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23128k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203328k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  1.0  0.1   0:00.15 top


top - 00:55:15 up 4 min,  3 users,  load average: 1.72, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  9.3%sy,  0.0%ni, 86.0%id,  0.0%wa,  3.7%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23128k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203336k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.17 top


top - 00:55:18 up 4 min,  3 users,  load average: 1.72, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  9.0%sy,  0.0%ni, 86.0%id,  1.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23136k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203336k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.19 top


top - 00:55:21 up 4 min,  3 users,  load average: 1.66, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.0%us,  8.6%sy,  0.0%ni, 87.1%id,  0.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23136k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203344k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  1.0  0.1   0:00.22 top


top - 00:55:24 up 4 min,  3 users,  load average: 1.66, 1.10, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  9.3%sy,  0.0%ni, 85.7%id,  1.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23144k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203348k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.24 top


top - 00:55:27 up 4 min,  3 users,  load average: 1.61, 1.10, 0.51
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  8.6%sy,  0.0%ni, 87.5%id,  0.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23144k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203348k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.26 top


top - 00:55:30 up 5 min,  3 users,  load average: 1.48, 1.08, 0.50
Tasks: 124 total,   1 running, 123 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.0%us,  8.9%sy,  0.0%ni, 85.5%id,  1.7%wa,  2.6%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488776k used,   539192k free,    23152k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203348k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  1.0  0.1   0:00.29 top


top - 00:55:33 up 5 min,  3 users,  load average: 1.48, 1.08, 0.50
Tasks: 119 total,   1 running, 118 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3%us,  9.6%sy,  0.0%ni, 86.8%id,  0.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488744k used,   539224k free,    23152k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203348k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.31 top


top - 00:55:36 up 5 min,  3 users,  load average: 1.44, 1.08, 0.51
Tasks: 120 total,   1 running, 119 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  8.7%sy,  0.0%ni, 86.0%id,  1.7%wa,  3.0%hi,  0.0%si,  0.0%st
Mem:   1027968k total,   488744k used,   539224k free,    23160k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203340k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  0.7  0.1   0:00.33 top


top - 00:55:40 up 5 min,  3 users,  load average: 1.44, 1.08, 0.51
Tasks: 120 total,   1 running, 119 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  9.6%sy,  0.0%ni, 86.5%id,  0.0%wa,  3.0%hi,  0.3%si,  0.0%st
Mem:   1027968k total,   488744k used,   539224k free,    23160k buffers
Swap:  2064380k total,        0k used,  2064380k free,   203348k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1337 root      20   0  2884 1040  812 R  1.0  0.1   0:00.36 top

[root@openstack ~]#

Friday, June 8, 2012

Run you OWNCLOUD on CentOS/REDHAT/FEDORA

  1. Install the following packages:    yum -y install httpd php php-mysql php-mbstring php-devel mysql mysql-server zlib zlib-devel pcre-devel phpmyadmin 
  2. Download ownCloud3 sources from here
  3. Extract and copy the resultant owncloud/ directory to /var/www/html
  4. ‘cd’ to /var/www/html and set appropriate permission to owncloud directory so that apache can read/write from/to it: $sudo  chown -R apache:apache owncloud/
  5. Start Apache server: $ sudo service httpd start
  6. Start MySQL server: $ sudo service mysql start and change the root password using $mysqladmin -u root password PASSWORD
  7. Create a MySQL database that you want ownCloud to use by going to: http://localhost/phpmyadmin
  8. Start ownCloud: http://localhost/owncloud and setup other users or simply start using for storing files
  9. Use PageKite to make your cloud publicly accessible as detailed here

Wednesday, May 30, 2012

Bandwidth limitation using "TC Command" RedHat /CentOS/Fedora/Ubuntu/SuSe

Use "tc" command.

# tc qdisc add dev eth0 root tbf limit 15Kb buffer 10Kb/8 rate 10Kbps

Check the configuration.

# tc -s qdisc
qdisc tbf 8001: dev eth0 root refcnt 2 rate 80000bit burst 10Kb lat 512.0ms
 Sent 994 bytes 14 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 10861 bytes 156 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 15932 bytes 100 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth3 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 1836 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0



If you want to delete the configuration, execute the following command.

# tc qdisc del dev eth0 root

Using dump/restore command do the backup and restore whole CentOS/RedHat/Fedore/SUSE/Ubuntu.


Using dump/restore command do the backup and restore whole CentOS/RedHat/Fedore/SUSE/Ubuntu.

http://dump.sourceforge.net/isdumpdeprecated.html

# cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot1            /boot                   ext3    defaults        1 2
LABEL=/data             /data                   ext3    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda5         swap                    swap    defaults        0 0


# fdisk -l
   Device Boot    Start      End    Blocks      Id  System
/dev/sda1 *           1       13    104391      83  Linux
/dev/sda2            14      1925   15358140    83  Linux
/dev/sda3          1926      3200   10241437+   83  Linux
/dev/sda4          3201      4864   13366080    5   Extended
/dev/sda5          3201      3391   1534176     82  Linux swap / Solaris


# dump -0uf - /dev/sda1 | ssh root@192.168.0.14 dd of=/tmp/sda1.dump
# dump -0uf - /dev/sda2 | ssh root@192.168.0.14 dd of=/tmp/sda2.dump
# dump -0uf - /dev/sda3 | ssh root@192.168.0.14 dd of=/tmp/sda3.dump
# dump -0uf - /dev/sda4 | ssh root@192.168.0.14 dd of=/tmp/sda4.dump
# dump -0uf - /dev/sda5 | ssh root@192.168.0.14 dd of=/tmp/sda5.dump

Restore the data

# restore -rf /sda1.dump
# restore -rf /sda2.dump
# restore -rf /sda3.dump
# restore -rf /sda4.dump
# restore -rf /sda5.dump

Live CD/rescue mode first and use fdisk to create partitions and give ip address

Create a partitions on new disk

Fdisk /dev/sda

format sda1/sda2/sda3/sda5 by using the mkfs command
# mkfs.ext3 /dev/sda1
# mkfs.ext3 /dev/sda2
# mkfs.ext3 /dev/sda3
# mkfs.ext3 /dev/sda4
# mkfs.ext3 /dev/sda5

Re-label all the partitions
# e2label /dev/sda1 /boot1
# e2label /dev/sda2 /
# e2label /dev/sda3 /data
# mkswap -L SWAP-sda5 /dev/sda5

login into 192.168.0.187, and restore sda1 from a remote 192.168.0.14 sda1.dump

# ssh 192.168.0.187 "cd /mnt/sda1 && RSH=/usr/bin/ssh restore -r -f 192.168.0.14:/tmp/sda1.dump"

Please run grub-install in rescue mode first. Install grub on /dev/sda1*

Tuesday, February 14, 2012

RedHat /CentOS Tapes MT command

Working with "mt" Commands: reading and writing to tape.

    The following assumes the tape device is "/dev/st0"

    STEP 1 ( rewind the tape)

         # mt -f /dev/nst0 rewind

    STEP 2 (check to see if you are at block 0)

         # mt -f /dev/nst0 tell
           At block 0.

    STEP 3 (Backup "tar compress"  directories "today"  and "etc")

         # tar -czf /dev/nst0 today  etc

    STEP 4 (Check to see what block you are at)

          # mt -f /dev/nst0 tell

      You should get something like block 2 at this point.

    STEP 5 (Rewind the tape)

          # mt -f /dev/nst0 rewind

    STEP 6 (List the files)

          # tar -tzf /dev/nst0
             today/
             etc/
             
    STEP 7 (Restore directory "one"  into directory "junk").  Note, you
         have to first rewind the tape, since the last operation moved
         ahead 2 blocks. Check this with "mt -f /dev/nst0".

          # cd junk
          # mt -f /dev/nst0 rewind
          # mt -f /dev/nst0 tell
             At block 0.
          # tar -xzf /dev/nst0 today

    STEP 8 (Next, take a look to see what block the tape is at)

          # mt -f /dev/nst0 tell
             At block 2.

    STEP 9 (Now backup directories three  and four)

          # tar -czf /dev/nst0 kd6w2 kd6mtf

      After backing up the files, the tape should be past block 2.
      Check this.

          # mt -f /dev/nst0 tell
            At block 4.

         Currently the following exist:

               At block 1:
                    today/
                   etc/
                   kd6w2/

               At block 2:
                   kd5mtf
 
                 At block 4:
                   (* This is empty *)

    A few notes. You can set the blocking factor and a label
    with tar. 

     $ tar --label="temp label" --create  --blocking-factor=128 --file=/dev/nst0 Notes

    But note if you try to read it with the default, incorrect blocking
    factor, then, you will get the following error:

       $ tar -t   --file=/dev/nst0
       tar: /dev/nst0: Cannot read: Cannot allocate memory
       tar: At beginning of tape, quitting now
       tar: Error is not recoverable: exiting now

    However this is easily fixed with the correct blocking factor

        $ mt -f /dev/nst0 rewind
        $ tar -t --blocking-factor=128 --file=/dev/nst0
        workingdir testarea
        conf.txt

    Take advantage of the label command.

        $ MYCOMMENTS="tape"
        $ tar --label="$(date +%F)"+"${MYCOMMENTS}"

    Writing to tape on a remote 192.168.56.5 computer

        $ tar cvzf - ./tmp | ssh -l rajat 192.168.56.5 '(mt -f /dev/nst0 rewind; dd of=/dev/st0 )'

    Restoring the contents from tape on a remote computer

        $ ssh -l rajat 192.168.56.5 '(mt -f /dev/nst0 rewind; dd if=/dev/st0  )'|tar xzf -

    Getting data off of tape with dd command with odd blocking factor. Just set ibs very high

        $ mt -f /dev/nst0 rewind
        $ tar --label="Contenets of Notes" --create  --blocking-factor=128 --file=/dev/nst0 Notes
        $ mt -f /dev/nst0 rewind
        $ dd ibs=1048576 if=/dev/st0 of=notes.tar

    The above will probably work with ibs=64k as well

Monday, February 6, 2012

DNS configuration on CentOS /RedHat 6.2

Step 1
#ifconfig

 Step 2
# vi /etc/hosts
Step3
# vi /etc/sysconfig/network

Step 4
#vi /etc/resolv.conf
Step 5
#service network restart

Step 6
#yum install bind* -y

Step 7
#vi /etc/named.conf
 Step 8
#vi /etc/named.rfc1912
Step 9
#cd /var/named/
#ls
#cp named.localhost forward.zone
#cp named.loopback reverse.zone

Step 10
# vi forward.zone 

Step 11
#vi reverse.zone
Step 12
# dig dns.mydns-setup.com


Thursday, February 2, 2012

Server’s Serial Number from command line – RedHat/CentOS

To get service/serial number from command in linux run command below. The first result is the service tag which usually in alphanumeric.


[server@dev-test ~] # dmidecode | egrep -i “serial|product”
output example:
Product Name: PowerEdge R710
Serial Number: 378CDE1
……..
Product Name: 0DCR13
Serial Number: ..ABC980CDE4545XYZ.
Serial Number: AB66X66
Serial Number: Not Specified
Serial Number: Not Specified
Port Type: Serial Port 11204A Compatible
……

Wednesday, February 1, 2012

Postfix Mail Server on RedHat 6 /CentOS 6

In this setup:
IP address of server = 161.101.234.62
Hostname = mail
Domain Name = yeswedeal.com
Full Computer name (FQDN) = mail.yeswedeal.com

Note: Make sure DNS Server is properly configured.

Install Required package:
yum install postfix dovecot squirrelmail http  -y

# vim  /etc/postfix/main.cf

inet_interface   =   all
# inet_interface   =  localhost
mydestination =  $myhostname,  localhost.$mydomain, localhost,  $mydomain
home_mailbox =  Maildir/


vim  /etc/dovecot.conf
protocols  =  imap  imaps  pop3  pop3s
mail_location  = maildir:~/Maildir
pop3_uidl_format  =  %09Xu%09Xv
imap_client_workarounds = outlook-idle  delay-newmail  netscape-eoh
pop3_client_workarounds = outlook-no-nuls    oe-ns-eoh

vim  /etc/squirrelmail/config.php
$domain                       = ‘yeswedeal.com’;
$imapServerAddress    = ‘161.101.234.62’;
$smtpServerAddress    = ‘161.101.234.62’;
$default_folder_prefix   = ‘Maildir/’;

service  postfix  restart
service   dovecot   restart
service httpd  restart

Tuesday, January 31, 2012

Linux Easy Admin Utilities For RHEL, FEDORA, CENTOS, OPENSUSE, UBUNTU, DEBIAN, SLACKWARE

The IT Infrastructure Analyst, IT Ops Engg., Systems Admin, IT Support Engg., IT Helpdesk Engg. Companies changes and Job titles change but the responsibilities over lap and mix. My quest to make work fun, simple, joy and easy has lead to write, collect, source and use various scripts and tools that will help in a very easy and fun filled work flow with computers and IT systems.

This project is to write and collect tools and utilities that make System Administration easy and simple. If a hard working Admin cannot have a beautiful wallpaper on his screen then the Admin can at least have one complete set utility tools that make the brow sweat free and achieve deadlines.

The current list of tools:

Password Generator<br> Network & Firewall Auditor<br> Disk Auditor<br> FS Auditor<br> General System Auditor

Download at:

http://code.google.com/p/linux-easy-admin-utilities/
http://sourceforge.net/projects/lnxesyadmutil/

 # wget http://linux-easy-admin-utilities.googlecode.com/files/linux-easy-admin-util-v0.2.tar.gz
# tar -zxvf linux-easy-admin-util-v0.2.tar.gz
# cp easy-admin/* /usr/local/bin/
# adtdepchk

genadtchk - General Audit Checker: This script generates a simple information information about your system. Basic system, Memory, Disk, File System, Network data is audited.
dksadtchk - Disk Audit Checker: This script generates a complete and compressive information about your systems disk and storage. Total disks at boot time, contained partitions, partitions used, removable disks, capacity and free capacity etc.
fsadtchk - File System Audit Checker: This script generates a complete and compressive information about the systems FS usage and current mounted, total available, type, size, free, and space occupying number one folder or file from the FS.
netadtchk - Network Audit Checker: This script  generates a complete and compressive information about the network interfaces - hardware, virtual, local and other , firewall and its status, outgoing firewall status, current process that are having listening processes, port - ip - process - executable table, IPV4/6 feature, forwarding, masquerading for the system.

Monday, January 30, 2012

Install Xserver(windows) and Gnome on Centos/RedHat using Yum

# yum groupinstall "X Window System" "GNOME Desktop Environment"

# yum groupinstall "X Window System" "KDE (K Desktop Environment)"  


#yum groupinstall gnome
 
#yum groupinstall kde

Wednesday, January 25, 2012

ext3 or ext4 partition recover deleted files Centos /Fedora

Extundelete is a utility that can recover deleted files from an ext3 or ext4 partition. The ext3 file system is the most common file system when using Linux, and ext4 is its successor. extundelete uses the information stored in the partition's journal to attempt to recover a file that has been deleted from the partition. There is no guarantee that any particular file will be able to be undeleted, so always try to have a good backup system in place, or at least put one in place after recovering your files!

Download and Install Extundelete:
Download the latest version of Extundelete - http://extundelete.sourceforge.net/

To compile and install Extundelete, you should first install the binary and development packages for e2fsprogs and e2fslibs.  You must also have a C++ compiler and a make utility to compile extundelete.
Go to terminal and type following command to install Extundelete:


#yum install -y gcc-c++ autoconf automake

#tar -xjf extundelete-0.2.0.tar.bz2
 
#cd extundelete-0.2.0
 
#./configure
 
#make

The extundelete program may be run as-is from the build directory, or you may wish to install it to a directory that is shared with other executable programs, which you may do by running the following command: make install

Using 
extundelete:
Assume you have deleted a file called /home/rajat/snap. Also assume the output of the 'mount' command shows this line (among others):

/dev/sda3 on /home type ext3 (rw)

This line shows that the /home directory is on the partition named /dev/sda3, so then run: 
umount /dev/sda3 and check that it is now unmounted by running the mount command again and seeing it is not listed.Now, with this information, run extundelete:
 

# extundelete /dev/sda3 --restore-file /home/rajat/snap/

If you have deleted the directory 'important', you can run: 
 

# extundelete /dev/sda3 --restore-directory /home/rajat/video

Or if you have deleted everything, you can run: 
 

# extundelete /dev/sda3 --restore-all

Thursday, January 19, 2012

Installation TAR lates version on Cent OS /RedHat 4 /5


tar zxvf tar-1.26.tar.gz
cd tar-1.26
./configure FORCE_UNSAFE_CONFIGURE=1
make
make install
cp -f src/tar /usr/local/bin/tar

once log off and login 

Tuesday, January 17, 2012

Ports for RHEV-M



Red Hat Enterprise Virtualization Manager  required following ports.


Port(s)PurposeRemote End
22ssh
  • Used for maintenance of the virtualization hosts.
80http
  • Administration Portal clients
  • User Portal clients
  • Virtualization hosts
  • REST API clients
443https
  • Administration Portal clients
  • User Portal clients
  • Virtualization hosts
  • REST API clients
25285netconsole
  • Virtualization hosts
54321xml-rpc
  • Virtualization hosts
8006-8009xbap
  • Administration Portal clients   

Open the Command Prompt (Run --> cmd ) on your windows machine and run these below script that will open all the required ports .

c:\> for /D %p in 
(25285,54321,22,8006,8007,8008,8009,80,443) 
do (netsh firewall add portopening protocol 
= TCP port = %p name = RHEVM%p) 
 
c:\> netsh firewall set icmpsetting 8 enable

Friday, January 6, 2012

EMC PowerPath basic commands RedHat /CentOS

PowerPath is a multipathing software for Unix operating systems from EMC. If you have ever worked or you are going to work in an environment that includes EMC storage systems it is more than sure that Powerpath will be installed in the Unix hosts.
Following are some notes and tips I’ve been creating since the very first time I found Powerpath, of course this isn’t a full user guide but a sort of personal quick reference. I decide to put it here in the hope that it will be helpful to anyone and for my personal use.

Show powermt command version
Display PowerPath configuration.

 Check for death paths and remove them. List all devices.