配置glimpse与LXR读取linux内核源码
1.安装
源代码编译glimpse
sudo apt-get install flex
sudo apt-get install lxr
2.设置Apache:
修改:/etc/apache2/apache2.conf
PidFile /var/run/apache2.pid
User teapot
Group teapot
修改:/etc/apache2/envvars
export APACHE_RUN_USER=teapot
export APACHE_RUN_GROUP=teapot
export APACHE_PID_FILE=/var/run/apache2.pid
sudo apache2 -k stop 关闭apache
3.设置/usr/share/lxr/http/lxr.conf
baseurl:
htmlhead: /usr/share/lxr/http/template-head
htmltail: /usr/share/lxr/http/template-tail
htmldir: /usr/share/lxr/http/template-dir
sourceroot: /usr/src/linux-2.6.24.1/
srcrootname: Linux
glimpsebin: /bin/glimpse
dbdir: /usr/share/lxr/source/dbdir
4.增加.htaccess
teapot@teapot:/usr/share/lxr/http$ cat .htaccess
***
SetHandler cgi-script
5.建立目录/usr/share/lxr/source/dbdir
执行:/usr/bin/genxref /usr/src/linux-2.6.24.1/
6.执行:glimpseindex -H . /usr/src/linux-2.6.24.1/
注意:中间的点号
7.建立glimpse的索引连接文件
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_filenames
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_index
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_filenames_index
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_filetimes
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_messages
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_partitions
teapot@teapot:/usr/share/lxr/source/dbdir$ sudo ln -s ~/.glimpse_statistics
不建立链接文件,在搜索文件时,报找不到.glimpse_filenames.,查看了lxr, find.pl文件
当然,你的.glimpse_filename这些索引文件可以直接建在dbdir目录中,这样就省得链接了
我是建在/home用户主目录下的,这样glimpse工具可以直接查询,不用apache2了,不过没有apache2方便
2 $searchtext = <>;
033 chomp $searchtext;
034
035 sub find {
036
037 if ($searchtext ne "") {
038 unless (open(FILELLISTING,$dbdir."/.glimpse_filenames")) {
039 &warning("Could not open .glimpse_filenames.");
040 return;
041 }
8.配置Apache站点:
teapot@teapot:/etc/apache2/sites-available$ cat edunuke
ServerName edunuke.firehare.com
ServerAdmin ubuntu.firehare@firehare.com
DocumentRoot "/usr/share/lxr/http"
ErrorLog "/var/log/apache2/edunuke_errors.log"
CustomLog "/var/log/apache2/edunuke_accesses.log" common
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Options All
AllowOverride All
order allow,deny
allow from all
DirectoryIndex index.html
DirectoryIndex blurb.html
执行:sudo a2dissite edunuke
在sites-enable中就有了edunuke的链接
阅读(1564) | 评论(0) | 转发(0) |