> ## Documentation Index
> Fetch the complete documentation index at: https://help.onetsolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Install GitLab

> Install GitLab for self-hosted Git repository management

GitLab is a powerful open-source platform for managing Git repositories, providing version control, issue tracking, and CI/CD capabilities.

<Info>
  **Prerequisites**

  * A VPS with at least 4GB RAM (8GB recommended)
  * Ubuntu or Debian operating system
  * A domain name pointing to your VPS (recommended)
</Info>

## Installation Steps

<Steps>
  <Step title="Update system packages">
    ```bash theme={null}
    sudo apt update
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    sudo apt install curl openssh-server ca-certificates postfix
    ```

    When configuring postfix, select "Internet Site" for general use.
  </Step>

  <Step title="Add GitLab repository">
    ```bash theme={null}
    curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
    ```
  </Step>

  <Step title="Install GitLab">
    ```bash theme={null}
    sudo apt install gitlab-ee
    ```
  </Step>

  <Step title="Configure external URL">
    Edit the GitLab configuration file:

    ```bash theme={null}
    sudo nano /etc/gitlab/gitlab.rb
    ```

    Find and update the `external_url` setting:

    ```ruby theme={null}
    external_url 'https://gitlab.yourdomain.com'
    ```
  </Step>

  <Step title="Reconfigure GitLab">
    ```bash theme={null}
    sudo gitlab-ctl reconfigure
    ```

    This may take several minutes.
  </Step>

  <Step title="Access GitLab">
    Navigate to your configured URL. On first visit, you'll be prompted to set up the administrator account.
  </Step>
</Steps>

## Post-Installation

<CardGroup cols={2}>
  <Card title="Update GitLab" icon="arrows-rotate">
    Keep your GitLab instance up to date:

    ```bash theme={null}
    sudo apt update
    sudo apt upgrade gitlab-ee
    sudo gitlab-ctl reconfigure
    ```
  </Card>

  <Card title="Backup GitLab" icon="cloud-arrow-up">
    Create a backup of your GitLab data:

    ```bash theme={null}
    sudo gitlab-backup create
    ```
  </Card>
</CardGroup>

<Warning>
  Schedule regular backups to prevent data loss. GitLab backups include repositories, database, and attachments.
</Warning>

## Configuration Options

<AccordionGroup>
  <Accordion title="Enable HTTPS" icon="lock">
    GitLab can automatically obtain SSL certificates via Let's Encrypt. Ensure your `external_url` uses `https://` and run `gitlab-ctl reconfigure`.
  </Accordion>

  <Accordion title="Configure SMTP" icon="envelope">
    Edit `/etc/gitlab/gitlab.rb` to configure email notifications via SMTP. This enables GitLab to send notification emails.
  </Accordion>

  <Accordion title="Resource Optimization" icon="gauge">
    For VPS with limited RAM, you can reduce GitLab's memory usage by disabling unused features in `/etc/gitlab/gitlab.rb`.
  </Accordion>
</AccordionGroup>

<Tip>
  For detailed configuration options, refer to the [GitLab documentation](https://docs.gitlab.com/).
</Tip>
