четверг, 24 декабря 2015 г.

Install Apache 2.4 on CentOS 6.7

yum install epel-release
yum install make gcc automake zlib-devel bison cmake libtool wget gcc-c++ unzip ncurses-devel openssl-devel pcre-devel libxml2-devel curl-devel gd-devel libxslt-devel apr-devel apr-util-devel libmcrypt libmcrypt-devel


cd /tmp
wget http://apache-mirror.rbc.ru/pub/apache//httpd/httpd-2.4.18.tar.gz
wget http://apache-mirror.rbc.ru/pub/apache//apr/apr-1.5.2.tar.gz
wget http://apache-mirror.rbc.ru/pub/apache//apr/apr-util-1.5.4.tar.gz

Extract all
tar -xzvf *

mv apr-1.5.2 apr
mv apr-util-1.5.4 apr-util
mv -R apr apr-util httpd-2.4.18/srclib

Configure link for information:
https://httpd.apache.org/docs/2.4/programs/configure.html

./configure \
"--prefix=/etc/httpd" \
"--exec-prefix=/etc/httpd" \
"--sysconfdir=/etc/httpd/conf" \
"--bindir=/usr/bin" \
"--sbindir=/usr/sbin" \
"--enable-so" \
"--with-included-apr" \
"--with-included-apr-util" \
"--with-mpm=prefork" \
"--datadir=/var/www" \
"--localstatedir=/var" \
"--enable-ssl" \
"--enable-rewrite" \
"--enable-expires" \
"--with-ssl=/usr" \
"--enable-headers"

#"--includedir=/usr/include/apache" \
#"--libexecdir=/usr/lib/apache" \
#"--enable-dav" \
#"--enable-dav-fs" \
#"--enable-dav-lock" \
#"--enable-suexec" \
#"--enable-deflate" \
#"--enable-unique-id" \
#"--enable-mods-static=most" \
#"--enable-reqtimeout" \
#"--enable-proxy" \
#"--with-suexec-caller=apache" \
#"--with-suexec-docroot=/" \
#"--with-suexec-gidmin=100" \
#"--with-suexec-logfile=/var/log/httpd/suexec_log" \
#"--with-suexec-uidmin=100" \
#"--with-suexec-userdir=public_html" \
#"--with-suexec-bin=/usr/sbin/suexec" \
#"--with-pcre=/usr" \
#"--enable-logio" \
make
make install


vi /etc/init.d/httpd

#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible  \
#           server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
#  implementing the current HTTP standards.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/bin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
    echo -n $"Stopping $prog: "
    killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=6
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        # Force LSB behaviour from killproc
        LSB=1 killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
        if [ $RETVAL -eq 7 ]; then
            failure $"httpd shutdown"
        fi
    fi
    echo
}

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
        status -p ${pidfile} $httpd
    RETVAL=$?
    ;;
  restart)
    stop
    start
    ;;
  condrestart|try-restart)
    if status -p ${pidfile} $httpd >&/dev/null; then
        stop
        start
    fi
    ;;
  force-reload|reload)
        reload
    ;;
  graceful|help|configtest|fullstatus)
    $apachectl $@
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
    RETVAL=2
esac

exit $RETVAL



Install PHP 5.6

wget -O php-5.6.16.tar.gz http://nl1.php.net/get/php-5.6.16.tar.gz/from/this/mirror
tar -xzvf php-5.6.16.tar.gz && cd php-5.6.16

yum install libmcrypt libmcrypt-devel 

Configure link for information:
https://secure.php.net/manual/en/configure.about.php

./configure \
--with-apxs2=/usr/sbin/apxs \
--with-config-file-path=/etc
--with-curl=/usr \
--with-gd \
--with-gettext \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-kerberos \
--with-openssl \
--with-mcrypt=/usr/local/lib \
--with-mhash \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pcre-regex \
--with-pear \
--with-png-dir=/usr \
--with-xsl \
--with-zlib \
--with-zlib-dir=/usr \
--with-iconv \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-soap \
--enable-sockets \
--enable-mbstring \
--enable-zip \
--enable-wddx 


 make && make install

cp php.ini-production /etc/php.ini

vi  /etc/httpd/conf.d/php.conf 

#php dir conf if php.ini not loaded
# PHPIniDir "/etc"
AddHandler php5-script .php

AddType text/html .php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

пятница, 6 ноября 2015 г.

Install Looking Glass

Link for download LookingGlass is below topic.

OS: Centos 6.7

useradd lg
usermod -a -G apache lg

