Installation Script for CentOS (32 Bit)


#!/bin/bash

clear
getconf LONG_BIT

yum update

wwwpath=”/var/www/html”
radhost=”localhost”
myusr_rad=”radius”
mypsw_radius=”radius123″
ctshost=”localhost”
myusr_cts=”conntrack”
mypsw_cts=”conn123″
radusr=”root”
httpusr=”apache”

sqlpass=”radius”
rmurl=”http://talhaali.byethost13.com/files/rm_related/
temp=”temp”

PKG=”nano wget curl net-tools lsof mc make gcc libtool-ltdl curl httpd mysql-server mysql-devel net-snmp net-snmp-utils php php-mysql php-gd php-snmp php-process”

service iptables stop
chkconfig iptables off

echo “net.ipv6.conf.all.disable_ipv6 = 1” >> /etc/sysctl.conf
echo “net.ipv6.conf.default.disable_ipv6 = 1” >> /etc/sysctl.conf
echo “net.ipv6.conf.lo.disable_ipv6 = 1” >> /etc/sysctl.conf

echo 0 > /selinux/enforce
sed -i “s/=enforcing/=disabled/g” /etc/selinux/config

sleep 3
yum install -y wget
{
if [ ! -d “/temp” ]; then
echo
mkdir /$temp
else
echo
echo
fi
}

rm -fr /$temp/radiusmanager.
rm -fr /$temp/freeradius.
rm -fr /$temp/libltd.
rm -fr /$temp/ioncube.
rm -fr /$temp/php-my*
rm -fr /$temp/libmy*
rm -fr /$temp/rm4.txt

sleep 3
cd /$temp
wget -q $rmurl/rm4.txt
{
if [ ! -f /$temp/rm4.txt ]; then
exit 0
fi
}

wget $rmurl/radiusmanager-4.1.0.tgz
{
if [ ! -f /$temp/radiusmanager-4.1.0.tgz ]; then
echo .
exit 0
fi
}

yum install -y $PKG

wget www.dmasoftlab.com/cont/download/libmcrypt-2.5.8-9.el6.i686.rpm
wget www.dmasoftlab.com/cont/download/php-mcrypt-5.3.2-3.el6.i686.rpm
rpm -i libmcrypt-2.5.8-9.el6.i686.rpm
rpm -i php-mcrypt-5.3.2-3.el6.i686.rpm
sleep 3

