Tikejhya: Ashish Nepal

Knowledgebase

Month: May 2013

DNS Configuration

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

This is minimal setup config of DNS configuration on Centos.

# Install named
yum install bind bind-utils bind-chroot

# Location: Default location is /var/named/ which will be chrooted into /var/named/choort/var/named.

Config Location: /var/named/xxx.zonefile.xxx
/etc/named.conf

Sample named.conf

options {
        listen-on port 53 { 127.0.0.1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; };
        allow-recursion { localhost; 212.222.123.0/24; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

view "internal"
{
        match-clients {
        212.222.123.0/24;
    };

        # Define Zone File here
        # This will be accesible by those who falls under.match-clients 
        zone "ashishnepal.com" IN
        {
                type master;
                file "ashishnepal.com.zone";
                allow-update { none; }
        }

        zone "." IN {
                type hint;
                file "named.ca";
        };

};

view "external"
{
        match-clients { any; };

        zone "." IN {
                type hint;
                file "named.ca";
        };

};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
// this is from etc

Sample Zone file.

$TTL    86400 ; 24 hours could have been written as 24h or 1d
$ORIGIN ashishnepal.com.
@  1D  IN        SOA localhost. root.localhost.com. (
                              2002022401 ; serial
                              3H ; refresh
                              15 ; retry
                              1w ; expire
                              3h ; minimum
                             )
       IN  NS   @ ; in the domain

; server host definitions
www    IN  A      192.168.0.2

Script: Asterisk, FreePBX and Centos

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

This script might need some tweaking as per your environment. This script help’s you install Asterisk and freepbx on centos/redhat boxes with necessary dependency.

Bottom of the page will be updated which shall give you potential problem and solution.
#!/bin/bash

# Get ready
function getReady() {
yum -y update
yum groupinstall core
yum groupinstall base

yum install gcc gcc-c++ bison mysql-devel mysql-server php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel

pear install db
}

# Download Files
# You may want to check and replace download source with latest version.
function downloadRequired() {
cd /usr/local/src/
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
wget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz

}

# Install iksemel
function compileIksemel() {
cd /usr/local/src/
tar xf iksemel-1.4.tar.gz
cd /usr/local/src/iksemel-1.4/
./configure && make && make install

}

# Install LIBPRI
function compileLibpri() {

cd /usr/local/src/
tar xf libpri-1.4-current.tar.gz
cd /usr/local/src/libpri-1.4.14/
./configure && contrib/scripts/get_mp3_source.sh
make menuselect && make && make install && make config
}

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

# Compile and install Asterisk
function compileAsterisk() {
cd /usr/local/src/
tar xvfz asterisk-11-current.tar.gz
cd /usr/local/src/asterisk-11.1.0
./configure
contrib/scripts/get_mp3_source.sh
make menuselect

#### You Will have to select mysql_cdr options on the very first make menuselect screen, Select all 5 option to enable asteriskcdr function.

make
make install
make config
}

# Extra Sounds
function extraSounds() {

cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz
tar xfz asterisk-extra-sounds-en-gsm-current.tar.gz
rm -f asterisk-extra-sounds-en-gsm-current.tar.gz

}

# Download and extract FreePBX
function extractFreepbx() {
export VER_FREEPBX=2.11
cd /usr/local/src/
svn co http://www.freepbx.org/v2/svn/freepbx/branches/${VER_FREEPBX} freepbx
cd freepbx
}

function getApacheReady() {
adduser asterisk -M -c "Asterisk User"
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
mkdir /var/www/html
chown -R asterisk. /var/www/

sed -i 's/(^upload_max_filesize = ).*/120M/' /etc/php.ini
sed -i 's/^(User|Group).*/1 asterisk/' /etc/httpd/conf/httpd.conf

service httpd restart
}

function createDb() {
export ASTERISK_DB_PW=a2c0In
mysqladmin -u root create asterisk
mysqladmin -u root create asteriskcdrdb
mysql -u root asterisk < SQL/newinstall.sql mysql -u root asteriskcdrdb < SQL/cdr_mysql_table.sql mysql -u root -e "GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';" mysql -u root -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';" mysql -u root -e "flush privileges;" } compileIksemel compileLibpri compileAsterisk extractFreepbx getApacheReady createDb ##### Finalize ################### ./start_asterisk start ./install_amp amportal a ma installall amportal a reload ##################################

mysql slave act as master

enable log-slave updates on my.cnf

log-slave-updates

Powered by WordPress & Theme by Anders Norén