Archive for the ‘Linux’ Category
fail2ban openfire
#vim filter.d/openfire.conf
[INCLUDES]
before = common.conf[Definition]
failregex = ^ WARN.*org.jivesoftware.admin.LoginLimitManager – Failed admin console login attempt by admin from
$ ignoreregex =
[Init]
datepattern = ^%%Y.%%m.%%d %%H:%%M:%%S
vim jail.conf
[openfire]
enabled = true
filter = openfire
action = iptables-allports[]
logpath = /opt/openfire/logs/all.log
Install MongoDB + PHP
#vi /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
#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 extension=mongo.so >> {}” \;
Встановлення MySQL 5.5 на RHEL / CentOS 6 или 5
Для CentOS / RHEL 5 32-64 бит
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Для CentOS / RHEL 6 32-64 бит
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Для CentOS / RHEL 7 32-64 бит
#wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#rpm -Uvh remi-release-7.rpm
#yum update
#yum –enablerepo=remi install mysql mysql-server
Varnish
Varnish 4.0:
If you are on RHEL 6 or a compatible distribution, use:
rpm –nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.0.el6.rpm
yum install varnish
For RHEL 7 and compatible distributions, use:
rpm –nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.0.el7.rpm
yum install varnish
Xen server mangment Vlan
xe network-create name-label=<name>
xe vlan-create network-uuid=<UUID> pif-uuid=<PIF> vlan=160
xe pif-reconfigure-ip uuid=<UUID> IP=<IP> netmask=<Mask> gateway=<GW> mode=static DNS=<NDS>
xe host-management-reconfigure pif-uuid=<PIF>
network_uuid=$(xe network-create name-label=hellnet)
pif_uuid=$(xe pif-list host-name-label=xcp-node device=eth1 –minimal)
xe vlan-create network-uuid=”$network_uuid” pif-uuid=”$pif_uuid” vlan=666
vm_uuid=$(xe vm-list name-label=network-web-tools –minimal)
xe vif-create vm-uuid=”$vm_uuid” network-uuid=”$network_uuid” mac=random device=1
mass find and replace
find / -name php.ini | xargs sed -i 's/expose_php = On/expose_php = Off/g'
find / -name php.ini | xargs perl -pi -e 's/expose_php = On/expose_php = Off/i'
centos sudo path
Задовбало, в centos під sudo повні шляхи набирати.
Рішеняя.
1. Правимо в себв і під рутом
.bash_profile
2.Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
(more…)
shell compare string
Потрібно було знайти присутність/входження строки в іншій, в шелл скрипті. …
#!/bin/sh
aa="String_String_String"
bb=$(echo ${aa} | grep -i "String")
if [ ${#bb} -gt 0 ];
then
echo "Exists"
else
echo "Not exists"
fi
yum -y update missing dependency libcares.so.1
При trixbox оновлені вискочило …
yum -y update missing dependency libcares.so.1 is needed by package sipsak-0.9.6.1.el5.i386
Не біда. Робимо наступне…
wget http://download.fedora.redhat.com/pub/epel/5/i386/sipsak-0.9.6-8.el5.i386.rpm
wget http://download.fedora.redhat.com/pub/epel/5/i386/c-ares-1.6.0-2.el5.i386.rpm
rpm -Uhv sipsak-0.9.6-8.el5.i386.rpm c-ares-1.6.0-2.el5.i386.rpm
yum update
Або
# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh epel-release*rpm
# yum install sipsak -enablerepo=epel