rsync server.

I am adding very brief info here, will try to add details regarding options used when have time.

Server=http://anuj.sytes.net (Red Hat Enterprise Linux 5)

Client=any other unix based machine.

On the rsync server

Create  /etc/rsyncd.conf

uid = nobody
gid = nobody
use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid
[ftp]
path = /var/ftp/pub/xyz
hosts allow = 87.227.31.168
auth users =  anujhere
read only = false
write only = false
secrets file = /etc/rsyncd.secrets
comment = whole ftp area (approx 6.1 GB)

Create /etc/rsyncd.secrets file

anujhere:p@ss

Enable rsync service by editing /etc/xinetd.d/rsync, change `disable = yes` to `disable = no`

# default: off
# description: The rsync server is a good addition to an ftp server, as it \
#       allows crc checksumming etc.
service rsync
{
disable = no
socket_type     = stream
wait            = no
user            = root
server          = /usr/bin/rsync
server_args     = --daemon
log_on_failure  += USERID
}
Reload/Restart the xinetd service:

/sbin/service xinetd restart

On the host

Create a password file. say ~user/.rhosts with password.

p@ss

chmod 600 ~user/.rhosts

Copy files from rsync server to host

rsync --password-file ~anujhere/.rhosts -rcvh rsync://anuj.sytes.net/ftp /path/to/destination

Copy files from host to rsync server

rsync –password-file ~anujhere/.rhosts -rcvh . rsync://anuj.sytes.net/ftp

Anuj Singh
Posted in Linux | Leave a comment

installation of linux-heartbeat on rhel5

Linux Heartbeat “Provide a high availability (clustering) solution for Linux which promotes reliability, availability, and serviceability (RAS) through a community development effort.”

As the linux-heartbeat is not yet shipped with Red Hat Enterprise Linux, one can use rpm’s from the clone operating system of RHEL i.e. Centos a 100% binary compaitable with redhat. The rpm from centos extras repository is not yet updated, I found difficulties getting heartbeat installation, tried the heartbeat-2.1*.el5.centos.src.rpm but same error, though the second attempt of rpm installation was not showing any error and installation succeeds, but for a production enviornment or self satisfaction with the work it is not acceptable. The error is like:

rpm -ivh /usr/src/redhat/RPMS/i386/heartbeat-2.1.3-1.i386.rpm
useradd: user hacluster exists
error: %pre(heartbeat-2.1.3-1.i386) scriptlet failed, exit status 9
error: install: %pre scriptlet failed (2), skipping heartbeat-2.1.3-1

Next attempt I tried with open suse linux rpm’s in which I had a different error due to minor bug in heartbeat.spec file, thanks to ‘bleve’ for helping me out and ‘lmb’ who updated the heartbeat.spec for Open Suse, now rpm’s from open suse site are working and updated, avialable on http://download.opensuse.org/repositories/server:/ha-clustering:/lha-2.1/RHEL_5/

Lately I found a 3rd method to build from source which is as follows,

Make sure you have following packges are installed or you will get errors.

libgpg-error-devel
libgcrypt-devel
libtool-ltdl
imake
autoconf
automake
libtool
OpenIPMI-devel
gdbm-devel
bison
flex
bzip2-devel
libtool-ltdl-devel
gnutls-devel
python-devel
swig
pam-devel
beecrypt-devel
sqlite-devel
lm_sensors
net-snmp
libsepol-devel
libselinux-devel
ncurses-devel
elfutils-libelf-devel
elfutils-libelf-devel-static
rpm-devel
elfutils-devel
net-snmp-devel
elfutils-devel-static
e2fsprogs-devel
gnu-crypto
cryptsetup-luks-devel
gnu-crypto-sasl-jdk1
beecrypt-python
gnu-crypto-javadoc
krb5-devel
openssl-devel
Download latest heartbeat source:

  1. wget http://hg.linux-ha.org/lha-2.1/archive/STABLE-2.1.4.tar.bz2
  2. uncompress the source, tar jxvf STABLE-2.1.4.tar.bz2
  3. cd Heartbeat-STABLE-2-1-STABLE-2.1.4
  4. ./ConfigureMe configure
  5. make dist
  6. tar zxvf heartbeat-2.1.4.tar.gz
  7. cp .. /heartbeat-2.1.4.tar.gz /usr/src/redhat/SOURCES/
  8. Build rpm packages with ‘rpmbuild -bb heartbeat.spec’
  9. Step 9 will create rpm’s for you according to your machine architecture, f.e /usr/src/redhat/RPMS/i386