echo .
wget www.dmasoftlab.com/cont/download/ioncube_loaders_lin_x86.tar.gz
{
if [ ! -f /$temp/ioncube_loaders_lin_x86.tar.gz ]; then
echo .
exit 0
fi
}
tar zxvf ioncube_loaders_lin_x86.tar.gz
mkdir /usr/local/ioncube
cp -fr /$temp/ioncube/* /usr/local/ioncube/

echo .
echo “zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.3.so” >> /etc/php.ini
echo .

wget www.dmasoftlab.com/cont/download/freeradius-server-2.2.0-dma-patch-2.tar.gz
{
if [ ! -f /$temp/freeradius-server-2.2.0-dma-patch-2.tar.gz ]; then
echo .
exit 0
fi
}
echo .
sleep 3
cd /$temp
tar zxvf freeradius-server-2.2.0-dma-patch-2.tar.gz
cd /$temp/freeradius-server-2.2.0/
./configure
make
make install

radiusd -X
ldconfig
sleep 3

mysqladmin -u root password ‘radius’
mysql -u root -p$sqlpass -e “create database radius”;
mysql -u root -p$sqlpass -e “create database conntrack”;
mysql -u root -p$sqlpass -e “CREATE USER ‘$myusr_rad’@’$radhost’ IDENTIFIED BY ‘$mypsw_radius’;”
mysql -u root -p$sqlpass -e “CREATE USER ‘$myusr_cts’@’$radhost’ IDENTIFIED BY ‘$mypsw_cts’;”
mysql -u root -p$sqlpass -e “GRANT ALL ON radius.* TO radius@$radhost;”
mysql -u root -p$sqlpass -e “GRANT ALL ON conntrack.* TO conntrack@$radhost;”

mv $wwwpath/radiusmanager/config/paypal_cfg.php.dist $wwwpath/radiusmanager/config/paypal_cfg.php
mv $wwwpath/radiusmanager/config/netcash_cfg.php.dist $wwwpath/radiusmanager/config/netcash_cfg.php
mv $wwwpath/radiusmanager/config/authorizenet_cfg.php.dist $wwwpath/radiusmanager/config/authorizenet_cfg.php
mv $wwwpath/radiusmanager/config/dps_cfg.php.dist $wwwpath/radiusmanager/config/dps_cfg.php
mv $wwwpath/radiusmanager/config/2co_cfg.php.dist $wwwpath/radiusmanager/config/2co_cfg.php
mv $wwwpath/radiusmanager/config/payfast_cfg.php.dist $wwwpath/radiusmanager/config/payfast_cfg.php

chown $httpusr $wwwpath/radiusmanager/config
chown $httpusr $wwwpath/radiusmanager/config/system_cfg.php
chown $httpusr $wwwpath/radiusmanager/config/paypal_cfg.php
chown $httpusr $wwwpath/radiusmanager/config/netcash_cfg.php
chown $httpusr $wwwpath/radiusmanager/config/authorizenet_cfg.php
chown $httpusr $wwwpath/radiusmanager/config/dps_cfg.php
chown $httpusr $wwwpath/radiusmanager/config/2co_cfg.php
chown $httpusr $wwwpath/radiusmanager/config/payfast_cfg.php
mkdir -p $wwwpath/radiusmanager/tmpimages
chown $httpusr $wwwpath/radiusmanager/tmpimages
chown $httpusr $wwwpath/radiusmanager/tftpboot
chmod 600 $wwwpath/radiusmanager/config/system_cfg.php
chmod 600 $wwwpath/radiusmanager/config/paypal_cfg.php
chmod 600 $wwwpath/radiusmanager/config/netcash_cfg.php
chmod 600 $wwwpath/radiusmanager/config/authorizenet_cfg.php
chmod 600 $wwwpath/radiusmanager/config/dps_cfg.php
chmod 600 $wwwpath/radiusmanager/config/2co_cfg.php
chmod 600 $wwwpath/radiusmanager/config/payfast_cfg.php
chmod 644 $wwwpath/radiusmanager/config/docsis_keyfile
chmod 644 $wwwpath/radiusmanager/config/docsis_template

cd /$temp/radiusmanager-4.1.0/
chmod 755 bin/rm*

cp bin/rm* /usr/local/bin

cp bin/rootexec /usr/local/sbin
chmod 4755 /usr/local/sbin/rootexec

cp etc/radiusmanager.cfg /etc
chown $radusr /etc/radiusmanager.cfg
chmod 600 /etc/radiusmanager.cfg

cp rc.d/rmpoller /etc/init.d
chown root.root /etc/init.d/rmpoller
chmod 755 /etc/init.d/rmpoller
chkconfig –add rmpoller

cp rc.d/rmconntrack /etc/init.d
chown root.root /etc/init.d/rmconntrack
chmod 755 /etc/init.d/rmconntrack
chkconfig –add rmconntrack
chmod 755 rc.d/redhat/radiusd

cp rc.d/redhat/radiusd /etc/init.d
chkconfig –add radiusd

cp etc/logrotate.d/radiusd /etc/logrotate.d/radiusd
chown $httpusr /usr/local/etc/raddb
chown $httpusr /usr/local/etc/raddb/clients.conf
sleep 3

service httpd restart
chkconfig –add mysqld
chkconfig –add httpd
chkconfig –add radiusd
chkconfig mysqld on
chkconfig httpd on
chkconfig radiusd on

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s