Error while updating YUM

Posted in VPS/Dedicated server on September 18, 2012 by Aparna Murthy

Today While updating yum on one of the server I  face the error as below ::


[root@323191 yum.repos.d]# yum update
Loaded plugins: fastestmirror
Setting up Remove Process
No Match for argument: epel
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/”, line 285, in user_main
errcode = main(args)
File “/usr/share/yum-cli/”, line 136, in main
result, resultmsgs = base.doCommands()
File “/usr/share/yum-cli/”, line 438, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File “/usr/share/yum-cli/”, line 419, in doCommand
return base.erasePkgs(extcmds)
File “/usr/share/yum-cli/”, line 861, in erasePkgs
self._checkMaybeYouMeant(arg, always_output=False)
File “/usr/share/yum-cli/”, line 647, in _checkMaybeYouMeant
matches = self.doPackageLists(patterns=[arg], ignore_case=False)
File “/usr/lib/python2.6/site-packages/yum/”, line 2327, in doPackageLists
avail = self.pkgSack.returnNewestByNameArch(patterns=patterns,
File “/usr/lib/python2.6/site-packages/yum/”, line 897, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File “/usr/lib/python2.6/site-packages/yum/”, line 682, in _getSacks
File “/usr/lib/python2.6/site-packages/yum/”, line 265, in populateSack
File “/usr/lib/python2.6/site-packages/yum/”, line 92, in doSetup‘postreposetup’)
File “/usr/lib/python2.6/site-packages/yum/”, line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))


Resolution ::

Open File: /etc/yum/pluginconf.d/fastestmirror.conf

vi /etc/yum/pluginconf.d/fastestmirror.conf

Change enabled=1 TO enabled=0

and Fire command

[root@323191 yum.repos.d]# yum clean all
[root@323191 yum.repos.d]# yum update
It should be fixed 🙂 🙂 🙂

How to Install FFmpeg on CentOS via Yum

Posted in Apache, VPS/Dedicated server on September 18, 2012 by Aparna Murthy

The easiest way to install FFMPEG and other modules is through yum. Following are the steps given to install ffmpeg with yum command.

First we will have to install the DAG RPM repositories which includes amount of rpm packages. It’s very easy. Just install the latest rpmforge-release package for your distribution and architecture.

This will automatically install the configuration and GPG keys that are for safely installing RPMforge packages.

Please select the correct command from the following list:

* Supported Red Hat Enterprise Linux 5 / i386:

rpm -Uhv

* Red Hat Enterprise Linux 5 / x86_64:

rpm -Uhv

Installing FFMPEG.

yum install ffmpeg ffmpeg-devel

Install FFMPEG-PHP Extension

FFmpeg-php is a very good extension and wrapper for PHP which can pull useful information about video through API interface. Inorder to install it you will need to download the source file and then compile and install extension in your server.

cd /usr/local/src


tar -xjf ffmpeg-php-0.6.0.tbz2


make install

Once you have done that without any problems then you will see the php extension file /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ and you will need mention that extension in php.ini file.

vi  /usr/local/lib/php.ini OR /etc/php.ini

Put the below two lines at the end of the php.ini file


Then restart apache using — service httpd restart

Installing Mplayer + Mencoder

Just issue the following yum commands to install the rest of the packages.

yum install mplayer mencoder

Installing FlvTool2

Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.

If you are on Centos 5 try yum install flvtool2 with dag repository and if you get package not found you will need to manually download and compile the flvtool2. You can download latest version of flvtool2 from:-


ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install

If you get command not found error, it probably means that you dont have ruby installed. Being a cpanel server you can do that using /scripts/installruby OR yum install ruby

You are done!!!!

How to Install Mod_Pagespeed on Centos+cPanel ?

Posted in Apache, Cpanel/WHM with tags on September 2, 2012 by Aparna Murthy

>> What is mod_pagespeed ?

mod_pagespeed is basically an open-source module for Apache which does the task of optimizing the web-pages and its resources. Its an automated process and makes use of the filters for enhancment of web performance by re-writing the resources. Performance enhancement for
Apache HTTP Server can easily be achieved using the module.
Installation ::

1. Login to your server using root login

2. Before you start the installation, make sure “mod_deflate” is enabled via easy apache.

