UnixServerAdmin

Server Administration & Management

How to update SpamAssassin rules in cPanel

Execute the following command from the console:-

# sa-update -D

This will update the spamassassin rules in the cPanel server.

June 28, 2012 Posted by | cPanel | , | Leave a comment

MySQL Optimization Tips

Sample values for each variables

max_connections=400
max_user_connections=30
key_buffer=256M (128MB for every 1GB of RAM)
myisam_sort_buffer_size=64M
join_buffer_size=1M
read_buffer_size=1M (1MB for every 1GB of RAM)
sort_buffer_size=1M (1MB for every 1GB of RAM)
table_cache=1500
thread_concurrency=2 (Number of CPUs x 2)
thread_cache_size=128
wait_timeout=10
connect_timeout=5
max_allowed_packet=16M
max_connect_errors=10
query_cache_limit=1M
query_cache_size=32M (32MB for every 1GB of RAM)
query_cache_type=1

June 25, 2012 Posted by | MySQL | | Leave a comment

How to disable history listing in console mode in Linux

Here is simple tip that will disable HISTORY listing. Open the terminal and run the following commands :-

# rm -f $HOME/.bash_history

# touch $HOME/.bash_history

# chmod 000 $HOME/.bash_history

June 22, 2012 Posted by | Tips & Tricks, Unix/Linux | , , | 1 Comment

Keyboard Shortcuts for Linux Bash

The default shell on most Linux operating systems is called Bash. There are a couple of important hotkeys that you should get familiar with if you plan to spend a lot of time at the command line. These shortcuts will save you a ton of time if you learn them.

Ctrl + A  –>  Go to the beginning of the line you are currently typing on
Ctrl + E  –>  Go to the end of the line you are currently typing on
Ctrl + L  –>  Clears the Screen, similar to the clear command
Ctrl + U  –>  Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H  –>  Same as backspace
Ctrl + R  –>  Let’s you search through previously used commands
Ctrl + C  –>  Kill whatever you are running
Ctrl + D  –>  Exit the current shell
Ctrl + Z  –>  Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W  –>  Delete the word before the cursor
Ctrl + K  –>  Clear the line after the cursor
Ctrl + T  –>  Swap the last two characters before the cursor
Esc + T  –>  Swap the last two words before the cursor
Alt + F  –>  Move cursor forward one word on the current line
Alt + B  –>  Move cursor backward one word on the current line
Tab  –>  Auto-complete files and folder names

June 19, 2012 Posted by | Tips & Tricks, Unix/Linux | , | Leave a comment

Protected: tomcat_service.sh

This content is password protected. To view it please enter your password below:

June 16, 2012 Posted by | Shell Script, Tomcat | , | Enter your password to view comments.

How to relay localhost mails to remote smtp server

sSMTP is a simple MTA to deliver mail from a computer to a mail hub (SMTP server). sSMTP is simple and lightweight, there are no daemons or anything hogging up CPU; Just sSMTP. If linux based system have running internet, then we can send email to any account using remote smtp authentication, here is following steps :-

ssmtp download link

# wget dl.fedoraproject.org/pub/epel/5/i386/ssmtp-2.61-15.el5.i386.rpm

# wget dl.fedoraproject.org/pub/epel/5/x86_64/ssmtp-2.61-15.el5.x86_64.rpm

# vim /etc/ssmtp/ssmtp.conf

For StartTLS smtp authentication
###########################################
Root=example@gmail.com
Mailhub=smtp.gmail.com:587
#RewriteDomain=gmail.com
AuthUser=example # (before the @gmail.com part)
AuthPass=example@123
FromLineOverride=Yes
UseSTARTTLS=Yes
AuthMethod=LOGIN
###########################################

For TLS smtp authentication
###########################################
Root=example@gmail.com
Mailhub=smtp.gmail.com:465
#RewriteDomain=gmail.com
AuthUser=example # (before the @gmail.com part)
AuthPass=example@123
FromLineOverride=Yes
UseTLS=Yes
AuthMethod=LOGIN
###########################################

Username :- example
Password :- example@123
Smtp Server :- gmail.com

After done above process, we can also send email through mutt from command line interface (CLI) by following change :-

# vim /root/.muttrc
set sendmail = “/usr/sbin/ssmtp -aexample@gmail.com -apexample@123 -v”

June 13, 2012 Posted by | Mail, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to check php configuration on shell for cPanel server

We can check the Php versions and configurations like suphp, phpsuexec or dso on a cPanel based servers on shell using below command :

# /usr/local/cpanel/bin/rebuild_phpconf –current
Available handlers:
suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: suphp
PHP5 SAPI: suphp
SUEXEC: enabled

June 10, 2012 Posted by | cPanel, PHP | , , | Leave a comment

How to start IPs on the server if they are assigned but not working

There are instances when additional IPs are assigned to a certain server but they still do not ping or respond, and only the main IP of the server pings. For cPanel based servers you will find them assigned at below link as well :

WHM –> IP Functions –> Show IP Address Usage

You can verify the IPs on shell using below command to see if they are attached to the virtual network interfaces are not :

# ifconfig -a

Now if you find that additional IPs are not appearing , then you can make them available using below command :

# service ipaliases start

For cPanel based servers such additional IPs are listed at /etc/ips

June 7, 2012 Posted by | Tips & Tricks, Unix/Linux | , , | 1 Comment

How to install Python 2.6 from source code

# cd /usr/local/src

# wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tgz

# tar zxvf Python-2.6.5.tgz

# cd Python-2.6.5

# ./configure –prefix=/usr/python2.6 –with-threads –enable-shared

# make

# make install

Now set symlink

# ln -s /usr/python2.6/bin/python /usr/bin/python2.6

Add python lib path

# echo ‘/usr/python2.6/lib’ >> /etc/ld.so.conf.d/python2.6.conf

# ldconfig

Now check python working by running

# /usr/bin/python2.6

June 4, 2012 Posted by | Tips & Tricks, Unix/Linux | , , , , | Leave a comment

How to Fix corrupted RPM database on CentOS

To fix the corrupted database just execute the following command from the console:-

# rm -f /var/lib/rpm/__db*

# rpm –rebuilddb -vv

June 1, 2012 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment