Select Page

System Configurations:

CPU : 2 Cores
RAM : 2GB
Virtualization : HyperV
IP Address : 192.168.1.245
SSH Username : root
Password : router
OS : Centos 6.9

Install and configure the necessary dependencies

sudo yum install curl openssh-server openssh-clients postfix cronie

sudo service postfix start

sudo chkconfig postfix on

sudo lokkit -s http -s ssh

Add the GitLab package server and install the package

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

sudo yum install gitlab-ce

Configure and start GitLab

sudo gitlab-ctl reconfigure

Note: Required application will be install with the above given command.

WebServer : Nginx
Database : Postgresql

Browse to the hostname and login

On your first visit, you’ll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you’ll be redirected back to the login screen.
The default account’s username is root. Provide the password you created earlier and login. After login you can change the username if you wish.

SMTP Settings

If you would rather send application email via an SMTP server instead of via Sendmail,Add the following configuration information to
/etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure.

vim /etc/gitlab/gitlab.rb

gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = “mx1.50hertz.in”
gitlab_rails[‘smtp_port’] = 465
gitlab_rails[‘smtp_user_name’] = “linux.support@manikarananalytics.in”
gitlab_rails[‘smtp_password’] = “$amiTKar##”
gitlab_rails[‘smtp_domain’] = “mx1.50hertz.in”
gitlab_rails[‘smtp_authentication’] = “login”
gitlab_rails[‘smtp_enable_starttls_auto’] = true
gitlab_rails[‘smtp_tls’] = true
gitlab_rails[‘smtp_openssl_verify_mode’] = ‘none’

# If your SMTP server does not like the default ‘From: gitlab@localhost’ you
# can change the ‘From’ with this setting.
gitlab_rails[‘gitlab_email_enabled’] = true
gitlab_rails[‘gitlab_email_from’] = ‘linux.support@manikarananalytics.in’
gitlab_rails[‘gitlab_email_display_name’] = ‘GitLab Support’
gitlab_rails[‘gitlab_email_reply_to’] = ‘linux.support@manikarananalytics.in’

:wq! (To save the configuration)

gitlab-ctl reconfigure

Testing the SMTP configuration

You can verify GitLab’s ability to send emails properly using the Rails console. On the GitLab server, execute gitlab-rails console to enter the console. Then, you can enter the following command at the console prompt to cause GitLab to send a test email:

#gitlab-rails console
irb(main):003:0> Notify.test_email(‘amit.k@manikarananalytics.in’, ‘Message Subject’, ‘Message Body’).deliver_now

Handling Services

To Restart Gitlab

sudo gitlab-ctl restart

To Restart Nginx

sudo gitlab-ctl restart nginx

To Check All Status

sudo gitlab-ctl status

Directory structure Gitlab uses four different directories.

/opt/gitlab : Holds application code for GitLab and its dependencies.
/var/opt/gitlab : Holds application data and configuration files that gitlab-ctl reconfigure writes to.
/etc/gitlab : Holds configuration files for omnibus-gitlab. These are the only files that you should ever have to edit manually.
/var/log/gitlab : Contains all log data generated by components of omnibus-gitlab.

Login Database:

sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

How To Take The Backup?
GitLab has already defined a rake task that has to be run in the Gitlab root directory to take the backup of database as well as of all the repositories.

Backup:
sudo gitlab-rake gitlab:backup:create

Backup Location: /var/opt/gitlab/backups

How To Restore Backup?
First make sure your backup tar file is in the backup directory described in the
gitlab.rb configuration gitlab_rails[‘backup_path’]. The default is /var/opt/gitlab/backups or just download the tar files wherever you store the tar files on remote.

sudo cp 1492514962_2017_04_18_gitlab_backup.tar /var/opt/gitlab/backups/

Stop the processes that are connected to the database. Leave the rest of GitLab
running:

sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq

# Verify
sudo gitlab-ctl status

Next, restore the backup, specifying the timestamp of the backup you wish to
restore:

# This command will overwrite the contents of your GitLab database!
sudo gitlab-rake gitlab:backup:restore BACKUP=1492514962_2017_04_18

Restart and check GitLab:

sudo gitlab-ctl start
sudo gitlab-rake gitlab:check SANITIZE=true

If there is a GitLab version mismatch between your backup tar file and the installed
version of GitLab, the restore command will abort with an error. Install the
correct GitLab version and try again.