Home >Development Tools >git >How to install GitLab on Ubuntu system

How to install GitLab on Ubuntu system

PHPz
PHPzOriginal
2023-03-31 16:19:492763browse

Ubuntu GitLab installation

GitLab is a web-based Git warehouse management tool that can provide code warehouse, code review, issue tracking, CI/CD, Wiki and other functions. It is a self-hosted Git repository that can be installed on the cloud platform or locally to manage your own code.

This article will introduce you to the detailed steps of installing GitLab on Ubuntu system.

1. Install dependencies

Before installing GitLab, you need to install some dependency packages. Open a terminal and run the following command:

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates postfix

During the installation process, you need to set up the mail server Configuration. It is recommended to select the "Internet Site" configuration.

2. Install GitLab

1. Add GitLab repository

Add GitLab repository in the command line:

curl -sS https://packages. gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

2. Install GitLab

Now, install GitLab by running the following command:

sudo apt-get install gitlab-ce

The installation process may take a while, please be patient.

3. Configure GitLab

After the installation is complete, you can start GitLab through the following command:

sudo gitlab-ctl reconfigure

After starting, you can browse through The server accesses http://localhost to access GitLab.

3. Configure GitLab

1. Change the administrator password

Open the browser and visit http://localhost. Enter the initial administrator username root and password 5iveL!fe.

After logging in for the first time, GitLab will ask to change your password.

2. Add SSH key

To upload local code to GitLab, please add SSH key.

Open a terminal on your local computer. If you already have an SSH key pair, skip this step. Otherwise, generate an SSH key pair:

ssh-keygen -t rsa -C "youremail@example.com"

Replace "youremail@example.com" with your email address .

Next, add the SSH key to GitLab. In GitLab, click the icon in the upper right corner of the page and then click the "Settings" button.

On the "Settings" page, select the "SSH Keys" tab.

Copy the public key into the text box.

To test the connection, you can run the following command from the terminal:

ssh -T git@localhost

4. Create the project

Now, you can Create a new project in GitLab.

Click on the "Projects" tab in the menu on the left side of the page. On the Projects page, click the New Project button.

Enter the project name and project description. Select repository visibility settings.

Click the "Create project" button.

Now, local code can be pushed to GitLab.

5. Summary

The above are the detailed steps for installing GitLab on Ubuntu system. Through GitLab, you can easily manage and control your own code, including version control, merge requests, CI/CD, etc. In aggregate development, GitLab is also a very popular tool that can help teams manage code and improve productivity.

The above is the detailed content of How to install GitLab on Ubuntu system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn