Task:
Install GitLab on CentOS Stream or RockyOS using download or the install sh script.
Steps:
1. Install pre-requisites
2. Download Package or Script for Install
3. Install Package with Dependancies
4. Configure Gitlab
5. Other Post-Installation
Installation:
1. Install Pre-requisites:
a. Update system:
$ sudo dnf update
<approve updates and wait>
b. Install python libraries:
$ sudo dnf install curl vim policycoreutils python3-policycoreutils
<approve installs of python3 and policycoreutils and wait>
c. Install postfix for mail notifications:
$ sudo install postfix
<approve and wait>
$ sudo systemctl enable postfix && sudo systemctl start postfix
<confirm>
2. Download RPM package or repo script:
Note:
- Two options: download specific package or run the repo install script. Perform either versiop a. or b:
a. Install specific package:
Download the correct package for your version of Linux (e.g. RockyOS 9 or RockyOS 10):
- Location: packages.gitlab.com/ui/browse/gitlab/gitlab-ce/el
- Choose version: 10
- Choose platform: x86_64
- Choose version: 19.2.4-ce
$ cd ~
$ mkdir tmpgitlab
$ cd tmpgitlab
e.g.
$ curl https://packages.gitlab.com/gitlab/gitlab-ce/el/10/x86_64/Packages/g/gitlab-ce-19.2.4-ce.0.el10.x86_64.rpm
b. Prep via repo script:
$ cd ~
$ mkdir tmpgitlab
$ cd tmpgitlab
$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
$ sudo dnf install gitlab-ce
3. Install Gitlab:
Note:
- Two options: install the specific package downloaded (continue version a) or install via repo (continue version b):
a. Install package downloaded:
$ sudo dnf localinstall gitlab-ce-19.2.4-ce.0.el10.x86_64.rpm
<confirm and wait>
b. Install repo configured:
$ sudo dnf install gitlab-ce
<confirm and wait>
4. Configure Gitlab:
a. Edit gitlab.rb, and locate the external_url:
- Update the domain name, and update the port if not using standard HTTPS/443 port
- Update the smtp_variables with the correct settings for the internal mail server
$ sudo vi /etc/gitlab/gitlab.rb
...
external_url 'https://git.ocp4.example.com:8443'
...
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.example.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp_user_id"
gitlab_rails['smtp_password'] = "smtp_really_great_password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
...
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'
...
b. Issue the reconfigure:
$ sudo gitlab-ctl reconfigure
<wait - this will take a while>
c. Update the VM firewall:
- Open the HTTPS/443 port or the custom HTTPS port/8443:
$ sudo firewall-cmd --zone=public --add-port=8443/tcp --permanent
$ sudo firewall-cmd --reload
d. Confirm local DNS is working:
- If not set-up yet, you can use the local /etc/hosts file
$ sudo vi /etc/hosts
...
10.0.55.215 git.ocp4.example.com
...
d. Set the root password via browser:
- Unless you replaced the self certificate when editing gitlab.rb, we'll need to accept an exception
- web browser --> git.ocp4.example.com:8443 --> accept self-certificate -->
- In the form:
- - user: root
- - password: password
Notes:
- After login, you can skip or create the first project.
- If need to reset password, perform:
$ sudo gitlab-rake "gitlab:password:reset[root]"
<wait a while, when prompted enter password and confirm and enter password again>
5. Post-Installation:
a. Disable user sign-up if using LDAP:
- web browser --> git.ocp4.example.com:8443 --> Menu (hamburger lines) --> Admin (wrench icon) --> Settings (gear icon) --> General --> Sign-up Restrictions --> Uncheck Sign-up Enabled --> click Save changes (button)
Note:
- Logout and the login form no longer has a Register link to sign-up.
b. Bind LDAP user to use LDAP Directory:
Note:
- Requires us to edit the gitlab.rb config file again, and create a new settings doc for the LDAP settings: ldap_settings.yaml
- In the ldap_settings.yaml file, update the host, port, bind_dn, password, and search base
$ sudo vi /etc/gitlab/gitlab.rb
...
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load.file('/etc/gitlab/ldap_settings.yaml')
...
$ sudo vi /etc/gitlab/ldap_settings.yaml
main:
label: 'FreeIPA'
host: 'ldap.mindwatering.net'
port: 636
uid: 'uid'
method: 'tls'
bind_dn: 'uid=gitlab_username,cn=users,cn=accounts,dc=mindwatering,dc=net'
password: 'gitlab_great_user_password'
encryption: 'plain'
base: 'cn=accounts,dc=mindwatering,dc=net'
verify_certificates: false
attributes:
username: ['uid']
email: ['mail']
name: 'displayName'
first_name: 'givenName'
last_name: 'sn'
c. Perform gitlab reconfigure to use the LDAP directory:
$ sudo gitlab-ctl reconfigure
<wait a while>
previous page
|