Step-by-Step Guide to Installing and Configuring GitLab on CentOS 6
This tutorial walks through preparing a CentOS 6 VM, installing required packages, downloading and installing the GitLab omnibus RPM, configuring GitLab (including LDAP), reconfiguring services, accessing the web UI, setting up SSH keys, and troubleshooting common issues.
Prepare a virtual machine running CentOS 6 and download the appropriate GitLab dependency package from the official website.
Install the required system packages:
sudo yum install openssh-server sudo yum install postfix sudo yum install cronieStart and enable the services:
sudo service postfix start sudo chkconfig postfix on sudo lokkit -s http -s sshDownload the GitLab omnibus RPM (or copy it to the server if the network blocks the download) and install it:
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-7.9.0_omnibus.2-1.el6.x86_64.rpm sudo rpm -i gitlab-7.9.0_omnibus.2-1.el6.x86_64.rpmIf the RPM fails due to size mismatch, transfer the file via scp from another host and reinstall.
Configure GitLab by editing /etc/gitlab/gitlab.rb. Set the external URL and add LDAP configuration, for example:
external_url = 'http://gitlab.test.com' gitlab_rails['ldap_enabled'] = true gitlab_rails['ldap_servers'] = YAML.load <<-EOS main: label: 'LDAP' host: 'xxx.xxx.xxx.xxx' port: 389 uid: 'sAMAccountName' bind_dn: '[email protected]' password: '******' base: 'DC=xxxxxx,DC=com' EOSUsually no changes are needed in /var/opt/gitlab/gitlab-rails/etc/gitlab.yml unless specific customizations are required.
Apply the configuration and start GitLab: sudo gitlab-ctl reconfigure Check the status of all components: sudo gitlab-ctl status Restart GitLab if necessary: sudo gitlab-ctl restart Access the web UI (e.g., http://localhost or the configured hostname), log in with the default administrator account (username: root, password: 5iveL!fe), and change the password on first login.
Configure SSH keys for password‑less Git operations: generate a key with ssh-keygen -t rsa -C "[email protected]", copy the public key ( ~/.ssh/id_rsa.pub) into GitLab’s SSH key field, and verify that pushes and clones work without prompting for credentials.
Common troubleshooting steps include re‑running sudo gitlab-ctl reconfigure when encountering "retry later" or 422 errors, checking for port conflicts with Apache/httpd (kill or remove httpd if it blocks GitLab), and ensuring the correct hostname/IP is set in external_url and the local /etc/hosts file.
When migrating to a new GitLab server, update DNS or host entries to point to the new IP, delete the old ~/.ssh/known_hosts entry, and re‑add the SSH key to avoid clone failures.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
360 Quality & Efficiency
360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
