Build Gitlab server in Ubuntu and gitlab in ubuntu

Source: Internet
Author: User
Tags gpg key string asymmetric encryption

Build Gitlab server in Ubuntu and gitlab in ubuntu

Think of Gitlab, you will surely think of SVN, because both of them are code management systems. As developers, they are used to the SVN graphical interface and SVN code update and submission methods,

It may be difficult to use git. In fact, git is easy to use and has many advantages. git will become a popular trend in the future. So here is a brief introduction to Gitlab.

Set up the server and use some basic git operations.

 

 

 

Advantages and disadvantages of Git

1. Suitable for distributed development, emphasizing individual

2. Public server pressure and data volume are not too large

3. fast and flexible

4. Any two developers can easily resolve conflicts.

5. Code and work can be submitted offline

Disadvantages

1. Relatively long learning cycle

2. Non-conforming to conventional thinking

3. Poor code confidentiality. Once the developer clones the entire library, all code and version information can be completely disclosed.

 

Prepare the environment

Ubuntu16.04 server

Installation

Mainly records the operation records for setting up GitLab server in Ubuntu 16.04 operating system, the following is the operation procedure (major reference: https://about.gitlab.com/downloads/#ubuntu1604)

Gitlab installation 1. Install the dependency package

Sudo apt-get install curl openssh-server ca-certificates postfix

Note: After the email configuration is completed, select Internet (without Smarthost)

2. Using the image of Tsinghua University (https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/) to install the main program first trust GitLab GPG Public Key

curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null

Use the root user to modify the configuration file

Vi/etc/apt/sources. list. d/gitlab-ce.list

# Add the following content

Deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main

Vi/etc/gitlab. rb

External_url 'HTTP: // 172.16.81.91 /'

Install gitlab-ce

sudo apt-get update

sudo apt-get install gitlab-ce

3. Start the sshd and postfix services

service sshd start

service postfix start

4. Add firewall rules

sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

5. Start various services

sudo gitlab-ctl reconfigure

6. Check whether GitLab is installed and runs properly.

Sudo gitlab-ctl status

# If the following result is returned, GitLab runs normally.

7. browse the web page and set the password

http://172.16.81.91/

 

8. Create a group

 

9. Add an ssh key

The code transfer protocol between git repositories mainly uses the ssh protocol. Generally, git users who use gitlab do not have a password. Therefore, you cannot log on directly through ssh. You need to use ssh-keygen to upload the public key and use asymmetric encryption for transmission. The following describes how to upload your ssh public key:

Generate sshkey

When you run the following command on the terminal, the first step will generate a pair of private keys and public keys that exist respectively.~/.ssh/id_rsaAnd~/.ssh/id_rsa.pub. Step 2. view the public key string.

Ssh-keygen-t rsa-C "email address" cat ~ /. Ssh/id_rsa.pub

On the Panel, choose Profile Settings> SSH Keys> Add SSH Keys. Thenid_rsa.pubAnd paste it into the input box to save it.

After completing the preceding two steps, the sshkey is successfully added and the code can be uploaded.

10. Create a project

Create Project Test_Project

Next, select a group and enter the project name.

Next, the creation is complete.

In the project, there will be a git operation guide to teach you how to operate

Create a project!

So far, GitLab server Construction Based on Ubuntu 16.04 x64 operating system is complete! Continue to share the basic usage of git in the future!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.