3. Determine the version of your kernel via the command ::

# uname -a

In my case its a 64 bit version

root@server [~]# uname -ar
Linux 2.6.18-028stab099.3 #1 SMP Wed Mar 7 15:20:22 MSK 2012 x86_64 x86_64 x86_64 GNU/Linux
4. Once you deteemind the vesion, Go to the directory ::

root@server [~]# cd /usr/local/src

6. Create a directory mod_pagespeed

root@server [~]# mkdir mod_pagespeed
v# cd mod_pagespeed

7. Now download the source of mod_pagespeed using the link ::

>> Link ::
>> Go to the link ::
>> Right click on the “mod_pagespeed 64-bit .rpm (CentOS) and copy the link location

NOTE :: Location is ::

8 . Download >>

# root@server [~]# wget

9. Install the downloaded RPM ::

# root@server [~]# rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv

The outpu should be as below ::
root@server [~]rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv
3135 blocks

10. Copy the to the apache modules ::

root@server [~]# cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/ /usr/local/apache/modules/

And then copy the mod_pagespeed.conf to the apache conf directory ::

root@server [~]# cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/

11. Give permissions ::

root@server [~]# chmod 755 /usr/local/apache/modules/

12. Create cache files for the mod_pagespeed ::

root@server [~]# mkdir /var/mod_pagespeed/{cache,files} -p

13. Change ownership of cache files ::

root@server [~]# chown nobody:nobody /var/mod_pagespeed/*

>> Mod_pagespeed needs mod_deflate to be loaded in Apache. If it is not loaded tyou can include it using the command below ::
/usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-2.2.22/modules/filters/mod_deflate.c

NOTE :: the apache version “httpd-2.2.16” could be change according to your server. In my case its httpd-2.2.22.

14. After that, we’ll have to edit the mod_pagespeed configuration file located at /usr/local/apache/conf/pagespeed.conf to reflect the correct paths,

root@server [~]# vi /usr/local/apache/conf/pagespeed.conf
<IfVersion < 2.4>
LoadModule pagespeed_module /usr/local/apache/modules/

<IfModule !mod_deflate.c>
LoadModule deflate_module /usr/local/apache/modules/

15. After that, we’ll need to include the mod_pagespeed configuration in Apache’s configuration file (/usr/local/apache/conf/httpd.conf):

Include “conf/pagespeed.conf”

In order to keep the changes permanant run the command below ::

root@server [~]#/usr/local/cpanel/bin/apache_conf_distiller –update

This will then ensure that your changes are integrated into the templates which WHM cPanel uses to regenerate the httpd.conf file after an automatic update.

You’re done now restart the apache ::

root@server [~]# service httpd restart

