Ubuntu Passwordless and Public Key Authentication

1. Need to generate a local public key file from client machine

# ssh-keygen -t dsa 


( from client machine)

2. Copy the file to the server

# scp ~/.ssh/id_dsa.pub user@linuxfreaks.in:/home/user

3. Login to the server and add the key to authorized_keys file

# cat id_dsa.pub >> .ssh/authorized_keys

4. Delete the original file you copied

# rm -r id_dsa.pub

All done, now just ssh to the server. It will login without the password.

Note : Passwordless authentication is a big security risk.

Tomcat Native Library (APR)– Installation on CentOS

Tomcat can use the Apache Portable Runtime to provide superior scalability, performance, and better integration with native server technologies.

You will see this info often on catalina.out if you dont have the tomcat native library not installed on servers.

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/jdk1.6.0_23/jre/lib/amd64/server:/usr/local/jdk1.6.0_23/jre/lib/amd64:/usr/local/jdk1.6.0_23/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

to get rid of this we need to install apr utilities and tomcat native library. Lets see how to install on CentOS 5.4-X86_64

yum install apr.x86_64 apr-devel.x86_64 -y

We installed apr utilities, now we need to install tomcat native libraries Continue reading Tomcat Native Library (APR)– Installation on CentOS

Setting up internal Bind DNS for Zimbra mail server on Amazon EC2 CentOS & RHEL Servers

Zimbra Collaboration server needs to resolve MX records of a domain while installing. Amazon EC2 instances are behind NAT so we need to have an working internal DNS server to do the MX resolution.

1. Install Bind

yum install bind9 -y

2. Add required changes on bind configuration file. Need to change forwarder and add zone for the domain.

vi /etc/named.conf

Find and replace the forwarders with the below (it is a google DNS servers we are using)

forwarders { 8.8.8.8; };

Add zone information in named.conf (replace mail.example.com with your domain) Continue reading Setting up internal Bind DNS for Zimbra mail server on Amazon EC2 CentOS & RHEL Servers

Add swap on CentOS and Ubuntu Linux

1. Create a swap file.

dd if=/dev/zero of=/mnt/swapfile bs=1024 count=4096k


This will create a 4GB of swap file which can be used for 8GB server.

2. Change the file to swap partition.

mkswap /mnt/swapfile

3. Enable swap

swapon /mnt/swapfile


4. Verify swap partition.

swapon -s


NOTE: All the above operations need to be done with a sudo user or by root.

Zimbra & Sendgrid SMTP Setup

All the operations need to be done as a Zimbra user.

1. Point a domain to an SMTP server

zmprov ms mail.example.com zimbraMtaRelayHost smtp.sendgrid.net


2. Add SMTP authentication for smtp relay server

echo smtp.sendgrid.net username:password > /opt/zimbra/conf/relay_password


3. Export it to postfix

postmap hash:/opt/zimbra/conf/relay_password


4. Check the credentials are saved properly

postmap -q smtp.sendgrid.net /opt/zimbra/conf/relay_password


5. Setup SASL to use smtp relay authentication Continue reading Zimbra & Sendgrid SMTP Setup

PHP Compilation for Litespeed Webserver

Litespeed web server doesn’t come with all PHP modules, we need to compile PHP from source to add any new (or) third-party modules to PHP.

When the Litespeed installation is done, we can compile php and add the new php as a module.

1. Download the desired php version we need from http://php.net/downloads.php. Here we are picking latest stable 5.3.20 version.

wget http://in1.php.net/get/php-5.3.20.tar.gz/from/us1.php.net/mirror
tar -zxf php-5.3.20.tar.gz


2. Change the directory to sapi

cd php-5.3.20/sapi


3. We need to download latest litespeed module for php. (PHP 5.3.x comes with litespeed 4.x module but we are picking latest module from here )

rm -rf litespeed
wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-6.1.tgz
tar -zxf php-litespeed-6.1.tgz


Continue reading PHP Compilation for Litespeed Webserver

Installing Microsoft Core fonts on CentOS 6

Microsoft fonts installation requires chkfontpath binary. It can be installed with all the dependencies by using atrpms.

1. Install atrpms repository

rpm -ivh http://dl.atrpms.net/el6.6-x86_64/atrpms/stable/atrpms-repo-6-6.el6.x86_64.rpm


2. Install chkfontpath

yum install chkfontpath -y


3. Download bundled font rpm file
Continue reading Installing Microsoft Core fonts on CentOS 6