19 Jan

Postfix: send email using another Postfix

Some host providers block all email ports (like TCP/25 and TCP/587). Here’s  simple of example of how to setup two STMP servers, where SMTP1 is a relay server (forwarder), and SMTP2 uses SMTP1 to send email. Both are using default configuration files with slight changes.

SMTP1 (smart host) 

This config line allows SMTP2 to send email without SMTP authorization. For the sake of security it would make sense to restrict access to port 2525 using iptabes.

mynetworks = <IP_of_SMTP2>

This goes to /etc/postfix/main.cf.

And the following

2525 inet n - n - - smtpd

goes to /etc/postfix/master.cf on SMTP1. So that Postfix opens TCP port 2525.


Add this to /etc/postfix/main.cf on SMTP2.

smtp_always_send_ehlo = yes<br />relayhost =<br /><br />

After restart you should be able to send emails from SMTP2 via SMTP1‘s using port 2525.

10 Nov

mysql: backup from remote host using ssh

Sometimes you need to dump a mysql database, and there’s no free space on the server. Here’s you can do to back up the database:

ssh -p <ssh port> user@host "mysqldump -u dbuser -ppassword dbname | gzip -9" > database.sql.gz

At the end you will get mysq database on a local server. Although ssh is slow and it would take some time to transfer the database.

27 Feb

Solving “Can’t locate File/Which.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .)”

To solve this problem:

 Can't locate File/Which.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) 
 BEGIN failed--compilation aborted

you just need to install perl-File-Which package:

yum install perl-File-Which
12 Feb

Linux: setting timezone to GMT

cp /etc/localtime /etc/localtime.default
ln -s /usr/share/zoneinfo/GMT-0 /etc/localtime

Here’s an example:

[root@d1 ~]# date
Sun Feb 12 10:24:25 CST 2017
[root@d ~]#

[root@d1 ~]# date
Sun Feb 12 16:24:51 GMT 2017
[root@d1 ~]#