前文已經在windows上部署了gitblit服務,現在,我們要做的是在centos上搭建相同的服務,w上部署相對來說是比較方便的,人性化的ui讓操作起來還是比較方便的,但是大多數情況下我們會將服務部署在linux服務器上,接下來在自己的一臺tengxun雲服務器上,開始部署:
環境CentOS Linux release 7.3.1611 (Core) ,java version “1.8.0_11”
Java環境就不介紹了,以前應該寫過相關的博客。
1. 下載安裝包(最新的,我就下最新的吧,不知道哪個版本最穩定,一般類似spring boot 這種東西還是下官方穩定版本好)
wget http://dl.bintray.com/gitblit/releases/gitblit-1.8.0.tar.gz
我在這個服務器上速度明顯比我在w上下載安裝包快得多,最低配置有400多kb,感人!不過一年服務器的成本也是的確不低的(窮人)。很快下載好了。
- 解壓
tar -zxvf gitblit-1.8.0.tar.gz
- vi gitblit.properties (配置文件都在data目錄下面,之前在w上面部署已經有了經驗的操作起來是相當的順手的)
#
# GITBLIT.PROPERTIES
#
# Define your custom settings in this file and/or include settings defined in
# other properties files.
#
# Include Gitblit's 'defaults.properties' within your configuration.
#
# NOTE: Gitblit will not automatically reload "included" properties. Gitblit
# only watches the 'gitblit.properties' file for modifications.
#
# Paths may be relative to the ${baseFolder} or they may be absolute.
#
# COMMA-DELIMITED
# SINCE 1.7.0
#include = defaults.properties 註釋掉
include = my.properties 自己的配置文件,我是拷貝defaults.properties的文件,不去修改defaults.properties,原因查看我之前的博文
#
# Define your overrides or custom settings below
- 拷貝備份defaults.properties
cp defaults.properties my.properties
- 修改my.properties
這裏我簡單的配置就行了,文件倉庫(我就用默認的)和綁定端口(httpBindInterface)我就不去設置了,我就設置一下訪問的端口就行了。
server.httpPort = 10101
- vi service-centos.sh
GITBLIT_PATH=/root/gitblit
GITBLIT_BASE_FOLDER=/root/gitblit/data
GITBLIT_HTTP_PORT=10101
- 啓動
作爲Java菜鳥,還是按照Java的方式來啓動
java -jar gitblit.jar --baseFolder data
service命令啓動的方式,我是開啓失敗了。顯示的是ok但是沒有進程。
8. 遠程訪問記得開啓端口和reload防火牆
firewall-cmd --zone=public --add-port=10101/tcp --permanent
firewall-cmd --zone=public --add-port=8443/tcp --permanent
firewall-cmd --reload
這樣你就可以根據你的ip和端口進行訪問了:
http://ip:10101/ 其實我8443沒開放的
默認用戶名和密碼都是admin,切記修改
可供參考部署網址:
http://blog.csdn.net/u012606648/article/details/52514745
http://www.linuxidc.com/Linux/2015-03/115436.htm