четверг, 23 марта 2017 г.

Установка ipt_netflow на Ubuntu 14.04

Ставим зависимости:
sudo apt-get install -y iptables-dev locate pkg-config make gcc git dkms libsnmp-dev snmpd
cd /tmp
tar -xf v2.2.tar.gz
cd ipt-netflow-2.2/
make all
sudo make install
sudo dkms build ipt-netflow/2.2
sudo dkms install ipt-netflow/2.2
sudo modprobe ipt_NETFLOW protocol=9 destination= inactive_timeout=10 hashsize=65535 maxflows=4000000 active_timeout=15
И направляем трафик:
sudo iptables -I INPUT -i lo -j NETFLOW

четверг, 2 марта 2017 г.

How to install Apache Kafka on Ubuntu 14.04

Install JRE:
sudo apt-get update
sudo apt-get install default-jre

Install Zoo Keeper:
sudo apt-get install zookeeperd

Restrict it to only localhost:
sudo vim /etc/zookeeper/conf/zoo.cfg 

And fix line:

And apply changes:
sudo service zookeeper restart
Then we need to download pre-compiled Kafka binaries and install them.

wget '' -Okafka_2.11-
sudo tar -xf kafka_2.11- -C /opt
cd /opt/kafka_2.11-

Create user for Kafka:
sudo useradd kafka -m 

Change permissions:
sudo chown -R kafka:kafka /opt/kafka_2.11-

Create folder for kafka logs:
sudo mkdir /tmp/kafka-logs
sudo chown kafka:kafka /tmp/kafka-logs
Move configuration to proper place:
sudo mkdir /etc/kafka
sudo cp config/ /etc/kafka

Create Kafka Upstart script:
sudo vim /etc/init/kafka.conf

 With following content:
description "Kafka Broker"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
respawn limit 2 5
env HOME=/etc/kafka
env KAFKA_HOME=/opt/kafka_2.11-
umask 007
kill timeout 300
pre-start script
    #Sanity checks
    [ -r $HOME/ ]
end script
setuid kafka
setgid kafka
exec $KAFKA_HOME/bin/ $HOME/

And finally start Kafka: