First come to the official website: Installation Instructions Page[1].
Then click the Ubuntu installation process. After entering, follow the first step to run the command. The Ubuntu version used here is 18.04
.
gitlab configuration
After configuring the first step, it is best not to run the second step command. The second step is to install gitlab through the command line. This is very slow. So you can download the installation package manually from this URL:
https://packages.gitlab.com/gitlab/gitlab-ce/[2]
Choose a version of Ubuntu to download. After clicking in, the download button is in the upper right corner. Don't forget to check MD5 or SHA1 after downloading. The following is the verification command (just open the terminal and run).
Go to the installation package directory. Open the terminal and enter:
md5sum installation package name
check MD5. After the carriage return, a string of characters will appear, and then check whether the characters on the official website are consistent.Other verification commands:
sha256sum
check SHA256; shasum
check SHA1; sha512sum
check SHA256;After checking, you can install it.
Of course, if you just want to use commands to install gitlab, follow the instructions and operations in the second step. Just note that when installing by running the command, the gitlab-ee
in the command should be changed to gitlab-ce
. In gitlab, the installation package at the end of ee
is a paid version, while ce
You can try it for free.
After the above operations are completed, run the gitlab-ctl reconfigure
command. After this command runs, it will take some time, and there will be multiple action
prompts in the middle, don't worry about it.
After the above command is finished, run gitlab-ctl start
to start the local service. Then use the ifconfig
command to view the local IP address (you may be asked to install net-tools
first), and then enter the local IP address on the browser, and you will come to the gitlab login interface.
gitlab local login page
This page prompts you to change your password. The two passwords must be consistent. Then you will be asked to enter your email or username and password (the password here is the one you just set), and you can log in to gitlab.
The usage of gitlab is very similar to that of github. The difference is that gitlab can create groups, which is equivalent to a development team, and many projects can be created in one group. When developing in a team, the group or project should select Internal
as the visibility level.
gitlab visibility level
Of course, you can use gitlab to create private repositories and add group members or project members.
It should be noted that an error may be reported when using the git push
operation. The reason is that the hostname cannot be resolved. The reason is that the default hostname of gitlab is http://gitlab.example.com
. We need to modify the hostname to be the address of the machine.
git push -u origin master
In this case, you first need to close the gitlab-ctl
service.
Then use the vi command to open this file: /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
. Modify host to be the IP address of the machine:
Modify gitlab host
Then restart the service gitlab-ctl start
.
Then go to the local webpage, refresh the warehouse address, and add a new address (using git remote add origin new warehouse address
). In this way, you can push into the warehouse file.
If it still does not work, it is likely that the following situation has been encountered:
After entering the login password, a feedback of Permission denied, please try again.
appears.
This is because the server-side SSH service is configured with a policy that prohibits root users from logging in. Related policies can improve the security of the server, so you need to weigh security and ease of use, and then determine whether you need to modify the relevant configuration. . Need to modify the /etc/ssh/sshd_config
file, change /etc/ssh/sshd_config
to yes
.
Then remove the #
before PasswordAuthentication
. After saving the file, use service ssh restart
to restart the service. In this way, you can use the push
operation (you can only switch to a super user to perform the push operation).
The above content configures the gitlab environment.
Reference materials
[1]
Installation instructions page: https://about.gitlab.com/install/
[2]
gitlab download page: https://packages.gitlab.com/gitlab/gitlab-ce/
Recommended Posts