Category: Centos Notes

  • NRPE Installation and Configuration on the client machine

    1) Install the required packages in preparation to install NRPE. [root@MACHINE1 ~]# yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel 2) Add nagios username and update the password. [root@MACHINE1 ~]# useradd nagios [root@MACHINE1 ~]# passwd nagios Changing password for user nagios. New password: mypassword Retype new password: mypassword passwd: all authentication tokens…

  • Nagios Installation

    1) Install Required Dependencies #yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp 2) Create Nagios User and Group #useradd nagios #groupadd nagcmd 3) Next, add both the nagios user and the apache user to the nagcmd group. #usermod -G nagcmd Nagios #usermod -G nagcmd apache 4) Create Nagios directory. #mkdir /root/nagios…

  • How to list/sort all the RPM packages installed in your Linux server.

    Below is the command I use to list or sort all the packages installed in my linux system. rpm -qa –queryformat “%{GROUP} %{NAME}-%{VERSION}\n” | sort  Sample Output: Applications/Archiving cpio-2.10 Applications/Archiving pax-3.4 Applications/Archiving tar-1.23 Applications/Archiving unzip-6.0 Applications/Archiving zip-3.0 Applications/Databases db4-utils-4.7.25 Applications/Databases mysql-5.1.71 Applications/Databases mysql-libs-5.1.71 Applications/Databases mysql-server-5.1.71 Applications/Databases ntteam-MySQL-shared-5.5.28 Applications/Databases postgresql-8.4.13 Applications/Databases postgresql-libs-8.4.13 Applications/Databases postgresql-odbc-08.04.0200 Applications/Databases PyGreSQL-3.8.1…

  • Check MySQL database size

    This is an example on how to check mysql database size of cacti database. mysql> show databases; +——————–+ | Database           | +——————–+ | information_schema | | cacti              | | mysql              | | test               | +——————–+ 6 rows in set (0.00 sec) The the command below. mysql> SELECT table_schema cacti, sum( data_length + index_length ) /…

  • SFTP Chroot on CentOS 6.5

    This is to ensure a secure file transfer to users. 1. Create a group called “sftponly” or you can name your group to your desired name. groupadd sftponly 2. Create a user for sftp and assign a password. I will create “user1” as my first user in sftp. useradd user1 passwd user1 3. Add the…

  • postfix-delete.pl scipt

    #!/usr/bin/perl $REGEXP = shift || die “no email-adress given (regexp-style, e.g. bl.*@yahoo.com)!”; @data = qx</usr/sbin/postqueue -p>; for (@data) { if (/^(w+)(*|!)?s/) { $queue_id = $1; } if($queue_id) { if (/$REGEXP/i) { $Q{$queue_id} = 1; $queue_id = “”; } } } #open(POSTSUPER,”|cat”) || die “couldn’t open postsuper” ; open(POSTSUPER,”|/usr/sbin/postsuper -d -“) || die “couldn’t open postsuper”…

  • How to troubleshoot spamming activities on postfix mail server.

    1. To see the mail queue: mailq 2. To flush the mail queue: postfix flush or postfix -f 3. To remove all mails from the queue: postsuper -d ALL 4. To remove all mails in the deferred queue: postsuper -d ALL deferred 5. To delete all queued messages from or to the domain called webserverpage.com:…

  • Plesk 12.0 Installation in Centos 6.5

    1. Download the plesk installer from their website. wget http://autoinstall.plesk.com/plesk-installer 2. Change the permission to executable. chmod +x plesk-installer 3. Run the script. ./plesk-installer To start the installation or upgrade, press N and then press Enter. To quit the installer, press Q and then press Enter. —— IMPORTANT —— * Before installing or upgrading Parallels…

  • Replacing A Failed Hard Drive In A Software RAID1 Array

    Note: In this example I have two hard drives, /dev/sda and /dev/sdb with partitions /dev/sda1 and /dev/sdb1 as well as /dev/sda3 and /dev/sdb3. 1. Check raid health by typing this command “cat proc/mdstat” in terminal. [root@linuxbox /]# cat proc/mdstat Personalities : [raid1] md1 : active raid1 sda3[0] 459025152 blocks [2/1] [U_] md0 : active raid1…

  • Centos High Availability Cluster with OpenVZ, DRBD and Heartbeat – Part 2

    DRBD installation with OpenVZ, plese follow the link below. Centos High Availability Cluster with OpenVZ, DRBD and Heartbeat – Part 1 1.  Download repository. rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 2. Install HeartBeat yum install heartbeat 3. Create the Heartbeat configuration file ha.cf and copy it to /etc/ha.d/ha.cf on both nodes. # vi /etc/ha.d/ha.cf debugfile logfile /var/log/ha-log logfacility…