Installa GitLab su Alma Linux 8
Su questa pagina
- Prerequisiti
- Aggiungi il repository GitLab CE
- Installa GitLab CE su Alma Linux 8
- Configura GitLab CE
- Configura firewall
- Accedi a GitLab CE
- Configura il backup GitLab
- Reimposta la password di root di GitLab
- Conclusione
GitLab è un software DevOps gratuito e open source che viene fornito con più strumenti per sviluppare, proteggere e gestire il software in un'unica applicazione. Fornisce repository illimitati gratuiti e collaboratori illimitati. Viene utilizzato principalmente per ospitare repository Git, con funzionalità aggiuntive relative allo sviluppo come il monitoraggio dei problemi. È molto simile a Github e Bitbucket e consente a singoli e team di condividere il codice in remoto con altri.
GitLab è disponibile in quattro edizioni principali:
- GitLab Community Edition: gratuito, open-source e self-hosted.
- GitLab Enterprise Edition - Self-hosted e a pagamento con funzionalità aggiuntive.
- GitLab.com - Gratuito e SaaS.
- GitLab.io - Istanza GitLab privata gestita da GitLab Inc.
In questo post spiegheremo come installare GitLab CE su Alma Linux 8.
Prerequisiti
- Un server che esegue Alma Linux 8.
- Un nome di dominio valido indicato con l'IP del tuo server.
- Sul server è configurata una password di root.
Aggiungere il repository GitLab CE
Per impostazione predefinita, il pacchetto GitLab non è incluso nel repository predefinito di Alma Linux. Quindi dovrai aggiungere il repository ufficiale GitLab al tuo sistema. Puoi scaricare e aggiungere il seguente script per aggiungere il repository GitLab.
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
Otterrai il seguente output:
Complete! Generating yum cache for gitlab_gitlab-ce... Importing GPG key 0x51312F3F: Userid : "GitLab B.V. (package repository signing key) <>" Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey Importing GPG key 0xF27EAB47: Userid : "GitLab, Inc. <>" Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47 From : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg Generating yum cache for gitlab_gitlab-ce-source... The repository is setup! You can now install packages.
È possibile verificare il repository installato utilizzando il seguente comando:
cat /etc/yum.repos.d/gitlab_gitlab-ce.repo
Otterrai il seguente output:
[gitlab_gitlab-ce] name=gitlab_gitlab-ce baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch repo_gpgcheck=1 gpgcheck=1 enabled=1 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 [gitlab_gitlab-ce-source] name=gitlab_gitlab-ce-source baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS repo_gpgcheck=1 gpgcheck=1 enabled=1 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300
Puoi anche elencare il repository GitLab usando il seguente comando:
dnf repolist
Otterrai il seguente output:
repo id repo name appstream Rocky Linux 8 - AppStream baseos Rocky Linux 8 - BaseOS extras Rocky Linux 8 - Extras gitlab_gitlab-ce gitlab_gitlab-ce gitlab_gitlab-ce-source gitlab_gitlab-ce-source
Installa GitLab CE su Alma Linux 8
A questo punto, il repository GitLab viene creato sul tuo sistema. Ora puoi installare GitLab CE eseguendo il seguente comando:
dnf install gitlab-ce -y
Una volta installato GitLab CE, otterrai il seguente output:
It looks like GitLab has not been configured yet; skipping the upgrade script. *. *. *** *** ***** ***** .****** ******* ******** ******** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _______ __ __ __ / ____(_) /_/ / ____ _/ /_ / / __/ / __/ / / __ `/ __ \ / /_/ / / /_/ /___/ /_/ / /_/ / \____/_/\__/_____/\__,_/_.___/ Please configure a URL for your GitLab instance by setting `external_url` Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md Help us improve the installation experience, let us know how we did with a 1 minute survey: https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=14-8 Verifying : gitlab-ce-14.8.2-ce.0.el8.x86_64 1/1 Installed: gitlab-ce-14.8.2-ce.0.el8.x86_64 Complete!
Configura GitLab CE
Successivamente, dovrai definire il tuo nome di dominio nel file di configurazione di GitLab. Per fare ciò, modifica il file di configurazione di GitLab:
nano /etc/gitlab/gitlab.rb
Modifica la seguente riga con il tuo nome di dominio:
external_url 'http://gitlab.example.com'
Salva e chiudi il file, quindi riconfigura GitLab utilizzando il seguente comando:
gitlab-ctl reconfigure
Una volta riconfigurato GitLab CE, otterrai il seguente output:
Notes: Default admin account has been configured with following details: Username: root Password: You didn't opt-in to print initial root password to STDOUT. Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours. NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password. gitlab Reconfigured!
Ora puoi controllare lo stato di GitLab CE usando il seguente comando:
gitlab-ctl status
Otterrai il seguente output:
run: gitaly: (pid 26684) 69s; run: log: (pid 25075) 351s run: gitlab-exporter: (pid 26617) 73s; run: log: (pid 25555) 207s run: gitlab-kas: (pid 26585) 75s; run: log: (pid 25339) 334s run: gitlab-workhorse: (pid 26595) 74s; run: log: (pid 25472) 229s run: grafana: (pid 26665) 70s; run: log: (pid 26315) 110s run: logrotate: (pid 25000) 364s; run: log: (pid 25008) 363s run: nginx: (pid 25488) 226s; run: log: (pid 25499) 222s run: node-exporter: (pid 26603) 74s; run: log: (pid 25541) 213s run: postgres-exporter: (pid 26659) 70s; run: log: (pid 25891) 168s run: postgresql: (pid 25207) 341s; run: log: (pid 25218) 340s run: prometheus: (pid 26631) 72s; run: log: (pid 25629) 194s run: puma: (pid 25406) 249s; run: log: (pid 25417) 246s run: redis: (pid 25039) 358s; run: log: (pid 25047) 357s run: redis-exporter: (pid 26620) 73s; run: log: (pid 25575) 201s run: sidekiq: (pid 25423) 243s; run: log: (pid 25435) 239s
Per arrestare GitLab, eseguire il seguente comando:
gitlab-ctl stop
Per avviare GitLab, esegui il seguente comando:
gitlab-ctl start
Una volta terminato, puoi procedere al passaggio successivo.
Configura firewall
Successivamente, dovrai consentire il servizio HTTP attraverso il firewalld. Puoi permetterlo usando il seguente comando:
firewall-cmd --permanent --add-service=http
Successivamente, ricarica il demone firewalld per applicare le modifiche:
systemctl reload firewalld
Una volta configurato il firewall, puoi procedere al passaggio successivo.
Accedi a GitLab CE
Prima di accedere a GitLab CE, recuperare la password di root di GitLab con il seguente comando:
cat /etc/gitlab/initial_root_password
Dovresti vedere la password root di GitLab CE nel seguente output:
# WARNING: This value is valid only in the following conditions # 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run). # 2. Password hasn't been changed manually, either via UI or via command line. # # If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password. Password: XIlQ4/J7oQ49ZdNuGZto3f5vEJGHZJSTRSIuYL9z0/k= # NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
Ora, apri il tuo browser web e accedi all'interfaccia web di GitLab utilizzando l'URL http://gitlab.example.com. Verrai reindirizzato alla pagina di accesso di GitLab:
Fornisci il nome utente e la password di root e fai clic sul pulsante Accedi. Dovresti vedere l'interfaccia web di GitLab nella pagina seguente:
Configura GitLab Backup
GitLab ti consente anche di creare un backup dell'istanza GitLab. Per creare un backup dell'istanza GitLab, eseguire il seguente comando:
gitlab-rake gitlab:backup:create
Una volta creato il backup, otterrai il seguente output:
2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping uploads ... 2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping builds ... 2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping artifacts ... 2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping pages ... 2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping lfs objects ... 2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping terraform states ... 2022-03-11 11:13:11 +0000 -- done 2022-03-11 11:13:11 +0000 -- Dumping container registry images ... 2022-03-11 11:13:11 +0000 -- [DISABLED] 2022-03-11 11:13:11 +0000 -- Dumping packages ... 2022-03-11 11:13:11 +0000 -- done Creating backup archive: 1646997191_2022_03_11_14.8.2_gitlab_backup.tar ... done Uploading backup archive to remote storage ... skipped Deleting tmp directories ... done
Per impostazione predefinita, il backup di GitLab è archiviato in /var/opt/gitlab/backups. Puoi modificare il percorso di backup modificando le impostazioni nel file di configurazione di GitLab in /etc/gitlab/gitlab.rb.
È possibile verificare il backup generato utilizzando il seguente comando:
ls /var/opt/gitlab/backups
Otterrai il seguente output:
1646997191_2022_03_11_14.8.2_gitlab_backup.tar
Reimposta la password di root di GitLab
Se dimentichi la password dell'amministratore di GitLab, puoi reimpostarla facilmente utilizzando il seguente comando:
gitlab-rake "gitlab:password:reset"
Ti verrà chiesto di impostare la tua nuova password come mostrato di seguito:
Enter username: root Enter password: Confirm password: Password successfully updated for user with username root.
Conclusione
Congratulazioni! hai installato con successo GitLab CE su Alma Linux 8. Ora puoi iniziare a utilizzare GitLab nel tuo ambiente di sviluppo. Non esitate a chiedermi se avete domande.