zoukankan      html  css  js  c++  java
  • Arch linux LXR 安装过程

     参考网页:

    http://lxr.sourceforge.net/en/1-0-InstallSteps/1-0-install.php

    我选择的版本:2.2, 我自己的操作系统是arch linux


    安装必要环境:

    perl:sudo pacman -S perl

    ctags: sudo pacman -S ctags

    MariaDB:sudo pacman -S mariadb

    Apache httpd:

      安装之后,需要先进行以下的配置:在启动服务之前:

      # mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

      # sudo systemctl start mysqld

      设置密码:'/usr/bin/mysqladmin' -u root password 'new-password' 或 '/usr/bin/mysqladmin' -u root -h <username> password 'new-password

    mod_perl:

      1、下载的地方:https://aur.archlinux.org/packages/mod_perl/ 在这里下载git,https://aur.archlinux.org/mod_perl.git, 然后使用makepkg -sri。这里会有一个unknown public key的错误,gpg --keyserver hkps://hkps.pool.sks-keyservers.net --search-keys AB34BA0040E92ECE (曾经有用),但我一般都是直接用--skippgpcheck。来进行安装:makepkg -sri --skippgpcheck

      2、 然后还要根据页面配置https://wiki.archlinux.org/index.php/Mod_perl#Installation

        我使用第一种方法:创建一个httpd-vhosts.conf的文件,然后填入

    # /etc/httpd/conf/extra/httpd-vhosts.conf

    <VirtualHost perlwebtest:80>

    Servername perlwebtest
    DocumentRoot /srv/http/perlwebtest
    ErrorLog /var/log/httpd/perlwebtest-error.log
    CustomLog /var/log/httpd/perlwebtest-access.log combined
    <Directory /srv/http/perlwebtest>
    AddHandler perl-script .pl
    PerlResponseHandler ModPerl::Registry
    Options +ExecCGI
    PerlOptions +ParseHeaders
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

    </VirtualHost>
        然后在配置文件当中进行包含:

    Include conf/extra/httpd-vhosts.conf
        要确保配置文件没有 这个选项:

    Options Indexes FollowSymLinks
        把下面这一行添加到/etc/hosts

    127.0.0.1 localhost yourhostname perlwebtest

    Glimpse:http://webglimpse.net/download.php

    Perl database driver interface DBI and the relevant DBD driver for the database:

      sudo cpan install DBI::mysql

      sudo cpan install DBD::mysql

    Perl File::MMagic :

      sudo cpan install File::MMagic

    源码下载:https://sourceforge.net/projects/lxr/?source=typ_redirect


    到这里, 第一部分,就基本完成了。后面还需要再次配置服务器。到那儿再继续

    其实无论是哪种系统,只要把这些依赖都安装好,最后都是能够使用的。




    第二部分: 安装LXR的源码

      我是安装在系统范围内的,执行以下命令:

      参考命令:

    $ cd /usr/local/share
    $ tar -zxf ~/Download/lxr-x.y.z.tgz
      实际命令:

    $ cd /usr/local/share
    $ sudo tar -zxf ~/Downloads/LXR/lxr-2.2.1.tgz
    sudo mv lxr-2.2.1/ lxr
    sudo chown -R <username> lxr
      进入到目录当中

    cd /usr/local/share/lxr
      检查当前的环境是否符合

    $ ./genxref --checkonly





    第三部分:

    配置部分:配置部分,是最需要去看文档的地方了。在这里,我贴出我所有的选择,如果想要快速的创建,可以按我的直接输入,并且按我的文件名的安排来参考怎么设置。

    开启配置的命令:

    $ ./scripts/configure-lxr.pl -vv

    * LXR configurator (version: 2.2) *

    LXR root directory is /usr/local/share/lxr
    Configuration will be stored in custom.d/
    directory custom.d created
    directory custom.d/db-scripts.d created

    Configure for single/multiple trees? [S/m] > s
    Do you intend to add other trees later? [yes/NO] > n

    * LXR web server configuration *

    Many different configurations are possible, they are related to the way
    LXR service is accessed, i.e. to the structure of the URL.
    Refer to the User's Manual for a description of the variants.

    LXR can be located at the server-root (so called dedicated)
    or lower in the server hierarchy (shared because there are
    usually other pages or sections).
    Server type? [dedicated/SHARED] > shared

    The computer hosting the server is described by an URL.
    The form is scheme://host_name:port
    where:
    - scheme is either http or https (http: can be omitted),
    - host_name can be given as an IP address such as 123.45.67.89

    or a domain name like localhost or lxr.url.example,

    - port may be omitted if standard for the scheme.
    --- Host name or IP? [//localhost] >
    --- Alias name or IP? >
    URL section name for LXR in your server? [/lxr] >

    * LXR database configuration *

    The choice of the database engine can make a difference in indexing performance,
    but resource consumption is also an important factor.
    * For a small personal project, try SQLite which do not

    need a server and is free from configuration burden.

    * For medium to large projects, choice is between MySQL,

    PostgreSQL and Oracle.
    Oracle is not a free software, its interface has not been
    tested for a long time.

    * PostgreSQL databases are smaller than MySQL's

    and performance is roughly equivalent.

    * MySQL is at its best with large-sized projects

    (such as kernel cross-referencing) where it is fastest at the cost
    of bigger databases.

    * Take also in consideration the number of connected users.
    Database engine? [MYSQL/oracle/postgres/sqlite] > mysql
    --- Directory for glimpse databases? > /home/<username>/glimpse_DB

    file .htaccess written into LXR root directory
    file apache2-require.pl written into configuration directory
    file apache-lxrserver.conf written into configuration directory
    file lighttpd-lxrserver.conf written into configuration directory
    file nginx-lxrserver.conf written into configuration directory
    file thttpd-lxrserver.conf written into configuration directory
    Mercurial support files written into configuration directory

    * LXR master configuration file setup *

    Global section part

    *** Configuring auxiliary tool paths
    *** Host name previously defined as http://localhost
    *** Configuring HTML parameters
    *** 'Buttons-and-menus' interface is recommended for the kernel
    *** to avoid screen cluttering.
    --- Use 'buttons-and-menus' instead of 'link' interface? [YES/no] > y
    *** Configuring file subsection
    *** Configuring "common factors"
    *** Marking tree section

    * LXR master configuration file setup *

    Tree section part
    SQL script for database initialisation

    *** Configuring LXR server parameters
    *** The virtual root is the fixed URL part after the hostname.
    *** You previously defined the virtual root as /lxr
    --- Caption in page header? (e.g. Project XYZZY displayed by LXR) > Projec Read Source Code displayerd by LXR
    Do you need a specific encoding for this tree ? [yes/NO] > n
    *** Describing tree location
    How is your tree stored? [FILES/cvs/git/svn/hg/bk] > F
    *** A source directory contains one sub-directory for every version.
    --- Source directory? (e.g. /home/myself/project-tree) > /home/<username>/Documents/SourceCode
    Name to display for the path root? (e.g. Project or $v for version) [$v] >
    *** Enumerating versions
    Label for version selection menu? [Version] >
    *** Versions can be explicitly enumerated, be read from a file or computed
    *** by a function. The latter case is recommended for VCS-stored trees.
    Version enumeration method? [LIST/file/function] >
    --- Version name? > klib
    --- Version name? (hit return to stop) > libevent-2.1.8
    --- Version name? (hit return to stop) > linux-2.6.39
    --- Version name? (hit return to stop) > linux-4.10.10
    --- Version name? (hit return to stop) > memcached
    --- Version name? (hit return to stop) > other1
    --- Version name? (hit return to stop) > other2
    --- Version name? (hit return to stop) >
    *** By default, first version in list is displayed. You may also indicate
    *** a prefered version.
    --- Default displayed version is first in 'range'? [YES/no] > y
    *** Setting directory lists
    *** Some directories may contain non-public project data (binaries,
    *** compilers caches, SCM control data, ...). They can be hidden from LXR.
    --- Directory to ignore, e.g. CVSROOT or CVS? (hit return to stop) >
    *** If your source code uses "include" statements (#include, require, ...)
    *** LXR needs hints to resolve the destination file.
    --- Include directory, e.g. /include? (hit return to stop) > /usr/include
    --- Include directory, e.g. /include? (hit return to stop) > /usr/local/include
    --- Include directory, e.g. /include? (hit return to stop) > /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include
    --- Include directory, e.g. /include? (hit return to stop) >
    *** Configuring data storage
    --- Database name? > lxr_ReadSourceCode
    --- DB user name? [lxr] >
    --- DB password? [lxrpw] >
    --- DB table prefix? [lxr_] >
    创建数据库

    $ ./custom.d/initdb.sh
    然后会显示

    Enter password:
    *** MySQL - Creating tree user lxr
    Enter password:
    *** MySQL - Creating tree database lxr_ReadSourceCode
    *** MySQL - Configuring tables lxr_ in database lxr_ReadSourceCode
    复制配置到当前

    $ cp custom.d/lxr.conf .





    第三部分 漫长的索引开始

    直接产生所有版本:

    $ ./genxref --url=http://localhost/lxr --allversions
    也可以只产生某个版本

    $ ./genxref --url=http://localhost/lxr --version=v1

    经过一晚上后,可以了。

    显示了这样的一个信息:

    *** other2 /tools/
    --- other2 install_venv.py 1491296469-4352 82079 +++ 140/138
    --- other2 normalize_json.py 1491296469-958 82080 +++ 28/10
    --- other2 ryu-manager.spec 1491296469-715 82081 +++ 29/31
    --- other2 topology_graphviz.py 1491296469-1021 82082 +++ 34/5
    --- other2 with_venv.sh 1491296469-752 82083 +++ 22/8
    *** other2 /
    --- other2 run_tests.sh 1491296469-5040 82084 +++ 191/181
    --- other2 setup.py 1491296469-956 82085 +++ 31/9

    Summary for http://localhost/lxr == Version other2

    Purge : 0:00:00
    Free-text indexing : 0:00:00
    Definitions parsing: 0:00:09
    References parsing : 0:00:17
    ...Total duration..: 0:00:26

    Database optimisation ... Done



    第四个:配置服务器

    在arch linux上的http的配置文件夹是/etc/httpd/conf (我的没有最后面的d)

    # cp custom.d/apache-lxrserver.conf /etc/httpd/conf
    然后,在我的版本里面,并没有自动的包含这个文件,也不会自动的包含conf里面的配置文件的语句,所以还需要自己包含这个配置文件

    Include conf/apache-lxrserver.conf
    需要重启服务:

    $ sudo systemctl restart httpd
    第一次开启,并不能够成功启动。使用status来进行查看,是没有启动成功,原因是Invalid command 'PerlResponseHandler'

    尝试去注释了http.conf里面的 Options Indexes FollowSymLinks

    取消了注释也没问题

    出现了FEATAL的问题,不能够创建文件夹,有可能是因为/home/<user name>的文件夹中,设置的权限,因为这个文件夹,other是不能够进行读取的,需要添加权限后,就能够访问了 


    错误:

    DBI.c: loadable library and perl binaries are mismatched (got handshake key 0xdb80080, needed 0xde00080)

     出现这个错误的原因,根据我的观察,是因为perl从5.24升级到了5.26,另外,apache 的mod_perl也升级了,我不确定这两个,哪个才是主要原因,反正我是因为升级,出现了这个错误。

    解决办法:

    去cpan的网站下再DBI的包,重新编译安装,就可以解决了。

    http://search.cpan.org/~timb/DBI/DBI.pm

    重新编译的命令是:

        perl Makefile.PL           
        make
        sudo make install

    用着,好像更新了perl之后,修复了上面的错误,重新配置,出现了这个错误,但其实,这个虽然出错了,还是能够正确显示源代码的。指示Glimpse_DB里面没有了那些文件,我不知道这会有什么影响,我重新配置,还是能够访问自己的网站

    Processing http://localhost/lxr == Version libevent-2.1.8
    cp: cannot stat '/home/andrew/glimpse_DB/lxr//libevent-2.1.8': No such file or directory
    Cannot change directory to /home/andrew/glimpse_DB/lxr//%@%glix%@%/
    usage: /usr/bin/glimpseindex [-help] [-a] [-d] [-f] [-i] [-n [X]] [-o] [-r delim] [-s] [-t] [-w X] [-B] [-F] [-H DIR] [-I] [-M X] [-R] [-S X] [-T] [-V] NAMES
    List of options (see http://webglimpse.net/ for more details):
    -help: outputs this menu
    -a: add given files/directories to an existing index
    -b: build a (large) byte-level index
    -B: use a hash table that is 4 times bigger (256k entries instead of 64K)
    -d NAMES: delete (file or directory) NAMES from an existing index
    -D NAMES: delete NAMES from the list of files (but not from the index!)
    -E: do not run a check on file types
    -f: incremental indexing (add all newly modified files)
    -F: the list of files to index is obtained from standard input
    -h: generates some hash-tables for WebGlimpse
    -H DIR: the index is put in directory DIR
    -i: make .glimpse_include take precedence over .glimpse_exclude
    -I: output the list of files that would be indexed (but don't index)
    -M X: use X MBytes of memory for temporary tables
    -n [X]: index numbers as well as words; warn (into .glimpse_messages)
    if file adds > X% numeric words: default is 50
    -o: build a small (rather than tiny) size index (the recommended option!)
    -r delim: build an index at the granularity of delimiter `delim'
    to do booleans by reading ONLY the index
    -R: recompute .glimpse_filenames_index from .glimpse_filenames if it changes
    -s: build index to support structured (Harvest SOIF type) queries
    -S X: adjust the size of the stop list
    -t: sort the indexed files by date and time (most recent first)
    -T: build .glimpse_turbo for very fast search with -i -w in glimpse
    -U: there is extra information after filenames: works only with -F
    -w X: warn (into .glimpse_messages) if a file adds >= X words to the index
    -X: extract titles of all documents with .html, .htm, .shtm, .shtml suffix
    -z: customizable filtering using .glimpse_filters

    For questions about glimpse, please contact: `glimpse-mail@webglimpse.net'
    chmod: cannot access '/home/andrew/glimpse_DB/lxr//%@%glix%@%/.glimpse*': No such file or directory
    Permissions changed to rw-r--r--
    mv: cannot stat '/home/andrew/glimpse_DB/lxr//libevent-2.1.8': No such file or directory
    mv: cannot stat '/home/andrew/glimpse_DB/lxr//%@%glix%@%/': No such file or directory

  • 相关阅读:
    Extensions in UWP Community Toolkit
    Rust 算法排位记
    【华为云技术分享】mongos-sharding连接池配置
    【华为云技术分享】opensuse使用zypper安装软件
    MongoDB经典故障系列一:数据库频繁启动失败怎么办?
    刚刚,华为云找到了更安全更卫生的乘坐电梯方式
    攻防学习
    通过FTP无法删除文件
    photoswipe-3.0.5 手机端横屏后竖屏图片无法归位问题解决
    【转载】apache配置虚拟主机以及虚拟目录详解
  • 原文地址:https://www.cnblogs.com/hwy89289709/p/6915901.html
Copyright © 2011-2022 走看看