Install the rpms, i have my rpms under /usr/src/redhat/RPMS/i386.
rpm -ivh /usr/src/redhat/RPMS/i386/pils-2.1.4-1.i386.rpm
rpm -ivh /usr/src/redhat/RPMS/i386/stonith-2.1.4-1.i386.rpm
rpm -ivh /usr/src/redhat/RPMS/i386/heartbeat-2.1.4-1.i386.rpm

Configuration of heartbeat is a different thing, I am using heartbeat for DRBD (Distributed redundent block device), iSCSI (scsi over ip) and vip to create a storage area network, heartbeat has wide possiblities e.g. high availability of mysql, httpd etc, please read their documention. :)

you can contact me on anujhere@gmail.com

Anuj Singh.

Posted in Linux | 2 Comments

vsftpd integration with xinetd on linux

The xinetd daemon is a TCP wrapped super service which controls access to a subset of popular network services including FTP, IMAP, and Telnet. It also provides service-specific configuration options for access control, enhanced logging, binding, redirection, and resource utilization control.

to integrate vsftpd with xinetd we need to take following steps.

1). Create a file /etc/xinetd.d/vsfpt with the following entries
# default: off
# description: The vsftpd FTP server serves FTP connections. It uses \
# normal, unencrypted usernames and passwords for authentication.
service ftp
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/vsftpd
nice = 10
#allow only 10.1.10.2 machine
only_from = 10.1.10.2
}

2). Edit your /etc/vsftpd/vsftpd.conf file and comment out line
with “listen=YES”

3). Restart or reload the xinetd service.
/sbin/service xinetd reload

Now test your configuration with
netstat -a |grep ftp

also
To avoid port conflict at boot time turn off the vsftpd service
chkconfig vsftpd off
As of now our vsftpd is integrated with xinetd make sure that xinetd
starts automatically.
chkconfig xinetd on

Anuj Singh

Posted in Linux | 1 Comment

recover the lilo bootloader redhat linux 7.1 using knoppix

In new versions of linux grub( grand unified bootloader) works great. If your boot loader is corrupt or over written by dumb microsoft os there are many ways to recover e.g. using your linux boot media.

In case you don’t have any installation media, you can apply the following steps, i tried this method on redhat linux 7.1 of which I had no installation cd/dvd’s.

  1. Boot from any Live linux cd such as knoppix 
  2. You may not be needing GUI ( start knoppix with runlevel 1 or 2 ) use boot: knoppix 1
  3. use fdisk -l to get the list of partitions.
  4. mount the / partiton. (I found whole the linux on one partition). use “mount /dev/hda4 /mnt/hda4″
  5. chroot /mnt/hda4
  6. lilo -C /etc/lilo.conf
  7. lilo -i /dev/hda1

You should not get any error, do the man lilo, and man lilo.conf to resolve any issue/error. 

after you are done, press ctrl +d , init 6, take out your knoppix media, you recoverd your old linux.

 anuj.

Posted in Linux | Leave a comment

Appreciating Our Past

It is easy to be negative about past mistakes and unhappiness. But it is much more healing to look at
ourselves and our past in the light of experience, acceptance, and growth.

Our past is a series of lessons that advance us to higher levels of living and loving. The relationships
we entered, stayed in, or ended taught us necessary lessons.

Some of us have emerged from the most painful circumstances with strong insights about who we are and what we want. Our mistakes? Necessary. Our frustrations, failures, and sometimes stumbling
attempts at growth and progress? Necessary too. Each step of the way, we learned. We went through exactly the experiences we need to, to become who we are today. Each step of the way, we progressed. Is our past a mistake? No. The only mistake we can make is mistaking that for the truth.

Today, God, help me let go of thoughts I may be harboring about my past circumstances or relationships. I can accept, with gratitude, all that has brought me to today.

Posted in Anuj | 2 Comments

Installation of java and Apache-tomcat on Linux

Installation of java and Apache-tomcat on Linux

1.Introduction
2.Installation of java
3.Installation of apache tomcat
4.References

1.Introduction:
This document is meant for the installation of java and apache-tomcat
over a linux machine.

2.Installation of java
Download the JDK from Sun, to start go here:

http://java.sun.com/javase/downloads/index.jsp

Click on the “Download” link in the JDK  section.
Accept the license and continue.

Under the “Linux Platform”, select “rpm self-extracting file”.
Download this .bin file and save it to your Linux machine.

