4.1. Como instalar GitLAB en Ubuntu (Testeado en v20.04)¶
4.1.1. 1. Instalar y configurar las dependencias¶
Primero debe actualizar el sistema y añadir las siguientes dependencias.
1 2 | $ sudo apt-get update
$ sudo apt-get install -y curl openssh-server ca-certificates tzdata
|
1b. (OPCIONAL) Instalar Postfix para notificaciones de e-mail.¶
Si desea habilitar notificaciones de e-mail puede instalar postfix y configurar su Relé de SMTP interno, pero eso no será explicado en este documento.
$ sudo apt-get install -y postfix
4.1.2. 2. Añadir el repositorio de GitLAB e instalar GitLAB CE¶
Añada el repositorio ejecutando un curl en su consola shell.
$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
4.1.3. 3. Instalar GitLAB CE¶
Introduzca el siguiente comando en la consola:
$ sudo EXTERNAL_URL="https://gitlab.yourdomain.com" apt-get install gitlab-ce
Habilitar SSL y Utilizar un certificado propio¶
Para habilitar SSL con un certificado propio tendrá que deshabilitar Letsencrypt en el archivo de configuración y reconfigurar GitLAB.
Ahora genere su certificado con OpenSSL (o quizás compró uno, utilice el que quiera!)
Para crear un certificado básico puede hacer lo siguiente:
$ openssl req -x509 -sha256 -nodes -days 3650 -newkey rsa:4096 -keyout /etc/gitlab/ssl/gitlab-br.key -out /etc/gitlab/ssl/gitlab-br.crt
Modifique la configuración de NGINX en /etc/gitlab/gitlab.rb y añada sucertificado y clave a los parámetros
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ################################################################################
## GitLab NGINX
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html
################################################################################
nginx['enable'] = true
nginx['client_max_body_size'] = '250m'
nginx['redirect_http_to_https'] = false
nginx['redirect_http_to_https_port'] = 80
##! Most root CA's are included by default
# nginx['ssl_client_certificate'] = "/etc/gitlab/ssl/ca.crt"
##! enable/disable 2-way SSL client authentication
# nginx['ssl_verify_client'] = "off"
##! if ssl_verify_client on, verification depth in the client certificates chain
nginx['ssl_verify_depth'] = "1"
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab-br.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab-br.key"
nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256"
nginx['ssl_prefer_server_ciphers'] = "on"
##! **Recommended by: https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
##! https://cipherli.st/**
nginx['ssl_protocols'] = "TLSv1.2 TLSv1.3"
##! **Recommended in: https://nginx.org/en/docs/http/ngx_http_ssl_module.html**
nginx['ssl_session_cache'] = "builtin:1000 shared:SSL:10m"
##! **Default according to https://nginx.org/en/docs/http/ngx_http_ssl_module.html**
nginx['ssl_session_timeout'] = "5m"
##! nginx['ssl_dhparam'] = nil # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem
##! nginx['listen_addresses'] = ['*', '[::]']
|
Change the following Letsencrypt parameter
1 2 3 4 5 | ################################################################################
# Let's Encrypt integration
################################################################################
letsencrypt['enable'] = false
[...]
|
Debería poder acceder a su servidor yendo a la URL que configuró o la Dirección IP directamente.
OR