Category Archives: CentOS / RHEL

[HOWTO] Install rtmpdump in CentOS 5

I was trying to install rtmpdump on CentOS 5.5 32-bit. I tried some RPMs and failed. I got errors like:

libboost_regex.so.3 is needed by rtmpdump

Now I figured I had to compile from source. I installed the required dependencies:

yum install openssl-devel

Then I downloaded the source tarball for v2.2e:

wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.2e.tar.gz

Then unpacked it:

tar xvf rtmpdump-2.2e.tar.gz

Then, compiled it:

cd rtmpdump-2.2e
make
make install

Now, run:

rtmpdump

If all goes well, you should get:

RTMPDump v2.2e
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
ERROR: You must specify a hostname (–host) or url (-r “rtmp://host[:port]/playpath”) containing a hostname

Hope this helps.

[SOLVED] LWP::UserAgent version 5.827 required–this is only version 2.033 at /usr/lib/perl5/vendor_perl/5.8.8/WWW/Mechanize.pm line 106

I installed an application get_flash_videos, which requires WWW Mechanize, on my Virtual CestOS 5.5 server. I installed it with yum:

yum install perl-WWW-Mechanize

When I ran the program, I got the following error:

LWP::UserAgent version 5.827 required–this is only version 2.033 at /usr/lib/perl5/vendor_perl/5.8.8/WWW/Mechanize.pm line 106

After searching on the Internet, I found that the error was due to bug in perl-libwww-perl-5.805-1.1.1.noarch. I found that upgrading it to perl-libwww-perl-5.827 would fix the issue. I found it here. I installed it with the following command:

rpm -Uvh ftp://ftp.pbone.net/mirror/ftp.pramberger.at/systems/linux/contrib/rhel5/archive/x86_64/perl-libwww-perl-5.827-1.el5.pp.noarch.rpm

That fixes the problem and I can now run get_flash_videos.

[SOLVED] Fatal error: Call to undefined function xmlrpc_encode_request() in /path/to/a/php/file on line x

I was trying to use xmlrpc_encode_request() for posting to wordpress for one of my sites and got the error similar to the following:

Fatal error: Call to undefined function xmlrpc_encode_request() in /path/to/a/php/file on line x

This happened because the server did not have xmlrpc extension for PHP enabled. If you are getting this error on a shared hosting server, you are almost out of luck. However, you can still talk to support to have it installed. If you have your own VPS or Dedicated, you can install and configure it on your own. If you do not have it installed, you can install it by typing in the following (as root of course):
Ubuntu:

apt-get install php5-xmlrpc

CentOS/Red Hat:

yum install php-xmlrpc

If it is already installed, but disabled, you can go to the following directory and enable it:
Ubuntu:
/etc/php5/conf.d/
CentOS/Red Hat:
/etc/php.d/

Look for xmlrpc.ini. If it does not exist, create it. Now, make sure it has the following contents:

; Enable xmlrpc extension module
extension=xmlrpc.so

Make sure there is no semicolon in the beginning of second line. Save it.

Now, if PHP is loaded as apache module (most probably it is the case), you will need to restart apache for changes to take effect. Run the following to restart apache:
Ubuntu:

service apache2 restart

or

/etc/init.d/apache2 restart

CentOS/Red Hat:

service httpd restart

or

/etc/init.d/httpd restart

Hope this helps.

[HOWTO] Install phpMyAdmin in CentOS 5

I am using CentOS 5 in one of my Virtual Servers and I wanted it to have phpMyAdmin. I tried installing it by doing yum install phpmyadmin but it said No package phpmyadmin available. So I add to add a repo. I discovered that rpmforge repo had this package. To add it, I executed the following commands:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.i386.rpm

If you have 64-bit version installed, you should try this one out:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

If you get a 404 Not Found, then you will need to figure out the latest updated version of repo url from rpmforge usage page.

After that, you may like to update your packages by doing this:

yum update

and then continue installing phpmyadmin

yum install phpmyadmin

It should ask you for confirmation and you can continue installing phpMyAdmin with dependencies.

When installation is done, you can edit /etc/httpd/conf.d/phpmyadmin.conf and allow it to be opened from anywhere and not just the same computer. You are going to need this if you have installed it in a remote virtual server.
To do so, open up /etc/httpd/conf.d/phpmyadmin.conf using:

nano /etc/httpd/conf.d/phpmyadmin.conf

You will see:


  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1

Just change the line “Allow from 127.0.0.1” to “Allow from [yourip]”, where [yourip] is IP address of your computer if you have public static IP. Otherwise, you can also set it to “Allow from all”.
Press Ctrl+O followed by Enter to save and Ctrl+X to exit nano.

Now, you must restart apache. To do so, run

service httpd restart

Now, you can access phpMyAdmin by visiting http://vps_server_IP_or_domain/phpmyadmin. But you will get the following error:

Error
The configuration file now needs a secret passphrase (blowfish_secret).

To make it work, you will need to edit config.inc.php. To do so, type in:

nano /usr/share/phpmyadmin/config.inc.php

Find a line saying:

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS
FOR
COOKIE AUTH! */

Fill in any secret keyword there, eg mysecretpassphrase, so that it looks like:

$cfg['blowfish_secret'] = 'mysecretpassphrase'; /* YOU MUST FILL IN THIS
FOR
COOKIE AUTH! */

and then save it.

If you don’t have mysql server installed, you will get the following error:

Error
#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)

To install mysql-server, just run:

 yum install mysql-server

and then start it:

 service mysqld start

Then change the root password:

mysqladmin -u root password PASSWORD_HERE

Now, you will have to remove phpmyadmin:

yum remove phpmyadmin

and reinstall it again:

yum install phpmyadmin

Then you will need to edit the config.inc.php again to enter blowfish secret (see above). Then, you can login.

If however, you want phpMyAdmin to connect to a remote server, you can change the line by replacing localhost with your server IP:

$cfg['Servers'][$i]['host'] = 'localhost';

Hope this helps.

[SOLVED] Module DateTime.DateTime, line 1145, in toZone

I am using Ubuntu 10.10 Maverick Meerkat and live in Nepal, timezone Asia/Kathmandu. I have been trying to setup Plone CMS in my local computer for learning to build sites with Zope/Plone. However, I had been getting errors.

I installed Plone 3.3.5 on my Ubuntu 10.10 Maverick Meerkat 64bit Desktop with Plone Unified Installer – for Linux/BSD/OS X/UNIX/Solaris. The installation was successful.

Then I ran the instance of Zope by changing directory to where my Plone is installed and running the following in terminal:

cd /usr/local/Plone
sudo ./bin/instance fg

Then I could browse the url http://localhost:8080/manage (I had changed the port number to 8888 ).

However, when I tried to create a Plone Site using Zope interface, I got the following error:

Site Error

An error was encountered while publishing this resource.

Error Type: KeyError
Error Value: ”

I see the following error in the terminal:

Module DateTime.DateTime, line 1145, in toZone
KeyError: ”
Unhandled exception in thread started by
Traceback (most recent call last):
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/ZServer/PubCore/ZServerPublisher.py”, line 25, in __init__
response=b)
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/ZPublisher/Publish.py”, line 401, in publish_module
environ, debug, request, response)
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/ZPublisher/Publish.py”, line 227, in publish_module_standard
if request is not None: request.close()
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/ZPublisher/BaseRequest.py”, line 211, in close
notify(EndRequestEvent(None, self))
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/zope/event/__init__.py”, line 23, in notify
subscriber(event)
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/zope/component/event.py”, line 26, in dispatch
for ignored in zope.component.subscribers(event, None):
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/zope/component/_api.py”, line 130, in subscribers
return sitemanager.subscribers(objects, interface)
File “/usr/local/Plone/Zope-2.10.11-final-py2.4/lib/python/zope/component/registry.py”, line 290, in subscribers
return self.adapters.subscribers(objects, provided)
AttributeError: adapters

