Prerequisites
Use the following commands to install required dependencies to begin Gitlab installation.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y curl openssh-server ca-certificates
Gitlab Installation
Now, enable the Gitlab Debian package repository on your system. Execute below command on your system, this will add a file /etc/apt/sources.list.d/gitlab_gitlab-ce.list in your system.
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
After enabling apt repository, run following command to install Gitlab community edition.
sudo apt-get install gitlab-ce or
#Next, install the GitLab package. Change `http://gitlab.example.com` to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL. HTTPS requires additional configuration after installation.
sudo EXTERNAL_URL="http://gitlab.example.com" apt-get install gitlab-ce
Gitlab Configuration
Now execute the following command to configure the Gitlab installation. This will make all the installations and required changes in order to run Gitlab community edition.
sudo gitlab-ctl reconfigure
Schedule Data Backup
Use the following command to create the complete backup of Gitlab data. The default backup location will be /var/opt/gitlab/backups. You can change this setting in /etc/gitlab/gitlab.rb file.
sudo gitlab-rake gitlab:backup:create
You can also add the same command scheduler to backup data nightly. The below cron will backup data.
0 22 * * 2-6
sudo gitlab-rake gitlab:backup:create
sudo gitlab-rake gitlab:backup:restore <filename>