Install LXR on Ubuntu 16.04
In this article, I will write down a example to descrip how to setup the LXR(Linux Cross Reference) with multiple projects support. In this configuration, your can view multiple projects’ refernce in one LXR service.
For this article, I use the Ceph and DRBD for my LXR projtects.
Environment
- Ubuntu 16.04
- Lxr 2.2.1
- You can download the tarball from here
- Ceph
- DRBD-9.0
Prepare LXN Environment
- Install the required softwared
- perl (5.10 or above version)
- ctags (5.8 or above version)
1 | apt-get install perl |
- Install the Datbase, I choosed the MySQL for my lxr env.
1 | apt-get install mysql-server |
- Install Perl DBI
- Install the CPAN for Perl.
- Type the following command to install DBI
1 | cpan DBI |
- Install the Web Server, I choose the Apacher for my lxr env.
- Also install perl module.
1 | apt-get install apache2 |
- Install free-text searching engine, I choose Glimpse.
- Download from the github page and follow the README.install to install.
1 | git clone https://github.com/gvelez17/glimpse |
- Install Perl Module
- File::MMagic
- DBD::mysql
1 | apt-get install libmysqlclient-dev |
Install LXR
- Download the LXR-2.2.1 and expand the tarball
- Download from lxr-2.2.1.tgz
- Decompress into the /opt direcotory (choose the path you like) and rename to lxr
- Check the environment
1 | cd /opt/lxr |
The result will like below.
1 | ERROR: could not open configuration file lxr.conf |
Since we have not config the LXR, we won’t have the lxr.conf.
We choose the glimpse as our search engine and we can ignore the warning of swish-e.
Configure LXR
- Since the GIT type of source project doesn’t support the submodule reference in LXR, we use FILE instead of. Before we generate the code reference, we should update code by ourself.
- Prepare the source fo DRBD and CEPH. I put them in /opt/lxr/source_code
- We refer to the master branch of ceph, for rdbe, is version 9.0.
1 | mkdir -p /opt/lxr/source_code/drbd |
- Create both LXR and database configuration via tool
configure-lxr.pl
1 | cd /opt/lxr |
1 | *** LXR configurator (version: 2.2) *** |
- Initail DB via tool initdb.sh
1 | ./custom.d/initdb.sh |
- Copy the lxr.conf from custom.d dir to root dir.
1 | cp ./custom.d/lxr.conf . |
Generate Reference
- Generate the reference of project
ceph
1 | ./genxref --url=http://localhost/lxr --tree=Ceph --version=master |
- Generate the reference of project
drbd
1 | ./genxref --url=http://localhost/lxr --tree=drbd --version=9.0 |
Setup WEB Server
- Copy the server config to apache2 configuration dir.
1 | cp apache-lxrserver.conf /etc/apache2/conf-available |
- Start the apache2
1 | service apaceh2 start |
Test
- Go to http://localhost/lxr and your see there’re two options there, ceph and drbd.
- choose any one of them and you can use that to help you trace the code now.