Monthly Archives: February 2016

Database creation error: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.

Odoo issue creating new database:

Database creation error: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.

Fix:
su – postgres
psql postgres

UPDATE pg_database SET datistemplate = FALSE WHERE datname = ‘template1’;
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = ‘UNICODE’;
UPDATE pg_database SET datistemplate = TRUE WHERE datname = ‘template1’;
\c template1
VACUUM FREEZE;

centos 7 odoo 9

yum install -y epel-release
For other RHEL-based distribution, see the EPEL documentation.

yum install -y postgresql-server
postgresql-setup initdb
systemctl enable postgresql
systemctl start postgresql
yum-config-manager –add-repo=https://nightly.odoo.com/9.0/nightly/rpm/odoo.repo
yum install -y odoo
systemctl enable odoo
systemctl start odoo

directadmin block brute force

systemctl mask firewalld
systemctl stop firewalld
yum -y install iptables-services
systemctl enable iptables

cd /usr/libexec/iptables
mv iptables.init iptables.init.backup
wget -O iptables.init http://files.directadmin.com/services/all/block_ips/2.1/iptables
chmod 755 iptables.init

systemctl reload iptables

cd /usr/local/directadmin/scripts/custom
wget -O block_ip.sh http://files.directadmin.com/services/all/block_ips/2.1/block_ip.sh
wget -O show_blocked_ips.sh http://files.directadmin.com/services/all/block_ips/2.1/show_blocked_ips.sh
wget -O unblock_ip.sh http://files.directadmin.com/services/all/block_ips/2.1/unblock_ip.sh
chmod 700 block_ip.sh show_blocked_ips.sh unblock_ip.sh

touch /root/blocked_ips.txt
touch /root/exempt_ips.txt

cd /usr/local/directadmin/scripts/custom
wget -O brute_force_notice_ip.sh http://files.directadmin.com/services/all/block_ips/2.1/brute_force_notice_ip.sh
chmod 700 brute_force_notice_ip.sh

mysql kill user

mysql -e "SELECT CONCAT('KILL ',ID,';') FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'cphulkd' AND COMMAND = 'Query' AND TIME > 100 INTO OUTFILE '/var/lib/mysql-files/kill_list.txt';" && mysql -e "source /var/lib/mysql-files/kill_list.txt" && rm -rf /var/lib/mysql-files/kill_list.txt

directadmin SpamAssassin

yum -y install perl-ExtUtils-MakeMaker perl-Digest-SHA perl-Net-DNS perl-NetAddr-IP perl-Archive-Tar perl-IO-Zlib perl-Digest-SHA perl-Mail-SPF perl-IP-Country perl-Razor2 perl-Net-Ident perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-Mail-DKIM perl-DBI perl-Encode-Detect perl-HTML-Parser perl-HTML-Tagset perl-Time-HiRes perl-libwww-perl perl-Sys-Syslog

cd /usr/local/directadmin/custombuild
./build set spamassassin yes
./build spamassassin

grep “exim.spamassassin.conf” /etc/exim.conf # shuld return: .include_if_exists /etc/exim.spamassassin.conf
(wget -O /etc/exim.spamassassin.conf http://files.directadmin.com/services/exim.spamassassin.conf)
/etc/init.d/exim restart

ps ax |grep spamd

mount lvm ntfs partition

mounting lvm nested partitons

lvdisplay /dev/kvm-group/vsv1098-0bzd-kujg5vyyvoa5sqyk
fdisk -l /dev/kvm-group/vsv1098-0bzd-kujg5vyyvoa5sqyk
kpartx -a /dev/kvm-group/vsv1098-0bzd-kujg5vyyvoa5sqyk
mkdir /mnt/vsv1098-0bzd-kujg5vyyvoa5sqyk1 && mount /dev/kvm-group/vsv1098-0bzd-kujg5vyyvoa5sqyk1 /mnt/vsv1098-0bzd-kujg5vyyvoa5sqyk1
ls /mnt/vsv1098-0bzd-kujg5vyyvoa5sqyk1

centos postfix spf check

yum install perl-Mail-SPF
yum install perl-Sys-Hostname-Long

wget https://launchpad.net/postfix-policyd-spf-perl/trunk/release2.010/+download/postfix-policyd-spf-perl-2.010.tar.gz
tar -xf postfix-policyd-spf-perl-2.010.tar.gz

mkdir /usr/lib/postfix
cp postfix-policyd-spf-perl-2.010/postfix-policyd-spf-perl /usr/lib/postfix/

perl /usr/lib/postfix/postfix-policyd-spf-perl

vim /etc/postfix/main.cf
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination,check_policy_service unix:private/policy
policy_time_limit = 3600s

vim /etc/postfix/master.cf
policy unix – n n – 0 spawn user=nobody argv=/usr/bin/perl /usr/lib/postfix/postfix-policyd-spf-perl

service postfix restart

Install it or recompile php without –disable-phar

It means you are missing phar extension, you will face this error until php will show:

php -i | grep phar –color=always

Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, zip, phar
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On