CentOS 7.6 Installation Deployment Gitlab

1. Introduction to gitlab

GitLab is an open source project for a warehouse management system. It uses Git as a code management tool and builds a web service on this basis. GitLab is developed by Ukrainian programmers Dmitriy Zaporozhets and Valery Sizov, and it is written in Ruby language. Later, part of the code was rewritten in Go language and is now widely used by large and medium-sized Internet companies at home and abroad.
The differences between git, gitlab, and GitHub are as follows:
git is a command-based version control system with full command operation and no visual interface.
Gitlab is an online code warehouse software based on git. It provides a web visual management interface and is usually used for collaborative development within an enterprise team.
github is an online code hosting warehouse based on git. It also provides a visual management interface. It also provides free accounts and paid accounts, as well as open and private warehouses. Most open source projects choose github as the code hosting warehouse.

Second, deployment environment

1, close selinux

sed -i "s/SELINUX=enforcing/SELINUX=disabled/ g" /etc/selinux/config
sed -i's/SELINUXTYPE=targeted/#&/' /etc/selinux/config
setenforce 0

2 Set time zone
timedatectl set-timezone Asia/Shanghai
3. Install the tools and software needed
yum -y install vim bash-completion wget curl policycoreutils-python

Three, install and deploy gitlab

1, configure firewall to allow http service< /p>

firewall-cmd --permanent --add-service=http
systemctl reload firewalld

2, install postfix

yum -y install postfix
systemctl enable postfix
systemctl start postfix

3, add GitLab package repository and install gitlab
Note: I installed gitlab-ee (enterprise edition) here. If you want to install gitlab-ce (community edition), please replace gitlab-ee with gitlab-ce in the following command.

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | bash
EXTERNAL_URL="http:// 192.168.2.220" yum install -y gitlab-ee

4. Modify the storage warehouse to a non-system disk
vim /etc/gitlab/gitlab.rb

git_data_dirs({
"default" => {
"path" => "/data/git-data"
}
})

5. Restart gitlab

gitlab-ctl stop
gitlab-ctl reconfigure
gitlab-ctl start

6. Log in to the web page to configure gitlab
Visit http://192.168.2.220 with the browser. The following page appears, set the root (administrator) user password
CentOS 7.6 installation and deployment gitlab
Then log in as root user
CentOS 7.6 installation and deployment gitlab

Four, gitlab use

1, Gitlab account registration
When the browser visits http://192.168.2.220, the following page will appear, click Register
CentOS 7.6 installation and deployment gitlab
2, create grou p
? Before creating the project, you can create a group
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
3, create project< /strong>
Create a new project under the group created above
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
The two addresses in the Clone drop-down box are the remote warehouse addresses of git.
4. Add users to the group
Note: Adding users to the group can only be performed by the root user
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
5. Set the protected branch of the project
Log in with the user who created the ceshi project before
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
Select Developers+Maintainers, that is, developers and maintenance The person has the permission to merge and push.

Five. Install the git client

1. Download the git client tool
You need to download the three software in the figure below
< img alt="CentOS 7.6 installation and deployment gitlab" src="/wp-content/uploads/images/os/centos/1626797813962.png" >
2, install Git tool
Double click Git-2.22.0-64-bit.exe, if it says “Do you want to allow this application to make changes to your device?”, please click “Yes”. Then all the way to Next (next step) until the installation is complete.
3. Install the git client
Double-click TortoiseGit-2.8.0.0-64bit.msi, and click Next all the way.
When the page shown below appears, you can perform step 1.1.4 first to install the language pack, and then select Chinese (Simplified) here.
You can also choose English, and then choose the language after the installation is complete.
CentOS 7.6 installation and deployment gitlab
When the following interface appears, you can click Check now to check Whether the path of git.exe is correct, the git version number shows that the path of git.exe is correct.
The path of git.exe is C:\Program Files\Git\bin. If the path of git.exe is not displayed by default, you can fill it in manually, and then check it with Check now.
CentOS 7.6 installation and deployment gitlab
Then enter Full name and email
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
Click “Finish” and the git client tool installation is complete.
4. Install the git language pack
Double-click TortoiseGit-LanguagePack-2.8.0.0-64bit-zh_CN.msi to install the Chinese language pack.
If “Do you want to allow this app to make changes to your device?” appears, click “Yes”.
Click “Next”, the installation is complete.
5. Change the git client language to Chinese
In any directory, right-click in a blank place and select TortoiseGit→Settings
CentOS 7.6 installation and deployment gitlab

Six, git client use

There are two ways to use Git, http and ssh.
1. http method
URL address: http://192.168.2.220/ceshi/ceshi.git
Create an empty folder locally, then right-click and select “Git Clone…”
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 Install and deploy gitlab
When cloning (clone) for the first time, you need to enter the username and password of gitlab
CentOS 7.6 installation and deployment gitlab
At this time, you can create a new file for testing. The process is pull→add→submit→ Push
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlab
2, ssh Method
Right-click the blank space in any directory, select “Git Bash Here”, open the git command line window
Initialize git global configuration

git config --global user. name "Full nam e"
git config --global user.email "your mailbox"

CentOS 7.6 installation and deployment gitlab
Create an SSH key pair

ssh-keygen -t ed25519 -C "your mailbox"

3: No. directly Press Enter, do not enter anything
CentOS 7.6 installation and deployment gitlab
Then put the git command line Close the window.
The key is stored in the .ssh directory under your user directory, for example: C:\Users\xuad.ssh
CentOS 7.6 installation and deployment gitlab
Open the public key file and copy all the contents to your ssh keys on gitlab to save.
CentOS 7.6 installation and deployment gitlab
Browser visit http://192.168.2.220 to log in to gitlab , The user pull-down menu in the upper right corner select “Settings”, and then click “SSH Keys”
CentOS 7.6 installation and deployment gitlab
Create an empty folder locally, then right-click and select “Git clone…”
CentOS 7.6 installation and deployment gitlab
CentOS 7.6 installation and deployment gitlabOther operations are similar to http The way is the same.

Leave a Comment

Your email address will not be published.