1.安装apache2
sudo apt-get install apache2
2.安装lxr
sudo apt-get install lxr
3.在/etc/apache2/httpd.conf 末尾加上以下内容:
Alias /lxr /usr/share/lxr
<Directory /usr/share/lxr>
Options All
AllowOverride All
</Directory>
这样可以达到[url]http://localhost/lxr/[/url] =>/usr/share/lxr
4.在/usr/share/lxr/http下创建文件 .htaccess, 并写入一下内容:
<Files ~ (search|source|ident|diff|find)$>
SetHandler cgi-.
</Files>
5.sudo /etc/init.d/apache2 restart
6.创建/usr/share/lxr/source/XX目录 (XX为版本号)
mkdir /usr/share/lxr/source/2.6.22
然后在/usr/share/lxr/source/2.6.22 下创建linux符号连接
ln -s /usr/src/linux-source-2.6.22 /usr/share/lxr/source/2.6.22/linux
7.创建/usr/share/lxr/source/versions,这里记录所有要看的版本,内容是
2.6.20
2.6.22
要保证2.6.22 =>/usr/share/lxr/source/2.6.22
创建/usr/share/lxr/source/defversion,这里记录缺省要看的版本,内容是
2.6.22
之所以是这两个文件,见/usr/share/lxr/http/lxr.conf里的相关设置
8.建立索引
cd /usr/share/lxr/source/2.6.22/
sudo genxref 2.6.22 //这样会在当前目录生成fileidx和xref
sudo glimpseindex -H /usr/share/lxr/source/2.6.22/ /usr/share/lxr/source/2.6.22/linux
(需要等待一段时间)
之所以是这个目录(/usr/share/lxr/source/2.6.22/),见/usr/share/lxr/http/lxr.conf里的相关设置(database项)
8.修改属性
sudo chmod +r -R /usr/share/lxr/source/2.6.22/*
9.
sudo /etc/init.d/apache2 restart
http://localhost/lxr/http/blurb.html