Archive for April, 2008

Quick Howto: Install and configure munin for Server Monitoring

Munin is an efficient and lightweight Monitoring tool. Its available in ‘server’ and ‘node’ packages. You can install server in a single machine and node in all other machines and then view all information/statistical data in server machine.

This quick copy and paste howto explains steps needed to setup server and multiple nodes. These steps are tested in CentOS 5 Server but Please check respective documentation to make sure this will work for you as well.

Step 1. Prepare Server machine. For quick installation and dependency resolution, you can install DAG repository:

$ rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Recover or Reset root password of MySQL and PostgreSQL Servers

Forgot password of MySQL/PostgreSQL? Here is quick howto to recover/reset the password of root user in both Servers:

MySQL:

Step 1. Stop mysql server or Kill it:

$ service mysqld stop

verify whether mysqld process stopped, if not you can go ahead to kill it:

$ ps aux | grep mysql

Kill all processes shows by above command.
OR

$ killall mysqld

Step 2. Start mysqld process manually without using grant table (to skip requirement of user/password):

$ /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --skip-grant-tables

Step 3. Reset root password:

$ mysql
mysql> use mysql;
mysql> update user set password=PASSWORD("newpassword") where user="root";
mysql> quit;

You can also set password of any user here.

Download, install and configure ViewVC for Subversion

ViewVC is a Subversion repository browser software having many useful features. You need python and a web browser to run it. If you are maintaining a Subversion server, you should install it to view repositories, files, branches, directories, versions or comparison between versions.

Step 1. Download and install
Get the latest version of viewvc from here, when writing of this article the latest version was 1.2-dev. I’m using the development branch, you can use more stable. Untar it and start installation:

$ tar xzf viewvc-1.2-dev.tar.gz
$ cd viewvc-1.2-dev
$ ./viewvc-install

Step 2. Installation
Answer simple questions. Default choice is okay for normal operation.

Save root or user history to check later

Some times we need a way to automatically save any user’s or root’s activity so that we can check later. In environment, where root account is accessible by multiple people, its very helpful to exactly know who did what and when? In my case, I have found that some files are changed mysteriously but I was clueless as there are more than one users with root access.

To save the activity/history of any user (including root), you need to open the user’s .bash_profile from his home directory.

Install and configure DenyHost

Brute force attacks or dictionary based attacks are common these days for servers. DenyHosts is an excellent python tool to prevent such attacks. It will detects failed attempts and prevent offending Host/IP for further connection by adding it to /etc/hosts.deny file.

Here are steps to install and configure DenyHosts for your server. These steps are applicable for Red Hat based distros (ie RHEL, CentOS, Fedora) and needs minor changes for other distros. You can copy paste the commands.

Step 1. Detect which version of Python is installed on your server:

# python -V
Get Adobe Flash playerPlugin by wpburn.com wordpress themes