Archive for the ‘*NIX’ Category

postgress dump restore

pg_dumpall > db.out
psql -f db.out postgres

centos virualmin nginx php-fpm

cd /opt
git clone
tar -zcf virtualmin-nginx-fpm.tar.gz virtualmin-nginx-fpm

Webmin menu >> Mebmin module >> Install Module >> From local file >> enter /opt/virtualmin-nginx-fpm.tar.gz >> click ‘Install Module’.

ERROR 1577 (HY000): Cannot proceed because system tables used by Event Scheduler were found damaged at server start

#mysql_upgrade -u [username] -p
#mysqlcheck -u [username] -p --all-databases --check-upgrade --auto-repair
#systemctl restart mysqld

mysql> show events;
Empty set (0.00 sec)

Replase date format in file name

Mass replase date format in filename

From filename_012017.txt to filename_12017.txt

ls | sed -e 'h;s/_0/_/;x;G;s/^\(.*\)\n\(.*\)$/\ln -s \1 \2/' | sh

fail2ban openfire

#vim filter.d/openfire.conf

before = common.conf


failregex = ^ WARN.*org.jivesoftware.admin.LoginLimitManager – Failed admin console login attempt by admin from $

ignoreregex =

datepattern = ^%%Y.%%m.%%d %%H:%%M:%%S

vim jail.conf

enabled = true
filter = openfire
action = iptables-allports[]
logpath = /opt/openfire/logs/all.log

Порівняння файлів

Інколи потрібно порівняти списки в фйлах.

cat ip.block | grep -v –file /home/bagas/ip1.block

Install MongoDB + PHP

#vi /etc/yum.repos.d/mongodb-org-3.4.repo

name=MongoDB Repository

#yum install -y mongodb-org

#yum install php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache \
php-imagick php-posix php-devel php-pecl-mongo php-pecl-mongodb –enablerepo=remi

#find / -name php.ini -type f -exec sh -c “echo >> {}” \;


Встановлення MySQL 5.5 на RHEL / CentOS 6 или 5

Для CentOS / RHEL 5 32-64 бит

#rpm -Uvh

Для CentOS / RHEL 6 32-64 бит

#rpm -Uvh

#rpm -Uvh

Для CentOS / RHEL 7 32-64 бит

#rpm -Uvh remi-release-7.rpm

#yum update
#yum –enablerepo=remi install mysql mysql-server

Upgrade php5-5.4 to php56

#portmaster -o lang/php56 php5-5.4.35
#portmaster -y -D -o devel/oniguruma5 oniguruma4

#pkg info | grep php | grep 5.4 | awk ‘{print $1}’ |awk -F ‘-5.4’ ‘{print “whereis “$1}’ |sh |awk -F ‘: /usr/ports/’ ‘{print “portmaster -y -D -o “$2” “$1}’ | sed -e “s@/php5-@/php56-@” -e ‘s@$@-5.4.35@’ | sh

Sendmail on lo0

FEATURE(`msp’, `[]’)dnl

DAEMON_OPTIONS(`Name=MTA, Addr=, Port=smtp, Modifiers=bh’)

define(`SMART_HOST’, `smtp.domain’)dnl
DAEMON_OPTIONS(`Name=MTA, Addr=, Port=smtp, Modifiers=bh’)