WordPress Mail – VPS CentOS 6.2


I recently re-installed centos on the VPS and almost forgot that I needed sendmail on the server to send out my daily backups. The backup is run from a plugin called WordPress Database Backup.

Installation is fairly easy with the following steps:

Check if sendmail has been installed

 [root@sdb ~]# rpm -qa sendmail
[root@sdb ~]#

if it is, update to the latest version

yum update sendmail

Else, let’s install it.

yum install sendmail

Output:

[root@sdb ~]# yum install sendmail
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
epel/metalink                                            |  16 kB     00:00
* base: mirror01.th.ifl.net
* epel: mirror01.th.ifl.net
* extras: mirror01.th.ifl.net
* ius: mirrors.ircam.fr
* rpmforge: www.mirrorservice.org
* updates: mirror01.th.ifl.net
base                                                     | 3.7 kB     00:00
epel                                                     | 4.0 kB     00:00
epel/primary_db                                          | 4.4 MB     00:00
extras                                                   | 3.5 kB     00:00
ius                                                      | 2.2 kB     00:00
ius/primary_db                                           |  71 kB     00:00
rpmforge                                                 | 1.9 kB     00:00
updates                                                  | 3.5 kB     00:00
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package sendmail.x86_64 0:8.14.4-8.el6 will be installed
–> Processing Dependency: procmail for package: sendmail-8.14.4-8.el6.x86_64
–> Processing Dependency: libhesiod.so.0()(64bit) for package: sendmail-8.14.4-                                                                                     8.el6.x86_64
–> Running transaction check
—> Package hesiod.x86_64 0:3.1.0-19.el6 will be installed
—> Package procmail.x86_64 0:3.22-25.1.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package           Arch            Version                  Repository     Size
================================================================================
Installing:
sendmail          x86_64          8.14.4-8.el6             base          717 k
Installing for dependencies:
hesiod            x86_64          3.1.0-19.el6             base           20 k
procmail          x86_64          3.22-25.1.el6            base          163 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 900 k
Installed size: 1.9 M
Is this ok [y/N]:

Y to continue, the installation will complete.

Start Sendmail

service sendmail start

Accept incoming mail

You will need to modify the file in /etc/mail/local-host-names through vi

vi /etc/mail/local-host-names

Add your server hostnames to accept mail from.

In my scenario, it would be gulshan.beejan.com

Restart Sendmail Service

service sendmail restart

Testing was done, and it worked. =)


Read More

Squid Statistics and Info Web Interface


I have been looking for a squid statistics web interface for a long time, and i finally got one. It was fairly easy to install and configure.

The name of the app is SARG and can be downloaded freely from http://sarg.sourceforge.net/sarg.php

Depending on your architecture, the installation command is

rpm -Uvh http://pkgs.repoforge.org/sarg/sarg-2.3.1-1.el6.rft.x86_64.rpm

Before using it, you might wish to configure the output generation of sarg by

vi /etc/sarg/sarg.conf

and change the output_dir /var/www/html/squid/OUT-ONE to your www directory

To use, run the following in a terminal or add it to cron to run it daily

sarg

This command will generate html files for stats in the specified output_dir

That’s all folks.

Screenshot of SARG Generated files:

Read More

Linux: Deleting old logs


We all know how annoying it can get to have old log files that are not really being used on our production server. Hence, it would be great to implement a script to perform the task on a cronjob so that we can relax as lazy system engineers 🙂 🙂

The script to delete files older than 15 days would be as follows:

#!/bin/bash

# File is saved as root, in /scripts/delete_old_logs.sh

# File needs to be chmod 777 to work

DAYS=15

PATH_TO_LOGS=/var/log

find $PATH_TO_LOGS -type f -mtime +$DAYS -exec rm -rf {} ;

Next, we can schedule it to run on a daily basis, every 11pm:

crontab -e

add this line

*    23    *    *    *    /scripts/delete_old_logs.sh

Read More

How to Install & Configure FTP Server on CentOS 6.2


I recently upgraded the server to CentOS 6.2 x64, which involved backing up to another server, clean re-install with cherokee’s latest version and some other configurations. Among those, was the ftp configuration which has been made by vsftpd.

The installation is quite straight-foward, run the following in a terminal as root:

yum install vsftpd

You will need to modify a few parameters in your configuration file to get it running smoothly.

vi /etc/vsftpd/vsftpd.conf

 

Set the following:

anonymous_enable=NO

uncomment the following:

ascii_upload_enable=YES

ascii_download_enable=YES

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chrootlist

ls_recurse_enable=YES

 

In this process, the user’s home directory will become FTP home directory, which is what we want really.

You need to create an ftp chroot list in /etc/vsftpd/chrootlist by:

vi /etc/vsftpd/chrootlist

Add the ftp created user in this file.

service vsftpd start

 

Read More