安装部署gitlab ci
生活随笔
收集整理的這篇文章主要介紹了
安装部署gitlab ci
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一.環(huán)境
系統(tǒng)????CentOS 6.4x64
二.安裝依賴包
#添加epel源 [root@gitlab-ci?~]#?rpm?-ivh?http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm [root@gitlab-ci?~]#?sed?-i?'s@#b@b@g'?/etc/yum.repos.d/epel.repo? [root@gitlab-ci?~]#?sed??-i?'s@mirrorlist@#mirrorlist@g'?/etc/yum.repos.d/epel.repo#配置時(shí)間同步 [root@gitlab-ci?~]#?echo?"*/10?*?*?*?*?/usr/sbin/ntpdate?asia.pool.ntp.org??&>/dev/null"?>/var/spool/cron/root [root@gitlab-ci?~]#?yum?groupinstall?"Development?Tools"?-y [root@gitlab-ci?~]#?yum?update?&&?yum?upgrade [root@gitlab-ci?~]#?yum?install?vim?python?wget?curl?git?openssh-server?-y [root@gitlab-ci?~]#?yum?install?sqlite?sqlite-devel?mysql?mysql-libs?mysql-devel?-y [root@gitlab-ci?~]#?yum?install?ncurses-devel?libcurl-devel?libcurl?patch??nodejs?-y [root@gitlab-ci?~]#?yum?install?libxslt-devel?libyaml-devel?libxml2?libxml2-devel?gdbm-devel?libffi?libffi-devel?zlib?zlib-devel?openssl-devel?readline?readline-devel?curl-devel?openssl-devel?pcre-devel?memcached-devel?valgrind-devel?ImageMagick-devel?ImageMagick?libicu?libicu-devel?make?bzip2?autoconf?automake?libtool?bison?redis?libpq-devel?libicu-devel?postgresql-libs?postgresql-devel?-y [root@gitlab-ci?~]#?chkconfig?redis?on [root@gitlab-ci?~]#?chkconfig?postfix?on [root@gitlab-ci?~]#?service?redis?start Starting?redis-server:?????????????????????????????????????[??OK??]三.安裝配置mysql
這里使用腳本安裝mysql,版本為事先下載好的mysql-5.5.37
腳本內(nèi)容如下
創(chuàng)建gitlab-ci相關(guān)數(shù)據(jù)庫信息
mysql>?CREATE?DATABASE?IF?NOT?EXISTS?`gitlab_ci`?DEFAULT?CHARACTER?SET?`utf8`??COLLATE?`utf8_unicode_ci`; Query?OK,?1?row?affected?(0.04?sec)#創(chuàng)建用戶和密碼 mysql>?CREATE?USER?'gitlab_ci'@'localhost'?IDENTIFIED?BY?'123456'; Query?OK,?0?rows?affected?(0.00?sec)#賦予相關(guān)權(quán)限 mysql>?GRANT?SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER?ON?gitlab_ci.*?TO?'gitlab_ci'@'localhost'; Query?OK,?0?rows?affected?(0.00?sec)mysql>?FLUSH?PRIVILEGES; Query?OK,?0?rows?affected?(0.00?sec)四.創(chuàng)建系統(tǒng)用戶gitlab_ci
[root@gitlab-ci?~]#?useradd?gitlab_ci [root@gitlab-ci?~]#?passwd?gitlab_ci Changing?password?for?user?gitlab_ci. New?password:?????????????????#這里設(shè)置密碼為gitlab_ci Retype?new?password:? passwd:?all?authentication?tokens?updated?successfully. [root@gitlab-ci?~]#?chmod?755?/home/gitlab_ci五.安裝ruby
六.安裝gitlab ci
#切換到gitlab_ci用戶下,并進(jìn)入到用戶家目錄 [root@gitlab-ci?ruby-2.2.0]#?su?-?gitlab_ci [gitlab_ci@gitlab-ci?~]$?git?clone?https://gitlab.com/gitlab-org/gitlab-ci.git [gitlab_ci@gitlab-ci?~]$?cd?gitlab-ci/ [gitlab_ci@gitlab-ci?gitlab-ci]$?git?checkout?5-4-stable [gitlab_ci@gitlab-ci?gitlab-ci]$?mkdir?-p?tmp/pids [gitlab_ci@gitlab-ci?gitlab-ci]$?mkdir?-p?tmp/sockets [gitlab_ci@gitlab-ci?gitlab-ci]$?gem?install?bundler#報(bào)錯(cuò)如下 ERROR:??While?executing?gem?...?(Gem::RemoteFetcher::FetchError)Errno::ECONNRESET:?Connection?reset?by?peer?-?SSL_connect?(https://api.rubygems.org/quick/Marshal.4.8/bundler-1.10.6.gemspec.rz)#解決如下 [gitlab_ci@gitlab-ci?gitlab-ci]$?gem?sources?--remove?https://rubygems.org/ https://rubygems.org/?removed?from?sources [gitlab_ci@gitlab-ci?gitlab-ci]$?gem?sources?-a?https://ruby.taobao.org/ https://ruby.taobao.org/?added?to?sources [gitlab_ci@gitlab-ci?gitlab-ci]$?gem?sources?-l ***?CURRENT?SOURCES?***https://ruby.taobao.org/ [gitlab_ci@gitlab-ci?gitlab-ci]$?gem?install?bundler ERROR:??While?executing?gem?...?(Gem::FilePermissionError)You?don't?have?write?permissions?for?the?/usr/local/lib/ruby/gems/2.2.0?directory.#切換到root用戶下修改權(quán)限 [root@gitlab-ci?~]#?chmod?-R?777?/usr/local/lib/ruby [root@gitlab-ci?~]#?chmod?-R?777?/usr/local/bin#再次重新執(zhí)行 [gitlab_ci@gitlab-ci?gitlab-ci]$?gem?install?bundler [gitlab_ci@gitlab-ci?gitlab-ci]$?bundle?--without?development?test [gitlab_ci@gitlab-ci?gitlab-ci]$?cp?config/database.yml.mysql?config/database.yml [gitlab_ci@gitlab-ci?gitlab-ci]$?vim?config/database.yml #修改內(nèi)容如下 production:adapter:?mysql2encoding:?utf8reconnect:?falsedatabase:?gitlab_ci????????????#數(shù)據(jù)庫名稱pool:?5username:?gitlab_ci????????????#數(shù)據(jù)庫用戶名password:?"123456"?????????????#密碼host:?localhostsocket:?/data/mysql/data/mysql.sock????????#這里指向mysql的socket文件,由于我修改過socket文件的位置,所以這個(gè)地方需要手動(dòng)修改[gitlab_ci@gitlab-ci?gitlab-ci]$?cp?config/application.yml.example?config/application.yml [gitlab_ci@gitlab-ci?gitlab-ci]$?cp?config/unicorn.rb.example?config/unicorn.rb [gitlab_ci@gitlab-ci?gitlab-ci]$?bundle?exec?rake?db:setup?RAILS_ENV=production [gitlab_ci@gitlab-ci?gitlab-ci]$?bundle?exec?whenever?-w?RAILS_ENV=production七.配置gitlab_ci的服務(wù)啟動(dòng)腳本
#切換到root用戶下,執(zhí)行下面的命令 [root@gitlab-ci?gitlab_ci]#?cp?/home/gitlab_ci/gitlab-ci/lib/support/init.d/gitlab_ci?/etc/init.d/gitlab_ci [root@gitlab-ci?gitlab_ci]#?chkconfig?--add?gitlab_ci [root@gitlab-ci?gitlab_ci]#?chkconfig?gitlab_ci?on [root@gitlab-ci?gitlab_ci]#?/etc/init.d/gitlab_ci?start八.安裝配置nginx
[root@gitlab-ci?gitlab_ci]#?yum?install?nginx?-y#復(fù)制站點(diǎn)配置文件 [root@gitlab-ci?gitlab_ci]#?cp??/home/gitlab_ci/gitlab-ci/lib/support/nginx/gitlab_ci?/etc/nginx/conf.d/gitlab_ci.conf#修改gitlab_ci.conf配置文件如下 [root@gitlab-ci?gitlab_ci]#?cat?/etc/nginx/conf.d/gitlab_ci.conf? #?GITLAB?CI #?Maintainer:?@randx #?App?Version:?2.0upstream?gitlab_ci?{server?unix:/home/gitlab_ci/gitlab-ci/tmp/sockets/gitlab-ci.socket; }server?{listen?80?;?????????#?e.g.,?listen?192.168.1.1:80;server_name?gitci.keluofu.com;?????#修改這里????root?/home/gitlab_ci/gitlab-ci/public;access_log??/var/log/nginx/gitlab_ci_access.log;error_log???/var/log/nginx/gitlab_ci_error.log;location?/?{try_files?$uri?$uri/index.html?$uri.html?@gitlab_ci;}location?@gitlab_ci?{proxy_read_timeout?300;proxy_connect_timeout?300;proxy_redirect?????off;proxy_set_header???X-Forwarded-Proto?$scheme;proxy_set_header???Host??????????????$http_host;proxy_set_header???X-Real-IP?????????$remote_addr;proxy_pass?http://gitlab_ci;}#?adjust?this?to?match?the?largest?build?log?your?runners?might?submit,#?set?to?0?to?disable?limitclient_max_body_size?10m; }#測(cè)試nginx配置是否有誤,并啟動(dòng)nginx [root@gitlab-ci?gitlab_ci]#?nginx?-t nginx:?the?configuration?file?/etc/nginx/nginx.conf?syntax?is?ok nginx:?configuration?file?/etc/nginx/nginx.conf?test?is?successful [root@gitlab-ci?gitlab_ci]#?/etc/init.d/nginx?start Starting?nginx:????????????????????????????????????????????[??OK??] [root@gitlab-ci?gitlab_ci]#?netstat?-tunlp?|grep?nginx tcp????????0??????0?0.0.0.0:80??????????????????0.0.0.0:*???????????????????LISTEN??????36894/nginx轉(zhuǎn)載于:https://blog.51cto.com/ly36843/1693196
總結(jié)
以上是生活随笔為你收集整理的安装部署gitlab ci的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C/C++ pthread 线程库的封装
- 下一篇: iOS LLDB调试精解