If everything is fine, apache will start normally and as your domains begin to get hits, you will see data being written in to /var/mod_pagespeed/*.

How to install A2billing with Asterisk on Centos 5

Posted in Uncategorized on August 26, 2012 by Aparna Murthy

Asterisk / A2Billing on centos

What is A2Billing

A2Billing is a class 4 and class 5 softswitch with inline billing, designed for providing residential, business and wholesale VoIP services, calling cards.

Prerequisites  ::

>> Centos 5 clean and scratch server with yum installed.

>> First the get version of OS and 64bit/32Bit

You can get the version by following the command below ::

#cat /etc/*release*

>> Kernel  versin using the below command ::

#uname -a

>> disable firewall first. re-enable it later.

# service iptables stop

Initial setup to proceed with installation ::

First Get everything up to date on your server, you can update it via yum using commands below ::

#yum -y upgrade

#yum -y update


#yum -y update

Need to install first the required modules on the server  as below ::

If you are server version is [32 bit] (i686) then do follow the command below to install modules ::

#yum -y install gcc gcc-c++ kernel-devel bison openssl-devel libtermcap-devel ncurses-devel doxygen curl-devel newt-devel mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron speex speex-devel unixODBC unixODBC-devel libtool-ltdl  libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel  mysql-server php-mysql php-mbstring php-mcrypt flex screen  libxml2 libxml2-devel libtiff libtiff-devel

If you are server version is [64 bit] (x86_64) then do follow the command below to install modules ::

#yum -y install gcc.x86_64 gcc-c++.x86_64 kernel-devel.x86_64 bison.x86_64 openssl-devel.x86_64  libtermcap-devel.x86_64 ncurses-devel.x86_64 doxygen.x86_64 curl-devel.x86_64 newt-devel.x86_64  mlocate.x86_64 lynx.x86_64 tar.x86_64 wget.x86_64 nmap.x86_64 bzip2.x86_64 mod_ssl.x86_64  crontabs.x86_64 vixie-cron.x86_64 speex.x86_64 speex-devel.x86_64 unixODBC.x86_64  unixODBC-devel.x86_64 libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64 mysql-connector-odbc.x86_64 mysql.x86_64 mysql-devel.x86_64 mysql-server.x86_64 php-mysql.x86_64 php-mbstring.x86_64  php-mcrypt.x86_64 flex.x86_64 screen.x86_64 libxml2-devel

#yum -y install libidn-devel krb5-devel krb5-libs zlib-devel libidn-devel

#ln -sf /lib64/ /lib64/


NOTE :: A2billing Asterisk required PHP 5.2 or higher.

Now installation of Asterisk ::

#groupadd asterisk
#useradd -c “asterisk PBX” -d /var/lib/asterisk -g asterisk asterisk

#cd /usr/src/


#tar -zxvf asterisk-

#cd asterisk-

#make clean


#make menuselect

(setup what you need in the menu manager,include mysql)


#make install

#make samples

#make progdocs

#make config

#chkconfig asterisk on

#asterisk -vvvvvvvvvvvvvvvvvvvc

#core stop now

#service asterisk start

>> edit the following files in /etc/asterisk:

#nano /etc/asterisk/indications.conf – Change default country (its not manadatory do modification if required )

#nano /etc/asterisk/modules.conf – Uncomment the line ‘preload =>’

#nano /etc/asterisk/modules.conf – Add ‘noload =>’ to bottom of file

#nano /etc/asterisk/modules.conf – Add ‘noload =>’ to the bottom of the file

Now copy and paste the below code to the specified files using the commands as below ::

# rm /etc/asterisk/extensions.ael

# cat > /etc/asterisk/extensions.conf << EOF











exten => _.,1,Goto(i,1)

exten => i,1,NoOp(Invalid)

exten => i,n,Congestion()

exten => i,n,Hangup()

exten => h,1,NoOp(Hanging up)


# rm /etc/asterisk/extensions.lua

# cat > /etc/asterisk/sip.conf << EOF
























































You’re done with Asterisk installation here 🙂 🙂 🙂

Now lets get a2Billing for both asterisk server and Master SQL( just gonna use the sql for sql)

# cd /usr/src

# mkdir a2billing

# cd  a2billing

Download the a2billing source from the link below ::

Click on download, it will download the source at your local computer and then upload it to your server using SFTP.

Once uploaded. extract it ::

tar -zxvf Star2Billing-a2billing-v1-current-0-g95789f5.tar.gz

cd Star2Billing-a2billing-d960375

then move all the files from Star2Billing-a2billing-d960375   to a2billing

#scp -r -p /usr/src/a2billing/Star2Billing-a2billing-d960375/ /usr/src/a2billing/

Extraction done. Then ::

>> On Master SQL Server do the following

# cd /usr/src/a2billing/DataBase/mysql-5.x

# mysql -u root -p < a2billing-createdb-user.sql;

# mysql -u root -p mya2billing < a2billing-mysql-schema-v1.7.0.sql;

We will need to make a new user on the master SQL server that has permissions remotely.

# mysql> CREATE USER ‘a2bMySQL’@’10.10.10.%’ IDENTIFIED BY ‘yourpassdb’;
# mysql> GRANT ALL ON *.* TO ‘a2bMySQL’@’10.10.10.%’;

Mysql database, user adding  and importing the database file is restored.

Now Back to Asterisk Box

#cp /usr/src/a2billing/a2billing.conf /etc/

#nano /etc/a2billing.conf

>> Edit a2billing.conf to  the following


hostname =

port = 3306

user = a2bMySQL

password = yourpassdb

dbname = mya2billing

dbtype = mysql


>> Edit the file as below ::

# /etc/asterisk/res_mysql.conf  Or you can find /etc/asterisk/res_config_mysql.conf

# nano /etc/asterisk/res_mysql.conf   Or nano /etc/asterisk/res_config_mysql.conf


dbhost =

dbname = mya2billing

dbuser = a2bMySQL

dbpass = yourpassdb

;dbport = 3306

dbsock = /var/lib/mysql/mysql.sock

>> Edit the file as below ::

# nano /etc/asterisk/extconfig.conf


sipusers => mysql,mya2billing,cc_sip_buddies

iaxusers => mysql,mya2billing,cc_iax_buddies

sippeers => mysql,mya2billing,cc_sip_buddies

iaxpeers => mysql,mya2billing,cc_iax_buddies

>> Once done Fix folder Permissions using commands below ::

#chmod 777 /etc/asterisk

#touch /etc/asterisk/additional_a2billing_iax.conf

#touch /etc/asterisk/additional_a2billing_sip.conf

#echo \#include additional_a2billing_sip.conf >> /etc/asterisk/sip.conf

#echo \#include additional_a2billing_iax.conf >> /etc/asterisk/iax.conf

#chown -Rf apache /etc/asterisk/additional_a2billing_iax.conf

#chown -Rf apache /etc/asterisk/additional_a2billing_sip.conf

>> Copy sound to asterisk folder


>> Now Edit the Manger.conf

#nano /etc/asterisk/manager.conf

and add below code ::





and now save and exit the file.

>> Copy AGI files and make executable

#cd /usr/src/a2billing/AGI

#cp a2billing.php /var/lib/asterisk/agi-bin/

#cp -Rf lib /var/lib/asterisk/agi-bin/

#chmod +x /var/lib/asterisk/agi-bin/a2billing.php

#mkdir /var/www/a2billing

#chown apache:apache /var/www/a2billing

#cp -rf /usr/src/a2billing/admin /var/www/a2billing

#cp -rf /usr/src/a2billing/agent /var/www/a2billing

#cp -rf /usr/src/a2billing/customer /var/www/a2billing

#cp -rf /usr/src/a2billing/common /var/www/a2billing

chmod 755 /var/www/a2billing/admin/templates_c

chmod 755 /var/www/a2billing/customer/templates_c

chmod 755 /var/www/a2billing/agent/templates_c

chown -Rf apache:apache /var/www/a2billing/admin/templates_c

chown -Rf apache:apache /var/www/a2billing/customer/templates_c

>> edit apache file that is  /etc/httpd/conf/httpd.conf

#nano /etc/httpd/conf/httpd.conf

find DocumentRoot and chane to below:


DocumentRoot “/var/www/a2billing”


Save and exit the file and restart the apache.

# service httpd restart

Its Done.

Now you can go on your A2billing page  using below link ::

http://yourip/admin/  Here (your ip will be your server ip )

log in  Using the details  below ::

user: root
pass: changepassword

Once logged in Change your login passowrd.

Now lets edit asterisk so the AGI works

# nano /etc/asterisk/extensions.conf

Paste below to the bottom of the file.

; CallingCard application
exten => _X.,1,DeadAGI,a2billing.php
exten => _X.,2,Wait,2
exten => _X.,3,Hangup
; CallingCard application
exten => _X.,1,DeadAGI(a2billing.php|1|did)
Now configure httpd to start on boot
arrow down to httpd and hit the space bar .tab to ok click enter

Asterisk will already start on boot 🙂

Errors and troubelshootings ::

Access Denied  while changing the password.

Check the ownership of the /var/lib/php/session  and change it to root.

#chown root.root /var/lib/php/session

Done. Now you can configure the A2billing as per your requiredments.

🙂 🙂 🙂

Error PHP Fatal error: Out of memory (allocated 24641536) (tried to allocate 24381441 bytes) on cPanel server with php scripts

Posted in Cpanel/WHM, PHP/Mysql on May 2, 2012 by Aparna Murthy

Today came across with the memory exhausted error and while investigation note that after increasing the memory in server php.ini file even though increased php memory limit for the particular user as server is suphp enabled, but did not help… 😦 😦

While browsing the site I find the error as below under error logs ::
[root@server/home/username/public_html]# tail -f error_log
[01-May-2012 20:45:55] PHP Fatal error:  Out of memory (allocated 24641536) (tried to allocate 24381441 bytes) in /home/username/public_html/filename.php on line 117

Soution 1 ::

1. If server is suphp enabled then do as below ::

>> create Or copy server php.ini under public_html as below :

#cp /usr/local/lib/php.ini /home/username/public_html

Then open the php.ini file

# vi  /home/username/public_html/php.ini

Find for the memory_limit parameter and change the value as below :

memory_limit = 32 MB


memory_limit = 64 MB

Save the file.

>> Now open the .htaccess file under your public_html

#vi /home/username/public_html/.htaccess

and enter the code below :

suPHP_ConfigPath /home/username/public_html

Save the file.

2. Now try to access your page again and check if that help to resolve the issue.

In my case solution 1 did not help and then I checked the issue further and came to know that the issue was with the apache memory limit. I did check as below :

Solutions 2::

1. Checked the parameter RLimitMEM  under apache configuration file.

# vi /etc/httpd/conf/httpd.conf

Find for RLimitMEM

you will see something like below :

RLimitMEM 154857600 154857600
RLimitCPU 150 200
RLimitNPROC 25 30

Just increase the value of RLimitMEM , In my case I did as below ::

RLimitMEM 184857600 184857600

NOTE :: if you don’t find the value in httpd.conf, please do check in the file /etc/httpd/conf/includes/pre_main_global.conf

and then restart apache on the server.

# service httpd restart

and now try to access your site. your site will work like a charm without any error.

How to Change FTP service Port on cPanel server

Posted in Cpanel/WHM with tags on April 22, 2012 by Aparna Murthy

Today while working come across on the request to change port of the FTP from 21 to some other port that is 921 and I followed the steps below to do so :

Check if your server is using Proftpd and pure-ftpd, To check refer the steps below :

>> Login to your WHM
>> Service Configuration >> FTP Server Selection
>> Here you can see on which radio button is checked.

If you are using pureftpd then follow the steps below :

1. Login to ssh via root

2. Edit /etc/pure-ftpd.conf and look for the following line:

# vi /etc/pure-ftpd.conf
Bind <addr> <port>

Example :: #Bind,21

Replace it with the below line :


NOTE : is a localhost and you must replace it with your certain server ip. You may add the lines for multiple ips under it as below :

================= are just example, you must enter your own server ips.

In my case the port is 921. Save the file.

3. Restart FTP service and cpanel service.

# /etc/init.d/pure-ftpd restart
# /etc/init.d/cpanel restart
Ensure the port 921 is allowed at your firewall.

If you are using proftpd then follow the steps below :

1. Login to ssh via root

2.Edit /etc/proftpd.conf and change:

Port 21


Port 921

3. Save file and restart proftpd and cpanel service.
# /etc/init.d/proftpd restart
# /etc/init.d/cpanel restart

You’re Done.

PHP Setting change, register_globals and more using htaccess

Posted in PHP/Mysql on April 5, 2012 by Aparna Murthy

In order to change your PHP  setting, from upload limit to register_globals just do the follow:

1) Create a file called .htaccess inside your public_html
(Note: if you want to change PHP 5 settings, you need to put these values in a file called php.ini inside the folder of the php files and
remove the php_value part)

1) Create a file called .htaccess inside your public_html

(Note: if you want to change PHP 5 settings, you need to put these values in a file called php.ini inside the folder of the php files and  remove the php_value part)

2) Edit it and add the line below in this format

php_value value_name newvalue


# to turn off register_globals

php_value register_globals off

#To change upload size limit to 100mb (Make sure add both lines below into htaccess)

php_value upload_max_filesize 100M

php_value post_max_size 100M

# to change php script execution time

php_value max_execution_time 1000

# to turn mod_rewrite on

RewriteEngine on

php_value upload_max_filesize 100M

php_value post_max_size 100M

php_value output_buffering on

php_value max_execution_time 1000

php_value max_input_time 1000

php_value session.gc_maxlifetime 14400

RewriteEngine On

# Turn off mod_security filtering.

SecFilterEngine Off

# The below probably isn’t needed,
# but better safe than sorry.
SecFilterScanPOST Off