Ubuntu 10.10安装lxr3.0.1
1安装 apache2: sudo apt-get install apache2
2安装 lxr, sudo apt-get install lxr
3安装 glimpse
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/lxr/old/lxr-0.3.1/lxr-0.3.1.tar.gz
tar -xvzf glimpse-latest.tar.gz
cd glimpse-4.18.6
./configure
make
sudo make install
这里如果提示要安装flex,那就安装下,sudo apt-get install flex
4修改lxr.conf配置文件
如下:
# Configuration file.
# Define typed variable "v", read valueset from file.
variable: v, Version, [/usr/share/lxr/source/versions], [/usr/share/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: http://localhost/lxr/http/
# These are the templates for the HTML heading, directory listing and
# footer, respectively.
# 显示网页的格式
htmlhead: /usr/share/lxr/http/template-head
htmltail: /usr/share/lxr/http/template-tail
htmldir: /usr/share/lxr/http/template-dir
# The source is here.
# 源码目录位置,$v代表当前source目录下的目录名,等会要mkdir 2.6.28
sourceroot: /usr/share/lxr/source/$v/
srcrootname: $v
# "#include <foo.h>" is mapped to this directory (in the LXR source
# tree)
incprefix: /include
# The database files go here.
# 放置lxr数据库索引文件的目录,这个databases等会也要新建
dbdir: /usr/share/lxr/databases/$v/
# Glimpse can be found here.
# glimpse安装位置,用命令which glimpse可以查看
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/
5在/usr/share/lxr目录下新建databases,这是根据lxr.conf配置里dbdir: /usr/share/lxr/databases/$v/做对应的,就是索引数据库文件夹。
sudo mkdir databases
cd databases
sudo mkdir 2.6.28
6在/usr/share/lxr/source/目录下新建2.6.28目录,也是和sourceroot: /usr/share/lxr/source/$v/ 做对应的,$v在这就是2.6.28
sudo mkdir 2.6.28
然后,把您的kernel源代码(是好多直接的代码文件)放到这个2.6.28文件夹里。
最后还是在/usr/share/lxr/source 下建立两个文件
/usr/share/lxr/source/versions,
/usr/share/lxr/source/defversion
很明显, versions 表示所有内核版本的集合, 而 defversion 表示缺省使用的版本。 我们目前使用 2.6.28 , 所以这两个文件里都写上 2.6.28
7 在/usr/share/lxr/source/2.6.28 下运行: ( 生成 freetext 交叉索引数据库 )
sudo glimpseindex -H . . #这里尤其要注意两个"."号中间是有空格的,两个都表示当前目录,这个是该命令的格式
sudo genxref
sudo mv fileidx ../../databases/2.6.28/
sudo mv xref ../../databases/2.6.28/
sudo mv .g* ../../databases/2.6.28/
chmod a+x ../../databases/2.6.28/*
chmod a+x ../../databases/2.6.28/.*
8编辑, /etc/apache2/httpd.conf , 添加:
ServerName localhost #localhost与步骤2中的localhost对应,一般在本机查看就直接localhost
Alias /lxr /usr/share/lxr
<Directory /usr/share/lxr>
Options All
AllowOverride All
</Directory>
注: 如果不加ServerName localhost,可能导致下面的警告
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
9 重启 apache2:
sudo /etc/init.d/apache2 restart
10 现在可以浏览代码了:
http://localhost/lxr/http/blurb.html
以上是结合网上,并经过自己数次实验成功的,感常见最主要还是配置文件lxr.conf里的配置参数要搞清楚,这样才能在任何linux里看交杈源码。
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com