perl setting locale failed

root@server:~# /usr/lib/cgi-bin/awstats.pl -config=hottiehunter.com -update
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "ne_NP",
    LC_ADDRESS = "ne_NP",
    LC_MONETARY = "ne_NP",
    LC_NUMERIC = "ne_NP",
    LC_TELEPHONE = "ne_NP",
    LC_IDENTIFICATION = "ne_NP",
    LC_MEASUREMENT = "ne_NP",
    LC_NAME = "ne_NP",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

########## solution ################
http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl

"locale" is a subset of the user's environment that defines the user's language, country and any special variant preferences that the user wants to see in their user interface


locale             << shows locale variables
copy below export commands to ~/.bashrc  file or run below commands

export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8

dpkg-reconfigure locales

vim /etc/default/locale

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8



setup NTP on ubuntu 14.04 for utc timezone

apt-get install ntp ntpdate

apt-get install ntp ntpdate

cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1


service ntp restart

service cron stop && service cron start

Check ntp stats
================

#ntpq -pn

-p : Print a list of the peers known to the server as well as a summary of their state.
-n : Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.


# ntpq -pn

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*131.107.13.100  .ACTS.           1 u   39   64  377    6.668   -1.887   2.894
+199.101.100.221 130.207.244.240  2 u   12   64  377   89.209   -8.376   1.750
-129.250.35.251  129.250.36.26    2 u   36   64  377   25.029   -8.342   3.061
+129.6.15.28     .ACTS.           1 u   34   64  377   78.681   -4.869  27.612
-91.189.89.199   170.224.124.217  2 u   40   64  377  141.474   -6.736   2.311


watch command linux

 By default watch command runs a command or script for every two seconds by default, we can increase or decrease the interval by using -n option
minimum is 0.1 second

#watch -n 0.1 -t  lsof -i

-t = supresses the time on top of display

postfix header check

https://www.howtoforge.com/community/threads/howto-spam-control-for-postfix.48608/
http://mattshaw.org/news/how-to-filter-mail-with-postfix-header_checks/

https://posluns.com/guides/header-checks/
https://www.howtoforge.com/community/threads/postfix-header-checks.80/

ispconfig3 setup on debian jessie remove default page setting

https://www.howtoforge.com/tutorial/perfect-server-debian-8-jessie-apache-bind-dovecot-ispconfig-3

+ remove /etc/apache2/sites-enabled/000-default..conf
or echo >  /etc/apache2/sites-enabled/000-default..conf

python pip install without cache

From documentation at https://pip.pypa.io/en/latest/reference/pip_install.html#caching:
Starting with v6.0, pip provides an on by default cache which functions similarly to that of a web browser. While the cache is on by default and is designed do the right thing by default you can disable the cache and always access PyPI by utilizing the --no-cache-dir option.

pip install pillow --no-cache-dir













install nethogs on centos 7

I’ve just found that ‘nethogs’, a bandwidth monitoring software is not covered in the EPEL for Centos 7. This is a memo for how to install nethogs on CentOS 7.

1. Install the dependencies necessary.
yum install libpcap-devel -y
2. Download and install the RPM package.
rpm -ivh http://cdn.kanachan.me.uk/dl/rpms/nethogs/nethogs-0.8.0-1.el6.x86_64.rpm

pflogsumm postfix mail log analyzer pflog


yum install perl-Date-Calc

sudo curl -O http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz

tar -xzf pflogsumm-1.1.3.tar.gz

mv pflogsumm-1.1.3 pflogsumm

chmod +x pflogsumm/pflogsumm.pl

perl   /usr/local/pflogsumm/pflogsumm.pl   /var/log/maillog

# generate log summary for yesterday

[root@mail ~]# perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog


To run cronjob for pflogsumm

crontab -e

# send mail log summary at AM 1:00 everyday to root

00 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' root

http://jimsun.linxnet.com/postfix_contrib.html

https://www.dropbox.com/s/rkbp13lz4eon988/pflogsumm-1.1.3.tar.gz?dl=0

start a daemon at startup ubuntu

  • To start a daemon at startup:
    update-rc.d service_name defaults
    
  • To remove:
    update-rc.d -f service_name remove
    
defaults => default run levels 2,3,4 and 5
Example:
update-rc.d tomcat7 defaults

difference between use of port 25 465 and 587

port 25 is used for transmitting email between MTA's also known as SMTP relaying.

port 465 is no longer used on ssl-smtp(although port 465 was never published as an official SMTP transmission or submission channel by the IETF ) and IANA has now assigned 465 to new service called "urd".

The RFC proposed a split of the traditional message submission and message relay concept. The RFC defined that message submission should occur over port 587 to ensure new policy and security requirements don't interfere with the traditional relay traffic over message relay port 25.
Port 587 is for msa - it is almost like standard SMTP port. SSL encryption may be started by STARTTLS command at SMTP level if server supports it and your ISP does not filter server's EHLO reply (reported 2014 Nov). MSA should accept email after authentication (e.g. after SMTP AUTH). It helps to stop outgoing spam when netmasters of DUL ranges can block outgoing connections to SMTP port (port 25)