Posts

Setting Java Heap Size

Two JVM options are often used to tune JVM heap size: -Xmx for maximum heap size, and -Xms for initial heap size. Here are some common mistakes I have seen when using them: Missing m, M, g or G at the end (they are case insensitive). For example, java -Xmx128 BigApp java.lang.OutOfMemoryError: Java heap space The correct command should be: java -Xmx128m BigApp . To be precise, -Xmx128 is a valid setting for very small apps, like HelloWorld. But in real life, I guess you really mean -Xmx128m Extra space in JVM options, or incorrectly use =. For example, java -Xmx 128m BigApp Invalid maximum heap size: -Xmx Could not create the Java virtual machine. java -Xmx=512m HelloWorld Invalid maximum heap size: -Xmx=512m Could not create the Java virtual machine. The correct command should be java -Xmx128m BigApp , with no whitespace nor =. -X options are different than -Dkey=value system properties, where = is used. Only setting -Xms JVM option and its value is greater t...

389 Directory Server | Fedora Directory Server On CentOS

389 Directory Server The 389 Directory Server (previously Fedora Directory Server ) is an LDAP (Lightweight Directory Access Protocol) server developed by Red Hat, as part of Red Hat's community-supported Fedora Project. 389 Directory Server is identical to the Red Hat Directory Server, just rebranded. The name 389 is derived from the port number for LDAP. Features 1.) 389 Directory Server has multi-master capability. 2.) 389 Directory Server also has the ability to export parts of the directory to read-only servers. This is similar to the Read Only Domain Controller in Microsoft's Active Directory Domain Services. 3.) 389 Directory Server has a Java-based GUI front end for administration, but the underlying LDAP database can be managed by other LDAP compliant tools. First you need to download & install epel rpm package, that is repository rpm packages.Then you can install packages with your usual method, and the EPEL repository is included. [root@server2/etc/dirsr...

How to know Size and Name of Installed rpm

Recently I have come in situation having low space. So I start thinking that how will I got the list of all RPM installed along with their size. So I have spend some time for searching and got the following nice command. #rpm -qia|awk '$1=="Name" { n=$3} $1=="Size" {s=$3} $1=="Description" {print s  " " n }' |sort -n Let me explain the above thing 1.) rpm -qia will list all installed rpms along with their all Info. 2.) send above output to awk. It will see if first column is "Name", then set value of Third column to n(variable).Similarly, If first column is "Size", then set value of Third column to s(variable).                                    Note : If you just run rpn -qia then you will see that the row Having Name as first column have third column as its Actual Name and same with Size. 3.) Finally It ...

Using the /proc filesystem

                                          **The Proc File System** Today I have come to know these all things about Proc File System. really so Interesting.                                     The proc filesystem is a special filesystem found on most UNIX-based systems. It holds a great deal of information, in ASCII format, most of which is not very friendly to the average user.It is important that you keep in mind that the files under /proc are not kept on a physical storage, meaning they are subject to change after reboot. Also, they should not really be called files as they are pseudo-files, as they exist only in memory. I break that rul...

What is Zombie process in Linux?

Zombie process                                            On Unix and Unix-like computer operating systems , a zombie process or defunct process is a process that has completed execution but still has an entry in the process table . This entry is still needed to allow the process that started the (now zombie) process to read its exit status . The term zombie process derives from the common definition of zombie —an undead person. In the term's metaphor, the child process has " died " but has not yet been " reaped ". Also, unlike normal processes, the kill command has no effect on a zombie process. Finding if zombies exist execute the top command one line is tasks: Example output: Tasks: 139 total,   2 running, 136 sleeping,   0 stopped,   1 zombie ...

error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file

Today I was working on installing some package. After Installing the package successfully, I have just start that by typing the command whatever for that. Then I got the following error. ** : error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory ** So I have worked on this and found the following solution. This error is because mysql library path is not in system library locations. To fix the error edit /etc/ld.so.conf #vi /etc/ld.so.conf   Add following line to end of the file /usr/lib/mysql Now run ldconfig #ldconfig  Kuldeep !! Enjoy Linux

Search Files with Grep Command

Some times we want to search for text in a number of files. Manually It'll take a lots of time. So Here is a command  "grep": Global regular expression. For this just make the use of following command.   #ls -1rt | xargs grep -i |more   Here -1 option will display the out output in listing, then xargs will treat the output as files and grep  command will search in all specified directories. At last this output will goes to more command  i.e. displays output page wise.     Kuldeep  !!Enjoy Linux

Temperary Way to Resolve error regarding GPG Key during Yum Install

While you are installing aur updating something using yum and getting errors related to GPG Keys like ********warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6******** then use yum with --nogpgcheck  for temperary not for long uses. But you  must import the exact key. !!Enjoy Linux

Stop Wasting CDs; Install Linux Straight from an ISO

Image
All Linux installers use two files to boot a computer: a kernel and an initial root filesystem—also known as the RAM disk or initrd image. This initrd image contains a set of executables and drivers that are needed to mount the real root filesystem. When the real root filesystem mounts, the initrd is unmounted and its memory is freed. These two files are named differently in different distros—refer to Table 1 for their names. Table 1: Names of kernel and RAM disk images in some popular distros Distro Kernel path RAM disk path Fedora /isolinux/vmlinuz /isolinux/initrd.img RHEL5/CentOS5 /isolinux/vmlinuz /isolinux/initrd.img openSUSE /boot/i386/loader/linux /boot/i386/loader/initrd Mandriva /i586/isolinux/alt0/vmlinuz /i586/isolinux/alt0/all.rdz Ubuntu /casper/vmlinuz /casper/initrd.gz Debian /install.386/vmlinuz /isolinux/initrd.img The first thing you need to do is place the ISO image(s) inside a directory. Some installers are not able to r...

Recovery of deleted /etc/passwd File in Linux

In that case you need to recover /etc/passwd file first. For this you have to following steps, -Start GRUB on boot (press ESC while booting) -Press e over (recovery mode) -Press e over the line beginning with kernel -Press Space bar and enter "init=/bin/bash" -Press enter -Press b -At command prompt type: "cp /etc/passwd- /etc/passwd" -reboot to GRUB again -Press e over (recovery mode) -Press e over the line beginning with kernel -Press Space bar and enter "init=/bin/bash" -Press enter -Press b -At command prompt type "mount -o remount,rw /" -Type "passwd YOURUSERNAMEHERE" (IF you don't know your user name type "ls /home" (that is a Lower case L and lower case S) for a list of users) -Enter new password at prompt -reboot to normal boot. Hope that helps others like it did me! ### Then to recover /etc/shadow file, Use following command pwconf This command will generate /etc/shadow file from /etc/passwd Enjoy Linux!!

Delete all lines containing a pattern(vi and sed)

Image
sed : sed ( s tream ed itor ) is a Unix utility that parses text files and implements a programming language which can apply textual transformations to such files. It reads input files line by line (sequentially), applying the operation which has been specified via the command line (or a sed script ), and then outputs the line. It was developed from 1973 to 1974 as a Unix utility by Lee E. McMahon of Bell Labs, and is available today for most operating systems. How to remove Blank Lines or some line starting from particular pattern.    Here Suppose I want to remove the Blank Lines and Lines starting with #. Original File : [root@gateway ~]# cat a Default: # sleep_after_fork 0 #  TAG: max_filedesc #       The maximum number of open file descriptors. # #       WARNING: Changes of this value isn't respected by reconfigure         command. This value should be...

SERVER CONFIGURATION FILE SYNTAX CHECKING COMMANDS

SERVER CONFIGURATION FILE SYNTAX CHECKING COMMANDS Basically configuring servers in Linux/*nix include editing of configuration files and saving them. Once editing the files if any syntax error is there and when we start the service they will show some wearied errors which we cant resolve. For counter attacking this type of issues for each service there will be one command to check this syntax errors before starting of the service/server, I have collected these commands from my experience and from some of my friends. Please feel free to comment on this if you know some other commands so that I will update my post. SSHD server check for syntax error ========================= sshd -t FTP server check for syntax error ========================= #vsftpd DNS server check for syntax error ========================== For checking syntax errors in main configuration file.. #named-checkconf main-config-file Example: #named-checkconf named.conf Syntax OK #named-checkzone doma...

Automatic Login through SSH

[root@server2~]#ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.2.202 21 root@192.168.2.202's password: Now try logging into the machine, with "ssh '192.168.2.202'", and check in:   .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. [root@server2~]#ssh 192.168.2.202 Last login: Thu Dec 23 18:25:19 2010 from 192.168.2.200 [root@server3 ~]#

How to connect, install and configure TATA Photon in Linux

This post explains how to connect your Tata photon dongle to a Redhat Linux system. It works on other Redhat distributions like Fedora, CentOS too. The procedure is explained in step by steps below. Steps. 1. Connect / Plug your photon+ to the system and wait till it gets ditected. 2. Open a terminal, run a command "dmesg" and check it is showing the modem name as HUAWEI. 3. Run another command "sudo wvdial" and its will create a config file in /etc/wvdial.conf, something like shown below. (if u dont have wvdial, you can download it from open.alumnit.ca) by running "cat /etc/wvdial.conf" or you can edit it using the commadn "vi /etc/wvdial.conf" # [Dialer Defaults] Modem = /dev/modem Baud = 115200 Modem Type = Analog Modem Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 [Dialer info] Init9 = AT&V [Dialer photon+] Modem = /dev/modem Baud = 115200 Modem Type = Analog Modem Init1 = ATZ Init2 = ATQ0 V1 E...

How to install and configure a mail server using Postfix + Dovecot + squirrelmail in linux

This post helps to install and configure a mail server with postfix as MTA[ (Mail Transfer agent), Dovecot as MDA (Mail Delivery Agent) and Squirrel mail as MUA (Mail User Agent). This is a simple basic configuration without much advanced configurations. This is tested in Redhat linux and will also work in other redhat disrtos like fedora, centos etc. Assuming you have a configured yumserver. Else use the rpms. #yum install postfix* dovecot* Squirrelmail* Steps 1. Configure the DNS eg: example.com 2. Select the defalt MTA as postfix. Most systems it will be Sendmail. #alternatives     --config    mta Select postfix. 3. open the configuration file of Postfix and edit the following. #vi /etc/postfix/main.cf edit the following  1. my domain  2. my hostname  3. inet_interfaces and reload the service. 4. Configure the Squirrel mail #cd /usr/share/squirrelmail/config/ run the perl file #./conf.pl Give ...

User administration in redhat linux

User administration in Linux In Linux there are three type of users. 1. Super user or root user Super user or the root user is the most powerful user. He is the administrator user. 2. System users System users are the users created by the softwares or applications. For example if we install Apache it will create a user apache. This kind of users are known as system users. 3. Normal users Normal users are the users created by root user. They are normal users like John, Ramu etc. Only the root user has the permission to create or remove a user. In linux systems every user will have a unique user ID. It is known as UID. The Range of UIDs will be as follows: 1. Root user          UID will be "0" 2. Systems users      UID will be "1 - 499" 3. Normal users       UID will be "500 - 60000" The range of MIN_GID and MAX_GID is specified in the file  "/etc/login.defs". ...

How to install and configure Nagios Monitoring tool in redhat linux rhel5 or centos

This article will help you to install and configure Nagios monitoring tool in redhat linux or other redhat distributions like fedora, centos etc. Nagios Installation : Installing packages. Apache, PHP, GCC & GD Installing Apache web server: #yum -y install httpd* set hostname in FQDN #service httpd on Installing PHP, GCC and GD: #yum -y install php* #yum -y install gcc* #yum -y install gd* Getting the package: Get the latest packages from net. Mov it to some directory and untar them. #wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz #mv nagios-3.2.0.tar.gz  /usr/local/src #tar xvf nagios-3.2.0.tar.gz #wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz #mv nagios-plugins-1.4.14.tar.gz/usr/local/src #tar xvf nagios-plugins-1.4.14.tar.gz Adding nagios user and setting password for that user: #useradd nagios #passwd nagios usermod -a -G nagios apache    ...

How to configure syslog server or a centralized log server in redhat linux rhel5 or centos

This article will explain installing and configuring a syslog log server in redhat enterprise linux. It'll work in other redhat distributions like centos, fedora etc. Centralized log server (syslog server) Suppose we have a server and 5 client machines. And we want to monitor the logs of all those client machines. In situations like this, we will use centralized server as a log server. Whatever events are happening in client machines, the logs will be sent to the server. So that we can monitor all the logs from a centralized server. We make use of syslog service for this. Configuration of server machine(syslog server) Service name: syslog configuration file: /etc/sysconfig/syslog Steps: 1. Open the /etc/sysconfig/syslog file and add "-r" option to the variable SYSLOGD_OPTIONS as shown below. [root@server ~]# cat /etc/sysconfig/syslog # Options to syslogd # -m 0 disables 'MARK' messages. # -r enables logging from remote machines # -x disables DNS l...