- opengrok site
- Features
- Comparison with Similar Tools
- Supported Revision Control Systems
- Supported Languages and Formats
- How to build OpenGrok from source
- How to install OpenGrok
- Internals
- Story of OpenGrok
在用戶目錄下執(zhí)行,僅作驗(yàn)證使用。
安裝準(zhǔn)備
- 從https://github.com/oracle/opengrok/releases下載壓縮包,目前最新的為
opengrok-1.3.16.tar.gz - 創(chuàng)建目錄
mkdir -p opengrok/{src,data,dist,etc,log}src目錄作為源碼倉庫,data目錄作為indexer目錄 - 解壓壓縮包
tar -C opengrok/dist --strip-components=1 -xzf opengrok-1.3.16.tar.gz(--strip-components=1 參數(shù)Strip NUMBER leading components from file names on extraction。 將移除一層目錄) - 指定log配置
cp opengrok/dist/doc/logging.properties opengrok/etc - 在src目錄下git clone幾個代碼倉庫
ubuntu下安裝universal-ctags
- 安裝依賴環(huán)境
sudo apt install \
gcc make \
pkg-config autoconf automake \
python3-docutils \
libseccomp-dev \
libjansson-dev \
libyaml-dev \
libxml2-dev
- 拉取代碼
git clone https://github.com/universal-ctags/ctags.git - 在ctags目錄下,執(zhí)行
./autogen.sh,./configure,make,sudo make install
成功后,默認(rèn)ctags位于 /usr/local/bin/ctags
$ ./autogen.sh
$ ./configure --prefix=/where/you/want # defaults to /usr/local
$ make
$ make install # may require extra privileges depending on where to install
- 生成配置文件
java \
-Djava.util.logging.config.file=/opengrok/etc/logging.properties \
-jar opengrok/dist/lib/opengrok.jar \
-c /usr/local/bin/ctags \
-s opengrok/src -d opengrok/data -H -P -S -G \
-W opengrok/etc/configuration.xml
- 復(fù)制opengrok/dist/lib/目錄下的source.war文件到tomcat服務(wù)器的webapps目錄
安裝管理工具(可選)
python包包括了一下封裝后的命令,包括indexer等。在release版本的tar包解壓后的tools文件夾下包含opengrok-tools.tar.gz文件,使用pip命令安裝此文件即可。
- 先確保有python3環(huán)境
- 安裝python3環(huán)境下的pip
sudo apt install python3-pip(查看幫助pip3 --help,或者pip3 install --help), 檢查版本pip3 --versionpip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6) - 到tool目錄下執(zhí)行
pip3 install opengrok-tools.tar.gz
安裝web服務(wù)器
Setup Apache Tomcat 8 | 8.5 on Ubuntu 16.04 | 18.04 LTS
- 下載壓縮包,解壓壓縮包,指定端口號,直接到bin目錄執(zhí)行
./catalina.sh start將啟動默認(rèn)的服務(wù)器 - 修改source工程(即openGrok服務(wù))的配置文件
tomcat8/webapps/source/WEB-INF/web.xml,指定服務(wù)變量CONFIGURATION的值
<context-param>
<description>Full path to the configuration file where OpenGrok can read its configuration</description>
<param-name>CONFIGURATION</param-name>
<param-value>/home/xxx/opengrok/etc/configuration.xml</param-value>
</context-param>