This is a naive, step by step guide to installing LXR on a Centos 6.3 machine. This is only a recommendation, it might not fit your needs and might contain inaccuracies but it worked for me - I have indexed the linux kernel. I used ' ' to signify a command to be entered to the shell, for example 'ls -a'.
Please also go over the LXR manual in their site (for version 1.0 and above), as it provides many insights too.
In VmWare, create a new virtual machine with enough computing power (let's say 4 cores, 4GB of RAM). One network interface should suffice.
power on the machine and boot it from this ISO.
You will be asked several questions throughout the installation process:
should test HW? --> can skip
storage devices --> choose basic
disk partitioning --> choose 'use all space'
type of machine to be used --> choose web server - as we are going to need the apache web server (LXR is accessed via web)
Networking
if you'd like to use a dynamic IP (DHCP): 'dhclient -v eth0' - this should give eth0 an IP.
if you'd like to use a static IP:
-set a static IP for the machine
-go to /etc/sysconfig/network-scripts/ifcfg-eth0
-add/modify the following lines, to get the following text (up to the IPs which of course depend on your setup):
DEVICE="eth0"
BOOTPROTO=static
HWADDR="00:50:56:9C:0C:49"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="6f15493e-4f97-4676-b9a4-3d9075a175fc"
IPADDR=10.100.46.75
PREFIX=24
BROADCAST=10.10.46.255
-set a default GW:
-'vi /etc/sysconfig/static-routes'
-add the following line, according to your default GW: any net 0.0.0.0 gw 10.100.46.254
-set DNS server: go to /etc/resolve.conf and add dns entries
to apply this, do: 'service network restart'
At this point, YUM should be working, so we can start installing stuff.
Installing prerequisites
-MySQL(thedatabase)-'yum install mysql'-'yum install mysql-server.x86_64'-bydefault,you'll have a 'root' user with an empty password-ctags - install by "yum install ctags"-perl should be already installed, if not - 'yuminstallperl'-perl related: -'cpanApp::cpanminus' -'cpanmFile::MMagic' -'cpanmDBI::DBD'-installing glimpse: -'yuminstallgcc' (making glimpse requires a c compiler) -'yuminstallflex.x86_64' -'yuminstallflex-devel.x86_64' -get glimpse_installation and put it in the machine -do: 'tar-xzvfglimpse-latest.tar.gz' -then go inside the extracted folder and do: './configure' -then: 'make' -then: 'makeinstall'
install LXR - version 2.0.3
-I've tried both versions 0.11 and 2.0.3 - I recommend 2.0.3 because it has less problems, though it might be a bit slower.-DownloadtheLXRtarball(version2.0.3)-lxr-2.0.3.tgzfromsourceforge-copyitto/root/downloads-goto/usr/local/share-untarit:tar-zxf/root/downloads/lxr-2.0.3.tgz-changethenameoftheextracteddirectoryto'lxr'-nowenterlxrdirectory-do'./genxref --checkonly'-genxrefisthescriptwhichisresponsibleforcrossreferencingthesourcecode.-fulloperationofitwillbepossibleonlywhentheDBisreadyandLXRisconfigured.---checkonlyflagwillallowyoutomakesureallprerequisitesareinstalled.-ConfiguringLXR-Thismeanstoeditthefile/usr/local/share/lxr/custom/lxr.conf-ThisfileincludesimportantdatawhichteachesLXRaboutourenvironment:-howtobrowsetoit(IPaddresses,aliases)-whereweputoursourcecode-wherewewanttheindexingdatatobestored,etc.-InsidetheLXRdirectory,do:'./scripts/configure-lxr.pl -vv '-Awizardwillopenandaskyouquestions,andintheenditwilleditthelxr.conffileforyou.-ThisishowIansweredthequestions:-Configureforsingle/multipletrees?[S/m]>S-Doyouintendtoaddothertreeslater?[yes/NO]>NO-Servertype?[dedicated/SHARED]>dedicated(IwasusingtheserveronlyforLXR,soIwantedittobethemaindirectory.ThismeansIcanbrowseusinghttp://<IP>/sourceinsteadofhttp://<IP>/lxr/source)----HostnameorIP?[//localhost]>----AliasnameorIP?>putyouIP,forexample//10.100.46.75-Databaseengine?[MYSQL/oracle/postgres/sqlite]>MYSQL----Directoryforglimpsedatabases?>/usr/local/share/glimpse_databases(that's where the indexing output is stored!)-IsyourApacheversion2.4orhigher?[YES/no]>dohttpd-vandansweraccordingly----Use'buttons-and-menus'insteadof'link'interface?[YES/no]>no(amatteroftaste,changesthedisplayabit)----Captioninpageheader?(e.g.ProjectXYZZYdisplayedbyLXR)>giveatitlehere(e.g.'my LXR tree')-Doyouneedaspecificencodingforthistree?[yes/NO]>NO-Howisyourtreestored?[FILES/cvs/git/svn/hg/bk]>FILES----Sourcedirectory?(e.g./home/myself/project-tree)>/usr/local/share/source_code/(thisiswhereyouputthesourcecode-importantnoteaboutthat-youneedtocreatesubdirectoriestothisdirectory-oneforeachversion-andinsidethemputtheactualcode.E.G.putthecodeforversion1inside/usr/local/share/source_code/version1))-Nametodisplayforthepathroot?(e.g.Projector$vforversion)[$v]>justhit'enter'-Labelforversionselectionmenu?[Version]>justhit'enter'-Versionenumerationmethod?[LIST/file/function]>LIST----Versionname?thisone's important. If you created a subdirectory inside the source code directory (e.g. version1), you need to enter it here. ----Defaultdisplayedversionisfirstin'range'?[YES/no]>YES----Directorytoignore,e.g.CVSROOTorCVS?(hitreturntostop)>justhit'enter'----Includedirectory,e.g./include?(hitreturntostop)>justhit'enter'----Databasename?>lxr_myproject----DBusername?[lxr]>justhit'enter'----DBpassword?[lxrpw]>justhit'enter'----DBtableprefix?[lxr_]>justhit'enter'-Thewizardwillnowcreatethreeimportantfilesinside/usr/local/share/lxr/customandexit:-initdb.sh-thescriptwhichcreatesaDBuserforLXR-lxr.conf-whichistructstheLXRscriptsasnotedabove-apache-lxrserver.conf-whichwillrefertheapacheservertotheLXRscripts-createtheDBuser:-do:'service mysqld start'-do:'./custom.d/initdb.sh'-itwillaskforapassword-justhitenter(mysqlhasanemptypasswordindefaultstate)-move/usr/local/share/lxr/custom/lxr.confto/usr/local/share/lxr-nowactuallycreatethedirectoriesyouhavespecifiedtothewizard:-thesourcecodedirectory,withthesubdirectoriesoftheversions.Putthesourcecodethere-thedirectoryforglimpseindexingoutputfiles-runtheindexingscript:-'./genxref --url=http://localhost/ --version=version1 --checkonly'-Thiswilldosomebasicchecks-Nowrepeatitwithoutthe'--checkonly'flag:'./genxref --url=http://localhost/ --version=version1'-Thisscriptdoesthefollowing:-createssubdirectoriesinsidetheglimpsediryougavetothewizard(/usr/local/share/glimpse_databases)whichmatchthesubdirectoriesoftheversions-indexesthecodeofversion1andputstheoutputsinside/usr/local/share/glimpse_databases/version1-Youcanindexallversionsatonceby'./genxref --url=http://localhost/ --allversions'-Thiscantakeawhileifthesourcecodeisbig.
Get the apache to work
-Afewwordsregardingtheapachewebserver:-Theapache(httpd)configurationresidesin/etc/httpd/conf/httpd.conf-thehttpd.conffilealsohasalinewhichsaysitshouldtakeintoaccountotherscriptsthatwereputinsidethedir/etc/httpd/conf.d.Forthisreason,theLXRmanualtellsustoputthefile'apache-lxrserver.conf'(whichwasgeneratedbythewizardearlier)inside/etc/httpd/conf.d.thiswilltelltheapachetorefertoLXRscripts-thereisanerrorlogfortheapachein/var/log/https/error_log-thisshouldhelpyoudebugproblemsifyou'll encounter any.-First,movethefile/usr/local/share/lxr/custom/apache-lxrserver.confto/etc/httpd/conf.d/-Then:-editthehttpdconfigurationfile:vi/etc/httpd/conf/httpd.conf.-Youneedtoaddtheretheline(anywhereyouwant)'ServerName 127.0.0.1'.-ifyoudon't do that, it will give you something like "starting httpd: httpd: apr_sockaddr_info_get() failed" when you try to start the httpd service-Disableiptables(firewall),sothatyoucanbrowsetotheserverfromaremotePC:-'service iptables stop'-'chkconfig iptables off'(fornexttime)-now:-'service httpd start'-gotothebrowserandbrowsetohttp://<yourLXRserverIP>/source-thiswilllaunchthesourcescriptresidesinthelxrdirectory-whichisresposibletodisplaythepage.-youshouldseethesourcecodeandbeabletonavigateit,doidentifiersearch,etc.-ifyouhaveanerrorlike"the directory / doesn't exist",itmeansthattheapachecannotaccessthesource_codedirectory-sotrytoputitsomewhereelseandrepeattheprocess(thepathsI've mentioned here should work though).
Adding new code/changing existing code
- if you modify or update the source code (say, of version1) you need to index version 1 again. just run './genxref --url=http://localhost/ --version=version1' again
- if you want to add more code/versions, do the following - say you want to add version2:
- Create a new dir inside your source code directory - e.g. /usr/local/share/source_code/version2
- edit /usr/local/share/lxr/lxr.conf - look for 'range' - you should find somehing like this
, 'range' => [qw(version1)]
- Change it to , 'range' => [qw(version1 version2)]
- Now run './genxref --url=http://localhost/ --version=version2'
- when you browse to LXR you'll see this new version and can navigate/search in it.
- By editing /usr/local/share/lxr/lxr.conf you can also modify the source code dir (called sourceroot in lxr.conf) and the glimpse databases dir (called glimpsedirbase in lxr.conf)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks a lot, I'll add it in the Tips section of the site as soon as I have free time. I'll send you a notice through here, so that you can give me feed back (and correct my misspellings since I'm not a native English speaker).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since it is in "beta" state, you can access it presently only through this link (or direct URL). I'll put a link from the Tips page when you tell me you're OK.
I'm not sure the first part (Installing a blank Linux machine) accurately reflects the screens. I've tried to render what should be displayed. If I incorrectly interpreted your text, don't hesitate to patch.
If you'd like to fiddle yourself with the HTML, I can send you the page source. Just drop me a line through my SF @ddress (giving a private answer @ddress -- it won't show here).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a naive, step by step guide to installing LXR on a Centos 6.3 machine. This is only a recommendation, it might not fit your needs and might contain inaccuracies but it worked for me - I have indexed the linux kernel. I used ' ' to signify a command to be entered to the shell, for example 'ls -a'.
Please also go over the LXR manual in their site (for version 1.0 and above), as it provides many insights too.
Installing a blank Linux machine
Networking
if you'd like to use a static IP:
-set a static IP for the machine
-go to /etc/sysconfig/network-scripts/ifcfg-eth0
-add/modify the following lines, to get the following text (up to the IPs which of course depend on your setup):
DEVICE="eth0"
BOOTPROTO=static
HWADDR="00:50:56:9C:0C:49"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="6f15493e-4f97-4676-b9a4-3d9075a175fc"
IPADDR=10.100.46.75
PREFIX=24
BROADCAST=10.10.46.255
-set a default GW:
-'vi /etc/sysconfig/static-routes'
-add the following line, according to your default GW: any net 0.0.0.0 gw 10.100.46.254
-set DNS server: go to /etc/resolve.conf and add dns entries
to apply this, do: 'service network restart'
Installing prerequisites
install LXR - version 2.0.3
Get the apache to work
Adding new code/changing existing code
Thanks a lot, I'll add it in the Tips section of the site as soon as I have free time. I'll send you a notice through here, so that you can give me feed back (and correct my misspellings since I'm not a native English speaker).
Hi kernelony,
I managed to upload your guide. Could you check it at
http://lxr.sourceforge.net/en/Tips/tipcentos.php
Since it is in "beta" state, you can access it presently only through this link (or direct URL). I'll put a link from the Tips page when you tell me you're OK.
I'm not sure the first part (Installing a blank Linux machine) accurately reflects the screens. I've tried to render what should be displayed. If I incorrectly interpreted your text, don't hesitate to patch.
If you'd like to fiddle yourself with the HTML, I can send you the page source. Just drop me a line through my SF @ddress (giving a private answer @ddress -- it won't show here).