become root, and give command chmod 755 downloaded_bin_file for
instance “chmod 755 jdk-6u2-linux-i586.bin”

now execute file with command ./downloaded_bin_file

Accept the license after scrolling down on the terminal. This will
give a .rpm file in the same directory.

install the extracted .rpm file with rpm -ivh extracted_file.rpm

Set the path of java
To set the path of java edit /etc/profile file and add the following lines
JAVA_HOME=/usr/java/jdk1.5.0_09
export PATH=$PATH:$JAVA_HOME/bin
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME
Note: Here rpm file installed java in /usr/java/jdk1.5.0_09 choose the
path name as per your installation version.

Now give command “source /etc/profile”
check the path by giving command

[root@anuj2 ~]# echo $JAVA_HOME
/usr/java/jdk1.5.0_09

3.Installation of apache-tomcat
Download apache-tomcat from

http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.25/bin/

tar zxvf apache-tomcat-5.5.25.tar.gz
cd apache-tomcat-5.5.25/bin
[root@anuj2 bin]# sh startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-5.5.25
Using CATALINA_HOME:   /usr/local/apache-tomcat-5.5.25
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-5.5.25/temp
Using JRE_HOME:       /usr/java/jdk1.5.0_09

Automatic startup of apache-tomcat at boot time(Redhat Linux):
Save following script in /etc/init.d/ directory with tomcat name
Note: Use correct path of catalina.sh in PROGRAM

#!/bin/sh
# chkconfig: – 85 15
# description: Tomcat is a servlet container
#PROGRAM=$CATALINA_HOME/bin/catalina.sh
PROGRAM=/usr/local/apache-tomcat-5.5.25/bin/catalina.sh
if [ -f $PROGRAM ]; then
echo “$1ing” `basename $0`
su – root -c “$PROGRAM $1″
fi

Now use following commands
“chmod 755 /etc/init.d/tomcat”
“chkconfig –add tomcat ”
“chkconfig –level 345 tomcat on”
“service tomcat start”

4.References:

http://apache.org/

http://tech.groups.yahoo.com/group/lucknow-lug/

Posted in Linux | Leave a comment

MySQL Archive Storage Engine on Linux (RHEL-5)

The ARCHIVE storage engine is used for storing large amounts of data without indexes in a very small footprint.

The ARCHIVE storage engine is included in MySQL binary distributions, but not with RHEL5/Fedora binary rpm’s. To enable this storage engine if you build MySQL from source, invoke configure with the --with-archive-storage-engine option.

  • Download mysql
  • Uncompress source
    tar zxvf mysql-5.0.51b.tar.gz
    cd mysql-5.0.51b
    useradd mysql -b /var/lib/mysql
    ./configure –with-mysqld-user=mysql –with-archive-storage-engine –datadir=/var/lib/mysql/
    make && make install
  • Now install initial database with command:
    /usr/local/bin/mysql_install_db
  • [root@anuj mysql-5.0.51b]# /usr/local/bin/mysql_install_db
    Installing MySQL system tables…
    OK
    Filling help tables…
    OK

    To start mysqld at boot time you have to copy
    support-files/mysql.server to the right place for your system

    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    /usr/local/bin/mysqladmin -u root password ‘new-password’
    /usr/local/bin/mysqladmin -u root -h anuj.sytes.net password ‘new-password’

    Alternatively you can run:
    /usr/local/bin/mysql_secure_installation

    which will also give you the option of removing the test
    databases and anonymous user created by default.  This is
    strongly recommended for production servers.

    See the manual for more instructions.

    You can start the MySQL daemon with:
    cd /usr/local ; /usr/local/bin/mysqld_safe &

    You can test the MySQL daemon with mysql-test-run.pl
    cd mysql-test ; perl mysql-test-run.pl

    Please report any problems with the /usr/local/bin/mysqlbug script!

    The latest information about MySQL is available on the web at

    http://www.mysql.com

    Support MySQL by buying support/licenses at http://shop.mysql.com

  • Copy startup script
    cp /usr/local/mysql-5.0.51b/support-files/mysql.server /etc/init.d/mysqld
  • Do a chmod to the copied startup shell script
    chmod 755 /etc/init.d/mysqld
  • Add to chkconfig
    chkconfig –add mysqld
  • Set the runlevels for mysql service
    chkconfig –level 345 mysqld on
  • Check Engines
    mysql -h localhost -u root -p

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.0.51b Source distribution

    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

    mysql> show engines;
    +————+———+—————————————————————-+
    | Engine     | Support | Comment                                                        |
    +————+———+—————————————————————-+
    | MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         |
    | MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      |
    | InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     |
    | BerkeleyDB | NO      | Supports transactions and page-level locking                   |
    | BLACKHOLE  | NO      | /dev/null storage engine (anything you write to it disappears) |
    | EXAMPLE    | NO      | Example storage engine                                         |
    | ARCHIVE    | YES     | Archive storage engine                                         |
    | CSV        | NO      | CSV storage engine                                             |
    | ndbcluster | NO      | Clustered, fault-tolerant, memory-based tables                 |
    | FEDERATED  | NO      | Federated MySQL storage engine                                 |
    | MRG_MYISAM | YES     | Collection of identical MyISAM tables                          |
    | ISAM       | NO      | Obsolete storage engine                                        |
    +————+———+—————————————————————-+
    12 rows in set (0.00 sec)

    mysql>

    That’s it!!!

