search source code

发布时间 2023-04-22 13:04:58作者: ploolq

ubuntu20

opengrok

https://github.com/oracle/opengrok/releases

tomcat

https://dlcdn.apache.org/tomcat/

step

# install dep
apt-get install build-essential -y
apt-get install git -y
apt-get install vim -y
apt-get install fswatch -y
apt-get install p7zip-full -y
apt-get install cmake -y
apt-get install net-tools -y
apt-get install tmux -y
apt-get install gawk -y
apt-get install tree -y
apt-get install exfat-utils -y
apt-get install httrack -y
apt-get install curl -y
apt-get install fzf -y
apt-get install expect -y
apt-get install nodejs -y
apt-get install openjdk-17-jdk -y
apt install python3-pip -y
apt install autoconf automake -y


# install universal ctags
mkdir ~/tmp
cd ~/tmp
git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh
./configure
make
sudo make install

# manual config
linkOpenGrok=https://github.com/oracle/opengrok/releases/download/1.12.0/opengrok-1.12.0.tar.gz
linkTomcat=https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.8/bin/apache-tomcat-10.1.8.tar.gz

theGrokFile=~/tmp/opengrok-1.12.0.tar.gz
theTomcatFile=~/tmp/apache-tomcat-10.1.8.tar.gz
theGrokRoot=~/codesev/opengrok
theTomcatRoot=~/codesev/tomcat


# download opengrok tomcat
cd ~/tmp
wget $linkOpenGrok

wget $linkTomcat

mkdir -p $theGrokRoot
mkdir -p $theGrokRoot/{src,data,dist,etc,log}
tar -C $theGrokRoot/dist --strip-components=1 -xzf $theGrokFile

cp $theGrokRoot/dist/doc/logging.properties $theGrokRoot/etc

cd $theGrokRoot/dist/tools
sudo pip3 install opengrok-tools.tar.gz


mkdir -p $theTomcatRoot
cd ~/tmp
tar -C $theTomcatRoot/ --strip-components=1 -xzf $theTomcatFile


# copy source.war
mkdir -p $theTomcatRoot/webapps/source
unzip -d $theTomcatRoot/webapps/source $theGrokRoot/dist/lib/source.war


#edit web.xml
sed -i "s|/var/opengrok/etc/configuration.xml|$theGrokRoot/etc/configuration.xml|g" $theTomcatRoot/webapps/source/WEB-INF/web.xml

cat $theTomcatRoot/webapps/source/WEB-INF/web.xml


# set firewall
#ufw disable
#ufw status
sudo ufw allow 8080/tcp

# start tomcat
$theTomcatRoot/bin/startup.sh

# put project directry in $theGrokRoot/src or link -s

# create index
theGrokRoot=~/codesev/opengrok
sudo java \
     -Djava.util.logging.config.file=$theGrokRoot/etc/logging.properties \
     -jar $theGrokRoot/dist/lib/opengrok.jar \
     -c /usr/local/bin/ctags \
     -s $theGrokRoot/src \
     -d $theGrokRoot/data -H -P -S -G \
     -W $theGrokRoot/etc/configuration.xml \
     -U http://localhost:8080/source