- Install ctags dependencies
sudo apt install autoconf automake
- Clone the universal-ctags repository
git clone https://github.com/universal-ctags/ctags.git
- Compile and install ctags
cd ctags
./autogen.sh
./configure
make
sudo make install
Note: If the installation fails, you can copy the binary version of ctags to /usr/local/bin. 5. Download and extract the latest Tomcat core
tar -xvf apache-tomcat-9.0.53.tar.gz
- Start Tomcat (use
shutdown.shto stop it)
sh apache-tomcat-9.0.53/bin/startup.sh
- Open your browser and go to http://localhost:8080 8. Download and extract the latest OpenGrok release from GitHub
tar -xvf opengrok-1.3.16.tar.gz
- Copy the
source.warfile to the Tomcat webapps directory
cp opengrok-1.3.16/lib/source.war apache-tomcat-9.0.53/webapps/
- Set up environment variables
sudo vi ~/.bashrc
# Add the following lines
export JAVA_HOME=/usr
export OPENGROK_TOMCAT_BASE=/home/user/app/opengrok/apache-tomcat-9.0.53
export CATALINA_HOME=/home/user/app/opengrok/apache-tomcat-9.0.53
export OPENGROK_APP_SERVER=Tomcat
export OPENGROK_INSTANCE_BASE=/home/user/app/opengrok/opengrok-1.3.16
export LANG=zh_CN.UTF-8
- Aply the environment variables
source ~/.bashrc
- Create necessary directories
mkdir -p opengrok-1.3.16/{etc,src,data,history}
- Copy or link your source code to the
srcdirectory
cp -r /path/to/your/code opengrok-1.3.16/src/ # or ln -s /path/to/your/code opengrok-1.3.16/src/your_code
- Gneerate the index (re-run this command after any updates in the
srcdirectory)
java -jar opengrok-1.3.16/lib/opengrok.jar -P -S -v -s opengrok-1.3.16/src -d opengrok-1.3.16/data -H --repository opengrok-1.3.16/history -W opengrok-1.3.16/etc/configuration.xml
- Modify the actual configuration path in
web.xml
gedit apache-tomcat-9.0.53/webapps/source/WEB-INF/web.xml
<context-param>
<description>Full path to the configuration file where OpenGrok can read its configuration</description>
<param-name>CONFIGURATION</param-name>
<param-value>/home/user/app/opengrok/opengrok-1.3.16/etc/configuration.xml</param-value>
</context-param>
- Open the website at http://localhost:8085/source/ 17. If there is a port conflict, modify the ports in
server.xml
sudo cat conf/server.xml
<Server port="8006" shutdown="SHUTDOWN">
<Connector port="8085" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
address="127.0.0.1" />
<Connector protocol="AJP/1.3"
address="::1"
port="8010"
redirectPort="8443" />
- Restart Tomcat and open the webpage
sh apache-tomcat-9.0.53/bin/shutdown.sh && sh apache-tomcat-9.0.53/bin/startup.sh