23.2 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

Install and Configure Gitlab on Centos7

GitLab Community Edition is an open source application that allows a team to develope and manage their projects, powerful,  its robust, scalable, secure, and efficient software

GitLab also provides  the teams a single destination of data store, In this article, we will show you How to Install GitLab on Centos7 . GitLab will use some ports on your server, its preferable to install this on a fresh server to avoid any conflicts.

Install and Configure Gitlab on Centos7

Step 1: Install and Configure Centos packages Dependencies.

1-1. Install dependencies
# yum install curl policycoreutils-python openssh-server

Dependencies Resolved

- Advertisement -
====================================================================================================
 Package                         Arch            Version                     Repository        Size
====================================================================================================
Installing:
 policycoreutils-python          x86_64          2.5-22.el7                  base             454 k
Installing for dependencies:
 audit-libs-python               x86_64          2.8.1-3.el7_5.1             updates           75 k
 checkpolicy                     x86_64          2.5-6.el7                   base             294 k
 libcgroup                       x86_64          0.41-15.el7                 base              65 k
 libsemanage-python              x86_64          2.5-11.el7                  base             112 k
 python-IPy                      noarch          0.75-6.el7                  base              32 k
 setools-libs                    x86_64          3.3.8-2.el7                 base             619 k

Transaction Summary
====================================================================================================
Install  1 Package (+6 Dependent packages)
1-2. Install Postfix

installing Postfix service to send notification emails is optional  if you want  to   activate it  please follow the stpes bellow .

# yum install postfix
# systemctl start postfix
# systemctl enable postfix
# systemctl status postfix

During this installation a configuration  Select ‘Internet Site‘ and use your server’s external DNS for ‘mail name‘ and press enter.

Step 2: Add GitLab Repository to you Centos

Please  add the bellow Rep  to be able to fetch the Gitlab software

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

Check if the Repository has been added

[root@osradar ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nforce.com
* elrepo: ftp.nluug.nl
* extras: mirror.i3d.net
* updates: centos.mirror.transip.nl
repo id repo name status
base/7/x86_64 CentOS-7 - Base 9,911
elrepo ELRepo.org Community Enterprise Linux Repository - el7 246
extras/7/x86_64 CentOS-7 - Extras 432
gitlab_gitlab-ce/x86_64 gitlab_gitlab-ce 401
gitlab_gitlab-ce-source gitlab_gitlab-ce-source 0
updates/7/x86_64 CentOS-7 - Updates 1,561
repolist: 12,551
[root@osradar ~]#

Step 3: Install  GitLab

install GitLab CE Community Edition with theyum command.

# yum install gitlab-ce -y
Package Arch Version Repository Size
====================================================================================================
Installing:
gitlab-ce x86_64 11.3.6-ce.0.el7 gitlab_gitlab-ce 416 M

To change the GitLab URL access, edit the ‘/etc/gitlab/gitlab.rb’ file.

sudo vi /etc/gitlab/gitlab.rb

Now change the ‘external_url’ value with your own domain name.

external_url 'http://git.osradar.lan'

Run this command to make this change Permanent and enabel any recent changes.

gitlab-ctl reconfigure

Please allow HTTP and HTTPS  ports on the firewall :

# firewall-cmd --permanent --add-service=80/tcp
# firewall-cmd --permanent --add-service=443/tcp
# systemctl reload firewalld

 

Step 4:GitLab Post-Installation

Now Lets  try to  Connect to  http://git.osradar.lan and  reset   password

You can create users/admins,  Edits password , Create news projects, you have a full dashboard so that you can manage all your projects.

Step 5:How to Stop/Start   Gitlab

You can Stop Start Gitlab with the following commands

Start

gitlab-ctl start

Stop

gitlab-ctl stop

Status

gitlab-ctl status

Step 6:How to Backup GitLab on Centos7

The default data backup will be stored in /var/opt/gitlab/backups. You can modify this backup path in /etc/gitlab/gitlab.rb file. If you made changes to the backup configuration, do not forget to run the following command to create the backup.

#gitlab-rake gitlab:backup:create

[root@osradar ~]# gitlab-rake gitlab:backup:create
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
done
Dumping uploads ...
done
Dumping builds ...
done
Dumping artifacts ...
done
Dumping pages ...
done
Dumping lfs objects ...
done
Dumping container registry images ...
[DISABLED]
Creating backup archive: 1539894146_2018_10_18_11.3.6_gitlab_backup.tar ... done
Uploading backup archive to remote storage ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping
[root@osradar ~]#

Step 7:Using  Postfix Configuration

Additional configuration for application email:

GitLab  using sendmail to send emails from the application to the users. If you would rather send application email via an SMTP server instead of via Sendmail, then add the following configuration information to /etc/gitlab/gitlab.rb

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "my-gmail-password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html

Once edited, dontforget ro re-run the reconfiguration, if you are using local or internal users then just SKIP this step.

$ sudo gitlab-ctl reconfigure

Step 8:Push your First  File from Client to the Master

-Create user on GITlab Dashboard

-Create Linux user on The Client machine

-Generate ssh keys and copy the text on id_rsa.pub

-Please copy this text to ssh-key to SSH-key related to the user on the dashboard

-Now try to get your git clone of your created  Empty project

-Create  README file and push itto the master 

[osradar@osradar ~]$ git clone [email protected]:root/osradarproject.git
Cloning into 'osradarproject'...
You are not Welcome here ;
All you activities are traced
warning: You appear to have cloned an empty repository.
[osradar@osradar ~]$ ls
osradarproject
[osradar@osradar ~]$ cd osradarproject/
[osradar@osradar osradarproject]$ vi README.md
[osradar@osradar osradarproject]$ git add README.md
[osradar@osradar osradarproject]$ git commit -m "add README"
[master (root-commit) 1ca4113] add README
1 file changed, 1 insertion(+)
create mode 100644 README.md
[osradar@osradar osradarproject]$ git push origin master
You are not Welcome here ;
All you activities are traced
Counting objects: 3, done.
Writing objects: 100% (3/3), 223 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:root/osradarproject.git
* [new branch] master -> master

check  on the  dashboard

Please enjoy and let us know if we can help

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article