…if I knew then what I know now

Archive for June, 2009

How to install lxrng on Fedora 11

This should serve as a useful guide to getting lxrng functional on Fedora 11. It may be a bit more verbose than anyone looking into lxrng may likely need, but figured being thorough wasn’t horrible…

Necessary software

# yum install git inkscape postgresql postgresql-server texlive ctags perl-CGI-Ajax perl-CGI-Simple perl-DBD-Pg perl-HTML-Parser perl-Template-Toolkit perl-Term-ProgressBar.noarch perl-Term-Size perl-TermReadKey perl-Devel-Size gcc gcc-c++ texlive-utils texlive-latex perl-ExtUtils-MakeMaker perl-CPAN perl-YAML libpng libpng-devel texinfo perl-Digest-SHA1 wget http make

# cd /tmp && wget http://www.ctan.org/get/fonts/bbding/bbding.ins http://www.ctan.org/get/fonts/bbding/bbding.dtx http://savannah.nongnu.org/download/icoutils/icoutils-0.26.0.tar.gz

Software installation

*Installing icoutils

# tar -xzvf icoutils-0.26.0.tar.gz

# cd icoutils-0.26.0

# ./configure

# make

# make install

*Installing Xapian and Search::Xapian

# tar -xzvf xapian-core-1.0.13.tar.gz

# cd xapian-core-1.0.13

# ./configure

# make

# make install

If you aren’t a developer or dabble in perl you likely are not aware of cpan. CPAN is the yum equivalent for perl modules and is very useful when needing to install perl modules not packaged for your distribution.

You should run cpan once to set up the environment

# cpan

# cpan -fi Search::Xapian

Optionally, you could wget the file from xapian.org

# perl Makefile.PL

# make

# make test

# make install

* Git lxrng

# cd /opt && git clone git://lxr.linux.no/git/lxrng.git

# cd lxrng

# cp lxrng.conf-dist lxrng.conf

I haven’t tried the mod_perl config only the cgi

# cp apache2-site.conf-dist-cgi apache2-site.conf

# chkconfig httpd on

# chkconfig postgresql on

# service postgresql initdb

# service postgresql start

Firewall

# iptables -L –line-numbers

I like my rules to look pretty so I would get the output of the above and set the following rules to the appropriate <line-number>

# iptables -I INPUT <line-number> -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

# iptables -I INPUT <line-number> -m state –state NEW -m tcp -p tcp –dport 5432 -j ACCEPT

# service iptables save

or the easy way

# system-config-firewall

PDF Generation

# cd /tmp

# cp /usr/share/texmf/fonts/tfm/public/niceframe/bbding10.tfm .

# tex bbding.ins

# mkdir /usr/share/texmf/tex/latex/bbding

# mv bbding.sty /usr/share/texmf/tex/latex/bbding/.

# texhash

# fmtutil-sys –all

Postgresql Setup

# sed -i 's/ident sameuser/password/' /var/lib/pgsql/data/pg_hba.conf

# runuser postgres

$ createuser -P lxr

Enter password for new role:

Enter it again:

Shall the new role be a superuser? (y/n) n

Shall the new role be allowed to create databases? (y/n) n

Shall the new role be allowed to create more new roles? (y/n) n

We are now going to create the DB for the source in particular that you want to cross reference. Replace <sourcetoxr> with the name. I will use ‘application’ moving forward.

$ createdb <sourcetoxr> -O lxr

Adding the following user will allow you to createdb’s later after changing the authentication for postresql which is coming in a minute.

$ createuser -P lxradmin

Enter password for new role:

Enter it again:

Shall the new role be a superuser? (y/n) n

Shall the new role be allowed to create databases? (y/n) y

Shall the new role be allowed to create more new roles? (y/n) n

# service postgresql restart

Setting up lxrng environment

# mkdir /var/lib/lxrng/textdb -p

# mkdir /var/lib/lxrng/cache

You make get some errors in the next step which you can safely ignore…

# make -C /opt/lxrng/webroot/.static/gfx

# chmod a+rw /var/lib/lxrng/

# chmod a+rw /var/lib/lxrng/cache/

This is the directory that we’ll drop our source into

# mkdir -p /var/lib/lxrng/ <application>/<version>

*lxrng configuration files

# sed -i ’s:@@LXRURL@@::’ apache2-site.conf

# sed -i ’s:@@LXRROOT@@:/opt/lxrng:’ apache2-site.conf

# vi apache2-site.conf

Depending on how you want to access lxrng you’ll need to uncomment one of the following ScriptAlias lines. I have always done the first ScriptAlias line

—————————————

# For LXRng installed directly in the web site root, use

# ScriptAlias / “/opt/lxrng/webroot/lxr.cgi/”

