# Instalação via source - full

Para subir o GitLab via source, siga os seguintes passos:

1. Instale as dependências necessárias:

```arduino
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
```

2. Instale o Git:

```arduino
sudo apt-get install -y git
```

3. Instale o Ruby e suas dependências:

```arduino
sudo apt-get install -y ruby ruby-dev build-essential zlib1g-dev liblzma-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev libpq-dev
```

4. Instale o Node.js e o Yarn:

```arduino
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
```

```
sudo apt-get install -y nodejs
```

```
sudo npm install -g yarn
```

5. Baixe o código fonte do GitLab:

```bash
sudo mkdir /opt/gitlab
```

```
sudo chown <user>:<user> /opt/gitlab
```

```
cd /opt/gitlab
```

```
sudo -u <user> git clone https://gitlab.com/gitlab-org/gitlab-foss.git -b <version> gitlab
```

Substitua `<user>` pelo seu nome de usuário e `<version>` pela versão que você deseja instalar.

6. Configure o GitLab:

```bash
cd /opt/gitlab/gitlab
sudo -u <user> cp config/gitlab.yml.example config/gitlab.yml
sudo -u <user> cp config/database.yml.postgresql config/database.yml
sudo -u <user> cp config/secrets.yml.example config/secrets.yml
sudo -u <user> chmod 0600 config/secrets.yml
sudo -u <user> mkdir public/uploads/
sudo -u <user> chmod 0700 public/uploads/
```

7. Instale as gemas necessárias:

```bash
sudo gem install bundler --version '<version>'
cd /opt/gitlab/gitlab
sudo -u <user> bundle install --deployment --without development test mysql aws kerberos
```

Substitua `<version>` pela versão do Bundler.

8. Configure o banco de dados:

```sql
sudo -u postgres psql
```

```
CREATE USER git CREATEDB;
CREATE DATABASE gitlabhq_production OWNER git;
ALTER USER git WITH ENCRYPTED PASSWORD '<password>';
```

```
\q
```

Substitua `<password>` pela senha que você deseja usar.

9. Crie o arquivo `gitlab-secrets.json`:

```bash
cd /opt/gitlab/gitlab
sudo -u <user> cp config/gitlab-secrets.example.json config/gitlab-secrets.json
sudo -u <user> chmod 0600 config/gitlab-secrets.json
```

10. Edite o arquivo `gitlab-secrets.json` e adicione a chave secreta:

```arduino
sudo nano config/gitlab-secrets.json
```

Adicione a seguinte linha ao arquivo:

```json
{
  "secret_key_base": "<key>"
}
```

Substitua `<key>` por uma chave secreta segura.

11. Compile os assets do GitLab:

```sql
cd /opt/gitlab/gitlab
sudo -u <user> yarn install --production --pure-lockfile
sudo -u <user> bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production
```

12. Configure o GitLab:

```
cd /opt/gitlab/gitlab
sudo -u <user> bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=<password> GITLAB_ROOT_EMAIL=<email> force
```

13. Inicie o GitLab:

```sql
sudo systemctl enable redis
sudo systemctl start redis
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo -u <user> bundle exec rake gitlab:check SANITIZE=true
sudo systemctl enable gitlab
sudo systemctl start gitlab
```

Substitua `<user>` pelo seu nome de usuário.

14. Acesse o GitLab no navegador:

```arduino
http://<hostname or IP address>
```

Substitua `<hostname or IP address>` pelo nome de host ou endereço IP do servidor onde o GitLab foi instalado.

15. Faça login no GitLab usando o nome de usuário `root` e a senha que você configurou anteriormente.

Pronto! Você agora tem o GitLab instalado e funcionando em seu servidor.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liedsons-organization.gitbook.io/gitlab-no-ubuntu/instalacao-full/instalacao-via-source-full.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
