linux中安裝gitlab和cicd(斷網版)

  1:先介紹一下怎麼查找所須要的依賴包node

firewalld
postfix
wget
gitlab-ce
#yum install rpmname--downloadonly --downloaddir=/rpmpath

例如:yum install gitlab-runner --downloadonly --downloaddir=/opt/soft/postfix

下載
gitlab-runner到指定的/opt/soft/postfix 路徑下 這個只是下載

  2:介紹一下安裝gitlab和cicd所須要的軟件和依賴
policycoreutils-python
openssh-server
gitlab-runner

注:我用的是rpm方式安裝的,下載軟件包實在有網絡的linux裏面下載的,以後在cp到無網絡的linux中。
  3:開始安裝

    (1):首先安裝
#rpm -qa |grep 包名(例如:rpm -qa |grep audit)
       安裝命令:#rpm -ivh audit-2.8.4-4.el7.x86_64.rpm --nodeps(這樣寫是由於會有衝突)policycoreutils-python所須要的依賴包,安裝以前查看是否有這些包有的話就不用在安裝
      查看命令:

  audit-2.8.4-4.el7.x86_64.rpmpython

   audit-libs-2.8.4-4.el7.x86_64.rpmlinux

   audit-libs-python-2.8.4-4.el7.x86_64.rpmgit

   checkpolicy-2.5-8.el7.x86_64.rpmgolang

   libcgroup-0.41-20.el7.x86_64.rpmdocker

   libselinux-2.5-14.1.el7.i686.rpmshell

   libselinux-2.5-14.1.el7.x86_64.rpmvim

   libselinux-python-2.5-14.1.el7.x86_64.rpm瀏覽器

   libselinux-utils-2.5-14.1.el7.x86_64.rpmruby

   libsemanage-2.5-14.el7.x86_64.rpm

   libsemanage-python-2.5-14.el7.x86_64.rpm

   libsepol-2.5-10.el7.i686.rpm

   libsepol-2.5-10.el7.x86_64.rpm

   policycoreutils-2.5-29.el7_6.1.x86_64.rpm

   policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm

   python-IPy-0.75-6.el7.noarch.rpm

   setools-libs-3.3.8-4.el7.x86_64.rpm

    (2):安裝ssh server,和上面的方法同樣,現下載,後查看,在安裝,這個我就不寫了

        安裝以後要將SSH服務設置成開機自啓動

        #systemctl enable sshd

        啓動SSH服務

        #sudo systemctl start sshd

    (3):安裝firewalld

        開啓防火牆

        #systemctl start firewalld.service

        添加http服務到firewalld,pemmanent表示永久生效,若不加--permanent系統下次啓動 後就會失效

        #firewall-cmd --permanent --add-service=http

        重啓防火牆

        #sudo systemctl reload firewalld

    (4):安裝postfix

        postfix服務設置成開機自啓動

        #systemctl enable postfix

        啓動postfix

        #systemctl start postfix

 

    (5):安裝wget

    (6):安裝gitlab-ce

        修改gitlab配置文件指定服務器ip和自定義端口

        #vim /etc/gitlab/gitlab.rb

        找到 external_url 開頭的 雙引號裏面就是要修改的內容把裏面的ip和端口號修改爲本身的,默認端口號是8080,若是這個被佔用,要修改爲 不被佔用的端口號

         修改爲例如:192.34.23.144:8088  這個就是雙引號裏面的修改

        重置gitlab

        #gitlab-ctl reconfigure

        啓動gitlab

        #gitlab-ctl restart

        8088端口添加到防火牆中

        #firewall-cmd --zone=public --add-port=8088/tcp --permanent

        重啓防火牆

        #systemctl reload firewalld

        注:這個時候能夠用瀏覽器訪問Gitlab:ip+端口號

        首先保證Gitlab可用運行內存大於4G,端口未被佔用若是第一次登錄出現502,試着多登錄幾回就OK首次進去以後須要修改登錄密碼

    (7):安裝gitlab-runner 

        先安裝依賴和rpm包 (gitlab-runner所須要的)     

        #rpm -ivh git-1.8.3.1-20.el7.x86_64.rpm --nodeps --force

        #rpm -ivh gitlab-runner-12.0.2-1.x86_64.rpm --nodeps --force

        #rpm -ivh perl-Git-1.8.3.1-20.el7.noarch.rpm --nodeps --force

        #rpm -ivh perl-TermReadKey-2.30-20.el7.x86_64.rpm --nodeps --force

        啓動gitlab-runner

        #systemctl start gitlab-runner

        查看gitlab-runner狀態

        #systemctl status gitlab-runner

    (8):註冊gitlab

         

        #gitlab-runner register

        請輸入gitlabci協調人URL (e.g. https://gitlab.com/):

        #http://10.39.47.63:8088(這個是在瀏覽器中登錄gitlab以後生成的以下圖)

         請輸入協調人的gitlab-ci令牌:

        #c_FtDSqzNK8YdJwvzXGU

        請輸入協調人的gitlab-ci描述:

        #gitlab-runner-test

        請輸入這個runnergitlab-ci標籤(逗號分隔):

        #my-tag,another-tag

        請輸入執行器:docker+machine, kubernetes, docker, parallels, shell, ssh, virtualbox, docker-ssh+machine, docker-ssh:

        #docker

        請輸入默認的Docker鏡像(ruby:2.1):

        #golang:latest

    (9):查看是否註冊成功

       

 

     注:有問題能夠隨時提問

相關文章
相關標籤/搜索