Home > Development Tools > git > body text

How to set up GitLab on your own server

PHPz
Release: 2023-04-03 13:56:15
Original
1176 people have browsed it

With the development of software development, version control tools have become an indispensable part. Git is one of the most popular distributed version control systems currently. It was created by Linus Torvalds, the father of Linux, and has become the standard version control system for almost all open source projects.

GitLab is a management platform for Git that provides many features to simplify source code management and collaboration. In this article, we will learn how to set up GitLab on our own server.

Step 1: Install dependencies

Before installing GitLab, we need to install some necessary dependencies. In this tutorial, we will use Ubuntu 18.04 as a demonstration:

sudo apt update
sudo apt install -y curl openssh-server ca-certificates tzdata perl
Copy after login

Step 2: Install PostgreSQL

GitLab uses the PostgreSQL database by default. To do this, we need to install PostgreSQL:

sudo apt install -y postgresql postgresql-contrib libpq-dev
Copy after login

Step 3: Install GitLab

There are two ways to install GitLab:

3.1. Download and install the GitLab package

First, visit the GitLab official website (https://about.gitlab.com/install/) and download the appropriate GitLab version.

Install to your system, unzip the file, and enter the unzipped directory:

sudo mkdir -p /opt/gitlab
sudo chmod 775 /opt/gitlab
sudo curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_<版本号>_amd64.deb/download.deb
sudo dpkg -i gitlab-ce_<版本号>_amd64.deb
sudo gitlab-ctl reconfigure
Copy after login

3.2. Use the official Docker image

to run GitLab through docker, You need to install docker first:

sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker
Copy after login

Download GitLab’s Docker image and run:

sudo docker run --detach \
    --hostname <hostname> \
    --publish 443:443 --publish 80:80 --publish 22:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest
Copy after login

It’s that simple!

Step 4: Configure GitLab

We have started GitLab and it should be running now. By default, GitLab will run on port 80, and you can access it in your browser by entering the server's IP address or hostname:

http://<Server_IP>:80
Copy after login

The first time you access GitLab, you will be redirected Go to the page to set up an administrator account. On this page you will need to enter the username and password for your administrator account and enter the URL you want GitLab to run from. Once setup is complete, you will be redirected to GitLab’s login page.

Step 5: Using GitLab

Now you have installed and configured GitLab on your server. GitLab has many features, including code repository, issue tracking, continuous integration, etc. Please pay attention to the official documentation and become familiar with the various features of GitLab.

Summary

In this tutorial, we learned how to set up a GitLab server. GitLab is an excellent source code management platform and widely popular in the open source community. Now you should have the basics of setting up GitLab and be ready to start using it.

The above is the detailed content of How to set up GitLab on your own server. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!