# otherwise use (no trailing slash):

# ScriptAlias / “/opt/lxrng/webroot/lxr.cgi”

———————————

# ln -s /opt/lxrng/apache2-site.conf /etc/httpd/conf.d/.

# service httpd restart

This configuration file is short and you only need to change a few things, but please read it all the way through.

# vi /opt/lxrng/lxrng.conf

———————————————

# -*- mode: perl -*-

# Configuration file

#

#

use LXRng::Index::PgBatch;

use LXRng::Repo::Git;

use LXRng::Search::Xapian;

use LXRng::Repo::Plain; # This should be added to use anything other than git

# Depending on what you are going to use git or plain repo you’ll use one of the two or both stanzas

# You are going to have a $repo,$index,$search for each application source you are going to cross

# reference which is the following, then a return{} for each of the repos specified.

#This shows a git repository

my $gitrepo = LXRng::Repo::Git->new(’/var/lib/lxrng/repos/linux-2.6/.git’, release_re => qr/^v[^-]*$/,

author_timestamp => 0);

my $gitindex = LXRng::Index::PgBatch->new(db_spec => ‘dbname=lxrng;port=5432′, db_user => “”, db_pass => “” );

my $gitsearch = LXRng::Search::Xapian->new(’/var/lib/lxrng/textdb/linux-2.6′);

#This shows a plain repository I used anaconda in this example…

my $anacondarepo = LXRng::Repo::Plain->new(’/var/lib/lxrng/anaconda’);

my $anacondaindex = LXRng::Index::PgBatch->new(db_spec => ‘dbname=anaconda;port=5432′, db_user => “lxr”, db_pass => “lxrlxr”);

my $anacondasearch = LXRng::Search::Xapian->new(’/var/lib/lxrng/textdb/anaconda/’);

# This section is going to be what you see on the webpage and references the db and source we

# specified to cross reference above.

# This stanza correlates to the gitrepo specified above

return {

‘linux’ => {

‘repository’ => $gitrepo,

‘index’ => $gitindex,

’search’ => $gitsearch,

‘base_url’ => ‘http://somewebsite.com’,

# Must be writable by httpd user:

‘cache’ => ‘/var/lib/lxrng/cache/kernel’,

‘fs_charset’ => ‘iso-8859-1′,

‘content_charset’ => ‘iso-8859-1′,

‘languages’ => ['C'],

‘ver_list’ => [$gitrepo->allversions],

# ‘ver_default’ => ‘v2.6.20.3′,

‘include_maps’ =>

[

[qr|^arch/(.*?)/|, qr|^asm/(.*)|,

sub { "include/asm-$_[0]/$_[1]” }],

[qr|^include/asm-(.*?)/|, qr|^asm/(.*)|,

sub { "include/asm-$_[0]/$_[1]” }],

[qr|^|, qr|^asm/(.*)|,

sub { map { "include/asm-$_/$_[0]” }

qw(i386 alpha arm ia64 m68k mips mips64),

qw(ppc s390 sh sparc sparc64 x86_64) }],

[qr|^|, qr|(.*)|,

sub { "include/$_[0]” }],

],

},

# This stanza correlates to the anaconda repo specified above

return {

‘anaconda’ => {

‘repository’ => $anacondarepo,

‘index’ => $anacondaindex,

’search’ => $anacondasearch,

‘base_url’ => ‘http://somewebsite.com’,

# Must be writable by httpd user:

‘cache’ => ‘/var/lib/lxrng/cache/anaconda’,

‘fs_charset’ => ‘iso-8859-1′,

‘content_charset’ => ‘iso-8859-1′,

‘languages’ => ['C'],

‘ver_list’ => [$anacondarepo->allversions],

# ‘ver_default’ => ‘v2.6.20.3′,

‘include_maps’ =>

[

[qr|^arch/(.*?)/|, qr|^asm/(.*)|,

sub { "include/asm-$_[0]/$_[1]” }],

[qr|^include/asm-(.*?)/|, qr|^asm/(.*)|,

sub { "include/asm-$_[0]/$_[1]” }],

[qr|^|, qr|^asm/(.*)|,

sub { map { "include/asm-$_/$_[0]” }

qw(i386 alpha arm ia64 m68k mips mips64),

qw(ppc s390 sh sparc sparc64 x86_64) }],

[qr|^|, qr|(.*)|,

sub { "include/$_[0]” }],

],

},

};

—————————————–

# ./lxr-db-admin application --init

# ./lxr-genxref application

The only bit that I haven’t sorted through yet are the selinux which shouldn’t be too hectic, but none the less

# setenforce 0

Start using lxrng!

If you have any feedbacks or issues let me know!