I tried adding the following in buildout.cfg under instance section:

zope-conf-additional =
    
        TZ Asia/Katmandu
    

as instructed here and running buildout again but this did not work for me as I got the same error again.

I then installed Ubuntu 10.04 Lucid Lynx 32bit Server in Virtualbox and installed Plone again. This time I used Python 2.4 from Hardy repository rather than having it built by Plone installer. I used the tutorial here for rest of the stuff. But I got the same error again.

I then thought it was a Ubuntu specific issue and then installed CentOS 5.5 minimal in Virtualbox and installed Plone again. This did not work either. The same error appeared.

I then installed Plone 4 using Python 2.6 but the same error appears in instance.log.

Workaround
In the Virtualbox installation of Ubuntu 10.04, I changed the timezone to Asia/Alaska and then the problem was gone. To do so, I did the following:

sudo dpkg-reconfigure tzdata

And then I selected US, Alaska. I then changed the buildout.c
I changed buildout.cfg to reflect the change in timezone:

zope-conf-additional =
    
        TZ US/Alaska
    

and ran buildout again.

sudo ./bin/buildout

Then the error no longer shows and I can create page.

I don’t know if it is a python issue, or Datetime bug. I will dig into it later. But for now, Plone works.

[HOWTO] Switch fastest mirrors for yum to make package updates/download faster in CentOS/Fedora/RHEL

I just installed CentOS 5.5 in one of my servers and it seems great. I ran yum for the first time and it selected a mirror for me which was really very slow, almost useless. So, package updates and installation were taking a lot of time. I decided to switch to a different repo but didn’t have an idea which, so I decided to let the same fastest-mirrors plugin decide the mirrors. To force yum-fastestmirror plugin to check for fastest mirrors, you must delete the file /var/cache/yum/timedhosts.txt by running the following command as root:

rm /var/cache/yum/timedhosts.txt

Then, running yum will check for fastest mirror next time it is run. It should pick up a better mirror, but in my case, it just picked the same mirror over and over. So, I decided to block it altogether so that yum-fastestmirror is forced to choose another one.To do that, I opened the file /etc/yum/pluginconf.d/fastestmirror.conf as root and uncommented the line (removed the “#”) with “exclude” and added the culprit mirror “mirror.eshk.hk” to the exclude list so that the line looked like the following:

exclude=mirror.eshk.hk

If yum-fastestmirror keeps on giving selecting slow mirrors, you can add additional mirrors to the exclude list (separate mirror names with commas) and remove /var/cache/yum/timedhosts.txt again and repeat it again and again till you are satisfied with the speeds.