Simple Introduction
In the previous article, it was easy to describe how to build a git server on a CentOS server. But this kind of way realizes the server function is weak, the operation is also more cumbersome. Search on the Internet a lap, feel gitblit more in line with my needs. Next I'll simply introduce how to build a Gitblit service on CentOS.
Gitblit is a pure Java library implementation that manages, views, and processes git repositories, equivalent to Git's Java management tools. The management software supports Windows and Linux platforms. can effectively control and manage the project, user rights. More suitable for small teams for management control.
Look at the above, is not very tall Ah, the next step is simply to introduce the installation of Gitblit on CentOS.
Official website: http://gitblit.com/
Installing the Java Environment
See if your own JDK is easy to install on CentOS, enter commands
yum list installed | grep java
If you do not have a JDK installed, you can review the Java installation package in the following Yum Library and execute the command to download and install it.
yum -y list java* # 查看yum库中java安装包
yum -y install java-1.8.0-openjdk* # 安装java-1.8.0相关java库
When the results are displayed as complete! The installation is complete.
Download Gitblit
mkdir -p /opt/gitblit # gitblit的默认输出目录是这里,所以就创建这个目录
cd /opt/gitblit
wget http://dl.bintray.com/gitblit/releases/gitblit-1.8.0.tar.gz
If a prompt appears during the download
-bash: wget: command not foundls
Note that the Wget program is not installed and can be loaded with a Yum library
yum install wget
Decompression Gitblit
Unzip the downloaded Gitblit compressed package to the target directory using the command tar, I extracted it to the/opt/gitblit directory
Modify the required configuration file modification Data/defaults.properties
Modify the configuration information according to your own needs, I only modified the following several places
-
git repositoriesfolder = repository path to save
-
httpport = to be open http port number
-
server httpbindinterface = server ip
-
server httpsbindinterface = localhost
Save and exit when you are finished modifying.
Modify Service-centos.sh
Depending on the settings of your own server
GITBLIT_PATH = 你解压缩存放的路径,例如/opt/gitblit
GITBLIT_BASE_FOLDER = 存放数据的基地址,例如 /opt/gitblit/data
GITBLIT_HTTP_PORT = 开启服务的HTTP端口
Save and exit when you are finished modifying.
Start Gitblit Direct Start Gitblit service
To perform the Gitblit service through Java, note the command parameters that are executed, and you can refer to the following command
java -jar gitblit.jar --baseFolder data # 当前在/opt/gitblit目录下
If the command is executed correctly, you can open the Gitblit management interface by opening the site information of the browser input settings
Start the Gitblit service with a service
The new version of Gitblit has helped us encapsulate the service installation script, and we only need to execute the installation script (install-service-centos.sh) and the service startup script (service-centos.sh). If a permissions problem occurs while executing the shell script, you only need to add read and write permissions to the file. If configured correctly, you can open the Gitblit management interface by opening the site information of the browser input settings
The place to pay attention to
- I only use HTTP to access, HTTPS mode has not been studied
- After the environment is set up, the default administrator account is admin, password is admin, must be modified in time
From for notes (Wiz)
Installing Gitblit services on CentOS