Tuesday, September 22, 2009

403 Forbidden with wget

We have few shell scripts, which access some HTTP URLs using wget as part of some task. wget failed to access some of the URLs with error message like below-

Resolving repo1.maven.org... 38.97.124.18
Connecting to repo1.maven.org|38.97.124.18|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2009-09-22 11:38:53 ERROR 403: Forbidden.

Though all failed URLs were accessible using browsers from same machine / user account. Reason of this failure is that wget does not send any information about itself (agent information) i.e. name and version of the browser etc. and some servers do not entertain requests without agent information. A simple workaround for this problem is to add a dummy agent information as shown below-
wget -U MyBrowser/1.0 URL_TO_DOWNLOAD
Now everything will work as expected.

Sunday, September 06, 2009

Few more notes about Redmine installation

This is in continuation to earlier post Getting started with Redmine where I jotted down my experience about installation of Redmine and other required packages. When I attempted to install Redmine in another machine with slightly different configuration and in different manner, I stumbled upon few more facts.

  • zlib-devel package should be installed and that too before installing ruby. Though ruby, rubygem and rake will be installed without any problem but installation of rails (gem install rails) will fail due to lack of zlib-devel.
  • If PostgreSQL is installed from a RPM package, say yum install postgresql-server. Then PostgreSQL installation will not have pg_config file and installation of PostgreSQL adaptor for ruby (gem install pg) will fail as installer script uses pg_config during installation. In absence of this file PostgreSQL adaptor will fail with an error like below-

        [vinod@localhost opt]$ gem install pg
        Building native extensions. This could take a while...
        ERROR: Error installing pg:
        ERROR: Failed to build gem native extension.

        /opt/ruby-1.8.7/bin/ruby extconf.rb
        extconf.rb:1: command not found: pg_config --version
        ERROR: can't find pg_config.
        HINT: Make sure pg_config is in your PATH
        *** extconf.rb failed ***
        Could not create Makefile due to some reason, probably lack of
        necessary libraries and/or headers. Check the mkmf.log file for more
        details. You may need configuration options.

        Provided configuration options:
            --with-opt-dir
            --without-opt-dir
            --with-opt-include
            --without-opt-include=${opt-dir}/include
            --with-opt-lib
            --without-opt-lib=${opt-dir}/lib
            --with-make-prog
            --without-make-prog
            --srcdir=.
            --curdir
            --ruby=/opt/apps/ruby-1.8.7/bin/ruby

    Gem files will remain installed in /opt/ruby-1.8.7/lib/ruby/gems/1.8/gems/pg-0.8.0 for inspection.
    Results logged to /opt/ruby-1.8.7/lib/ruby/gems/1.8/gems/pg-0.8.0/ext/gem_make.out
  • OpenSSL develipment headers are required by Phusion Passenger. Without this Passenger installation will fail with an error like-
        * OpenSSL support for Ruby... not found

        * To install OpenSSL support for Ruby:
        Please (re)install Ruby with OpenSSL support by downloading it from http://www.ruby-lang.org/.


    To overcome this first install openssl-devel package
          yum install openssl-devel

    Then execute following script from Ruby installation-
          /opt/ruby-1.8.7-p174/ext/openssl/ruby extconf.rb --with-openssl-dir=/usrl/local/ssl

    Now passenger installation will succeed.
I think there were few more things I stumbled upon, but lost their track during all this exercise.