ICT Documentation GitLab

GitLab

    Host: SRVR-uGitLab | IP:

    CPU: 4 core | Memory: 8GB | Storage: 100GB

     

    Reference: https://www.digitalocean.com/communi...n-ubuntu-18-04

    Please refer to the reference for more configuration.  We stripped down the optional stuff to keep our configuration clean and simple.

    Install Dependencies

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

    You will likely have some of this software installed already. For the postfix installation, select Internet Site when prompted. On the next screen, enter your server's domain name to configure how the system will send mail.

    Install GitLab

    cd /tmp
    curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
    sudo bash /tmp/script.deb.sh
    sudo apt install gitlab-ce

    Adjust Firewall Rules

    sudo ufw allow http
    sudo ufw allow https
    sudo ufw allow OpenSSH
    sudo ufw status
    

     

    Update GitLab Configuration File

    sudo nano /etc/gitlab/gitlab.rb
    

    Near the top is the external_url configuration line. Update it to match your domain. Change http to https so that GitLab will automatically redirect users to the site protected by the Let's Encrypt certificate:

    File: /etc/gitlab/gitlab.rb
    external_url 'https://gitlab.ssis.edu.vn'
    

    Next, look for the letsencrypt['contact_emails'] setting. This setting defines a list of email addresses that the Let's Encrypt project can use to contact you if there are problems with your domain. It's a good idea to uncomment and fill this out so that you will know of any issues:

    File: /etc/gitlab/gitlab.rb
    letsencrypt['contact_emails'] = ['lunguyen@ssis.edu.vn']
    

    Disable auto renewal of encrypt certificate

    letsencrypt['auto_renew'] = false
    

    Save and close the file. Run the following command to reconfigure Gitlab:

    sudo gitlab-ctl reconfigure
    

    This will initialize GitLab using the information it can find about your server. This is a completely automated process, so you will not have to answer any prompts. The process will also configure a Let's Encrypt certificate for your domain.

     

    Logging In for the First Time

    Visit the domain name of your GitLab server in your web browser:

    https://gitlab.ssis.edu.vn
    Set root password then login

     

    Adjust Profile Settings

    To make the necessary modifications, click on the user icon in the upper-right hand corner of the interface. In the drop down menu that appears, select Settings. Adjust the Name and Email address from "Administrator" and "admin@example.com" to something more accurate.  There are many other items that arent that important but you can check out the reference for more information.

     

    Adding an SSH Key to your Account

    In most cases, you will want to use SSH keys with Git to interact with your GitLab projects. To do this, you need to add your SSH public key to your GitLab account.

    If you already have an SSH key pair created on your local computer, you can usually view the public key by typing:

     ​cat ~/.ssh/id_rsa.pub

    You should see a large chunk of text, like this:

     ​ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMuyMtMl6aWwqBCvQx7YXvZd7bCFVDsyln3yh5/8Pu23LW88VXfJgsBvhZZ9W0rPBGYyzE/TDzwwITvVQcKrwQrvQlYxTVbqZQDlmsC41HnwDfGFXg+QouZemQ2YgMeHfBzy+w26/gg480nC2PPNd0OG79+e7gFVrTL79JA/MyePBugvYqOAbl30h7M1a7EHP3IV5DQUQg4YUq49v4d3AvM0aia4EUowJs0P/j83nsZt8yiE2JEYR03kDgT/qziPK7LnVFqpFDSPC3MR3b8B354E9Af4C/JHgvglv2tsxOyvKupyZonbyr68CqSorO2rAwY/jWFEiArIaVuDiR9YM5 sammy@mydesktop

    Copy this text and head back to the Profile Settings page in GitLab's web interface.

    If, instead, you get a message that looks like this, you do not yet have an SSH key pair configured on your machine:

    cat: /home/sammy/.ssh/id_rsa.pub: No such file or directory

    If this is the case, you can create an SSH key pair by typing:

    ssh-keygen

    Accept the defaults and optionally provide a password to secure the key locally:

     Generating public/private rsa key pair.
    Enter file in which to save the key (/home/sammy/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/sammy/.ssh/id_rsa.
    Your public key has been saved in /home/sammy/.ssh/id_rsa.pub.
    The key fingerprint is: SHA256:I8v5/M5xOicZRZq/XRcSBNxTQV2BZszjlWaIHi5chc0 sammy@gitlab.docsthat.work The key's randomart image is: +---[RSA 2048]----+ | ..%o==B| | *.E =.| | . ++= B | | ooo.o . | | . S .o . .| | . + .. . o| | + .o.o ..| | o .++o . | | oo=+ | +----[SHA256]-----+

    Once you have this, you can display your public key as above by typing:

    cat ~/.ssh/id_rsa.pub
    ​ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMuyMtMl6aWwqBCvQx7YXvZd7bCFVDsyln3yh5/8Pu23LW88VXfJgsBvhZZ9W0rPBGYyzE/TDzwwITvVQcKrwQrvQlYxTVbqZQDlmsC41HnwDfGFXg+QouZemQ2YgMeHfBzy+w26/gg480nC2PPNd0OG79+e7gFVrTL79JA/MyePBugvYqOAbl30h7M1a7EHP3IV5DQUQg4YUq49v4d3AvM0aia4EUowJs0P/j83nsZt8yiE2JEYR03kDgT/qziPK7LnVFqpFDSPC3MR3b8B354E9Af4C/JHgvglv2tsxOyvKupyZonbyr68CqSorO2rAwY/jWFEiArIaVuDiR9YM5 sammy@mydesktop

    Copy the block of text that's displayed and head back to your profile Settings in GitLab's web interface.

    Click on the SSH Keys item in the left-hand menu:

    GitLab SSH Keys menu item

    In the provided space paste the public key you copied from your local machine. Give it a descriptive title, and click the Add key button:

    GitLab add SSH Key

    You should now be able to manage your GitLab projects and repositories from your local machine without having to provide your GitLab account credentials.

    Page last modified 14:37, 8 Apr 2019 by jnguyen

    Comments0

    You must login to post a comment.

    Files0