mkdir -p /opt/lg
bzip2 -d lg-1.9.tar.bz2
tar xvf lg-1.9.tar
cp lg.cgi lg.conf favicon.ico /opt/lg
chmod 644 /opt/lg/*
chmod 755 /opt/lg/lg.cgi
chmod g+x /home/lg

Install Perl modules:

yum install perl-XML-LibXML perl-libxml-perl gcc make perl-CPAN

Install Perl modules from CPAN:

perl -MCPAN -e shell
force install DB_File
force install Math::GMP
force install Archive::Zip
force install Math::Pari
force install Net::SSH::Perl
Configure ENV variable  and UTF8-encode:

vi lg.cgi

$ENV{HOME} = "/home/lg/";

$port = 22 if ($port eq "");
                $ssh = Net::SSH::Perl->new($host, port => $port);
                utf8::encode ($password);
                utf8::encode ($login);
                $ssh->login($login, $password);
                my ($out, $err) = $ssh->cmd("$command");
                @output = split (/\n/, $out);

vi /etc/httpd/conf.d/lg.conf

AddHandler cgi-script .cgi

<VirtualHost *:80>
    ScriptAlias /lg /opt/lg/lg.cgi

    <Directory "/opt/lg">
        Options -Indexes FollowSymLinks MultiViews +ExecCGI
        AllowOverride All
    </Directory>

    ServerAdmin admin@domain.ru
    DocumentRoot /opt/lg
    ServerName domain.com
    ErrorLog logs/lg-error_log
    CustomLog logs/lg-access_log common
</VirtualHost>

service httpd restart

Download from Google Drive

вторник, 19 августа 2014 г.

Как удалить несуществующую сетевую карту?

После переустановки материнской платы может случиться, что предыдущий сетевой адаптер все еще считается Windows существующим устройством в системе. Установленная ранее сетевая карта оказывается скрытой и по-умолчанию не видна в оборудовании системы. Проблема состоит в том, что вы не можете назначить старый IP адрес новому сетевому адаптеру, потому как данный адрес еще используется старой сетевой. В данном случае система сообщит об ошибке: «IP-адрес, указанный для этого сетевого адаптера, уже назначен другому адаптеру».

вторник, 5 августа 2014 г.

Установка Bareos и Webacula на CentOS

1. Подключаем репозиторий и устанавливаем bareos и webacula:
cd /etc/yum.repos.d
wget http://download.bareos.org/bareos/release/13.2/CentOS_6/bareos.repo
wget http://download.bareos.org/bareos/contrib/CentOS_6/contrib.repo
Прописываем enabled=1 в файлах репозиториях.
yum install mysql-server bareos php5-ZendFramework php5-ZendFramework-captcha php5-ZendFramework-extras webacula

воскресенье, 18 августа 2013 г.

Лицензионный Достоевский или конец эры бумажных книг

Итак, обычная московская квартира, 2018 год.
— Пап, можно я с твой карточки сниму 99 баксов? За книжку надо заплатить…-
— А, что за книжка?
— Ну, этот. Достоевский. «Преступление и наказание».
— Так зачем покупать. У нас же есть.
— Да? А в каком файле?
— Причём тут файлы. Вот же он, на полке стоит…
— Фу-ууу. Это же бумажная книжка!

вторник, 25 июня 2013 г.

Algorithm of Spanning Tree Protocol


I think that I shall never see
a graph more lovely than a tree.
A tree whose crucial property
is loop-free connectivity.
A tree that must be sure to span
so packet can reach every LAN.
First, the root must be selected.
By ID, it is elected.
Least-cost paths from root are traced.
In the tree, these paths are placed.
A mesh is made by folks like me,
then bridges find a spanning tree.

Headers, MTU and MSS


HEADERS (bytes):

tcp=20
udp=8
ip=20
eth=18 (without vlan tag, DA(6)+SA(6)+FrameType(2)+FCS/CRC(4)=18)
eth=22 (with vlan tag, DA(6)+SA(6)+802.1q-tag(4)+FrameType(2)+FCS/CRC(4)=22)
data=46-1500, MAX Ethernet frame=1518/1522, 802.3 MTU=1492
Full physical frame is Preambula(8)+Ethernet frame(802.3)+interframe gap(12)=1538/15
eth-payload=1500
gre=4
nvgre=8
vlanid=4
vxlan=8
mgre=4
esp=20
NAT-T udp=12
ppp=2
pppoe=6
l2tp=16

Ethernet (802.3)
eth:ip:tcp:data
MTU=1500
MSS=1500-8=1492

VXLAN
eth:ip:udp:vxlan:original-eth-without-vlan
MTU=20+8+8+(18+1500)=1554

NVGRE
eth:ip:nvgre:original-eth-with-vlan
MTU=20+8+(22+1500)=1550

"Classic" VPN Site-to-Site Connection Using IPsec Tunnel Mode
eth:ip:esp:ip:tcp:data

Cisco's IPsec Virtual Tunnel Interface (VTI)s
eth:ip:esp:ip:tcp:data
MTU=1460
MSS=1440

Point-to-Point GRE Tunnels
eth:ip:gre:ip:tcp:data
MTU=1476
MSS=1436

Point-to-Point GRE Tunnels + IPsec: ESP in Tunnel Mode
eth:ip:esp:ip:gre:ip:tcp:data
MTU=1500-(20+20+20+4)=1436
MSS=1396

Point-to-Point GRE Tunnels + IPsec: ESP in Transport Mode
eth:ip:esp:gre:ip:tcp:data
MTU=1456
MSS=1416

Point-to-Multipoint mGRE Tunnels + IPsec: ESP in Transport Mode
eth:ip:esp:mgre:ip:tcp:data
MTU=1500-(20+20+4)=1456
MSS=1416

L2TP/IPsec: ESP in Transport Mode
eth:ip:esp:udp:l2tp:ppp:ip:tcp:data
MTU=1500-(20+20+8+16+2)=1434
MSS=1404

L2TP/IPsec: ESP in Transport Mode, NAT-T
eth:ip:NAT-T udp:esp:udp:l2tp:ppp:ip:tcp:data
MTU=1500-(20+12+20+8+16+2)=1422
MSS=MTU-40=1382

L2TP:
eth:ip:udp:l2tp:ppp:ip:tcp:data
MTU=1454
MSS=1434

PPPoE:
eth:pppoe:ppp:ip:tcp:data
MTU=1492
MSS=1452

PPTP:
eth:ip:gre:ppp:ip:tcp:data
MTU=1474
MSS=1434