Anuj Singh

Posted in Linux | Leave a comment

my fav lines

Khudi ko kar buland itna ke har taqder se pehle
Khuda bande se ye poche bata teri raza kia hai

Khudi ko kar buland itna ke har taqder se pehle
Khuda bande se ye poche bata teri raza kia hai

Sitaron se age jahan aur bhi hai aur bhi hai
Abhi ishq ke Imtehan aur bhi hai aur bhi hai
Sitaron se age jahan aur bhi hai aur bhi hai
Abhi ishq ke Imtehan aur bhi hai aur bhi hai

Khudi ko kar buland itna ke har taqder se pehle
Khuda bande se ye poche bata teri raza kia hai

Tu shaheen hai, Tu shaheen hai, Tu shaheen hai
Tu shaheen hai, Tu shaheen hai Parvaz hai kam tera kam tera
Tere samne Aasman aur bhi hai
Tu shaheen he Basera kar Paharon ki chatano per
Tu shaheen hai tu Shaheen hai tu shaheen hai

Khudi ko kar buland itna ke har taqder se pehle
Khuda bande se ye poche bata teri raza kia hai

Khudi ko kar buland itna ke har taqder se pehle
Khuda bande se ye poche bata teri raza kia hai
bata teri raza kia hai
bata teri raza kia hai

Posted in Anuj | Tagged , | 1 Comment

Your own content filter proxy server

Content-control software, also known as censorware or web filtering software, is a term for software designed and optimized for controlling what content is permitted to a reader, especially when it is used to restrict material delivered over the Web.

We will be using open source softwares, best and reliable.

DansGuardian is designed to be completely flexible and allows you to tailor the filtering to your exact needs. It can be as draconian or as unobstructive as you want. The default settings are geared towards what a primary school might want but DansGuardian puts you in control of what you want to block.

Operating system on gateway server:

  • FreeBSD7.0

Softwares:

  1. Squid  (Version 2.6.STABLE16)
  2. DansGuardian 2.8.0.6

Installation and Configuration:

  1. Install squid proxy.
  • cd /usr/ports/www/squid
  • make
  • make install

Now configure your squid proxy: Edit  following file.

/usr/local/etc/squid/squid.conf

Locate the line with folllowing entry:

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

acl our_networks src 192.168.1.0/24 192.168.2.0/24
http_access allow our_networks

By default squid is configured to run on port 3128, you can change the default port.

Set the squid to start at the boot time:

Edit /etc/rc.conf file add the following entry:

squid_enable=”YES”

create Swap directories by giving command:

squid -z

Now install and configure Dansguardian:

  1. cd /usr/ports/www/dansguardian
  2. Download source tar ball from Download Dansguardian and copy to /usr/ports/distfiles directory.
  3. make
  4. make install
  5. Edit /usr/local/etc/dansguardian/dansguardian.conf file with following entries:
    # the port that DansGuardian listens to.
    filterport = 8100

    # the ip of the proxy (default is the loopback – i.e. this server)
    proxyip = 127.0.0.1

    # the port DansGuardian connects to proxy on
    proxyport = 3128

  6. Edit /etc/rc.conf file to start dansguardian at boot time, add the following line:
  7. dansguardian_enable=”YES”

Configure trasparent proxy with your firewall rules,
Same configurations apply on Linux, location of configuration file may be changed, if SELinux Enabled then few more changes.

My working content filter server for public.  http://anuj.sytes.net port number 8100

Anuj Singh

Posted in Linux | Tagged , | Leave a comment

unix

Unix is simple. It just takes a genius to understand its simplicity.

Dennis Ritchie

Posted in Misc | Leave a comment