Chinaunix首页 | 论坛 | 博客
  • 博客访问: 413311
  • 博文数量: 75
  • 博客积分: 2020
  • 博客等级: 大尉
  • 技术积分: 663
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-04 16:56
文章分类

全部博文(75)

文章存档

2010年(10)

2009年(65)

分类: LINUX

2010-01-03 18:21:34

说明:本文旨在在中安装lxr,此安装方法与Fedora无关,本文在Fedora 11中进行的安装,参考的是Fedora 4/9等文章说明,成功。使用普通用户安装,过程中使用到su命令,lxr设置为可以同时查看多个版本源代码。


1.下载lxr-0.3
下载地址:
说明:lxr的版使用的是PostgreSQL,麻烦,0.3则不需要数据库,方便。

2.下载glimpse

3.安装lxr
3.1解压lxr,进入解压后的文件夹lxr-0.3,修改Makefile文件,主要有两项:

代码:
# The location of your perl5 binary
PERLBIN=/usr/bin/perl
这是perl的路径名,/usr/bin/perl是大多数下的默认配置,如果,请用whereis perl查找。
# LXR will be installed here
INSTALLPREFIX=/var/www/html/lxr
这是lxr脚本的安装目录,其中/var/www/html取自Apache配置文件/etc/httpd/conf/httpd.conf中的DocumentRoot(文件根目录)的值。3.2执行"make install"

代码:
su
make install这会在上述INSTALLPREFIX目录安装相应的脚本和文件.

4.安装glimpse
进入解压后的文件夹,执行:

代码:
./configure
su
make install以下操作需要root权限:

5.把源代码放在/var/www/html/lxr/source文件夹中
这里可以放多个,比如linux-1.0, linux-2.4.0, linux-2.6.18.8,其中linux-1.0.tar.bz2和linux-2.4.1.tar.bz2解压后的文件夹都是linux,请自行改名,原因后面说明。

6.在source中建立两个文件versions和defversion,其中versions为你的源代码版本(即你的目录),defversion为你的default version,即lxr默认展示的那个version。
versions的内容就是所有的源代码的版本,如下:

代码:
linux-1.0
linux-2.4.0
linux-2.6.18.8defversion的内容如下:

代码:
linux-2.4.07.修改lxr的配置文件lxr.conf,先备份一下:

代码:
# cp lxr.conf lxr.conf.bak需要修改的有variable v, baseurl, htmlhead, htmltail, htmldir, sourceroot, srcrootname, dbdir和glimpsebin,如下(这里用到了前面建立的两个文件versions和defversion):

代码:
# Configuration file.

# Define typed variable "v", read valueset from file.
variable: v, Version, [/var/www/html/lxr/source/versions], [/var/www/html/lxr/source/defversion]

# Define typed variable "a".  First value is default.
variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)

# Define the base url for the LXR files.
baseurl:

# These are the templates for the HTML heading, directory listing and
# footer, respectively.
htmlhead: /var/www/html/lxr/http/template-head
htmltail: /var/www/html/lxr/http/template-tail
htmldir:  /var/www/html/lxr/http/template-dir

# The source is here.
sourceroot: /var/www/html/lxr/source/$v/
srcrootname: $v

# "#include " is mapped to this directory (in the LXR source
# tree)
incprefix: /include

# The database files go here.
dbdir: /var/www/html/lxr/source/dbdir/$v/

# Glimpse can be found here.
glimpsebin: /usr/local/bin/glimpse

# The power of regexps.  This is pretty Linux-specific, but quite
# useful.  Tinker with it and see what it does.  (How's that for
# documentation?)
map: /include/asm[^\/]*/ /include/asm-$a/
map: /arch/[^\/]+/ /arch/$a/8.创建lxr/http/.htaccess文件,即/var/www/html/lxr/http/.htaccess,

内容如下:

代码:

SetHandler cgi-script
9.修改/etc/httpd/conf/httpd.conf文件的lxr设置和ServerName设置
9.1在文件添加如下几行

代码:
# Cross Reference Stuff




Options All
AllowOverride All
或者

代码:

Options All
AllowOverride All
order allow,deny
allow from all
9.2修改vim /etc/httpd/conf/httpd.conf中ServerName为localhost:

代码:
ServerName localhost说明:原文件中可能把ServerName注释了,如果不修改则会在开启httpd的时候找不到ServerName而有如下相似的错误:

代码:
#service httpd start
Starting httpd: httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
Starting httpd:                                                       [  OK  ]10.建立lxr的数据文件
由 于前面设置的dbdir为/var/www/html/lxr/source/dbdir/$v/,我们在lxr/source/dbdir/下面建立 linux-1.0, linux-2.4.0, linux-2.6.18.8等相关文件夹,以linux-1.0为例,进入lxr/source/dbdir/linux-1.0,然后生成lxr数据 文件:

代码:
# cd /var/www/html/lxr/source/dbdir/linux-1.0
# /var/www/html/lxr/bin/genxref /var/www/html/lxr/source/linux-1.0/
生成fileidx和xref两个文件
# glimpseindex -H . /var/www/html/lxr/source/linux-1.0/
生成7个.glimpse_*文件
# chmod 755 *; chmod 755 .g*
(中间是分号)将这几个数据文件修改为任何人均可读可执行。11.启动Apache服务器.

代码:
# /etc/rc.d/init.d/httpd start
或者
# service httpd start12.完成,在浏览器中输入地址,点击source就可以浏览和查找不同的linux源代码了,或者直接source也可以,一样的效果。

13.如果开启了selinux,则可能会被selinux禁止,使用如下命令关闭selinux:

代码:
# setenforce 0
查看selinux状态:
# getenforce

阅读(3230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~