01 - 安装tomcat9
sudo apt install -y tomcat9
02 - 安装[universal ctags](https://github.com/universal-ctags/)
sudo apt install -y autoconf automake
git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh ./configure make
sudo make install
03 - 安装OpenGrok
cd /tmp wget https://github.com/oracle/opengrok/releases/download/1.4.7/opengrok-1.4.7.tar.gz
sudo mkdir /opt/opengrok sudo mkdir /opt/opengrok/{src,data,dist,etc,log} sudo tar -C /opt/opengrok/dist --strip-components=1 -xzf /tmp/opengrok-1.4.7.tar.gz sudo cp /opt/opengrok/dist/doc/logging.properties /opt/opengrok/etc
cd /opt/opengrok/dist/tools sudo apt install -y python3-pip sudo pip3 install opengrok-tools.tar.gz
04 - 配置OpenGrok运行环境
sudo cp /opt/opengrok/dist/lib/source.war /var/lib/tomcat9/webapps/source.war
sudo cp /var/lib/tomcat9/webapps/source/WEB-INF/web.xml /tmp/web.xml sudo vi /var/lib/tomcat9/webapps/source/WEB-INF/web.xml
Edit L13...
#13 <param-value>/var/opengrok/etc/configuration.xml</param-value> # ...Replace /var with /opt
sudo diff /var/lib/tomcat9/webapps/source/WEB-INF/web.xml /tmp/web.xml < <param-value>/opt/opengrok/etc/configuration.xml</param-value>
---
> <param-value>/var/opengrok/etc/configuration.xml</param-value>
05 - 使用OpenGrok
待阅读的源代码对应的目录必须保存到/opt/opengrok/src下面。
sudo java -Djava.util.logging.config.file=/opt/opengrok/etc/logging.properties -jar /opt/opengrok/dist/lib/opengrok.jar -c /usr/local/bin/ctags -s /opt/opengrok/src -d /opt/opengrok/data -H -P -S -G -W /opt/opengrok/etc/configuration.xml -U http://localhost:8080/source