日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

安装部署gitlab ci

發布時間:2025/3/15 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安装部署gitlab ci 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一.環境

系統????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#配置時間同步 [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

腳本內容如下

[root@gitlab-ci?~]#?cat?install_mysql.sh? #!/bin/bashDATADIR='/data/mysql/data' VERSION='mysql-5.5.37' export?LANG=zh_CN.UTF-8#Source?function?library. .?/etc/init.d/functions#camke?install?mysql5.5.X install_mysql(){read?-p?"please?input?a?password?for?root:?"?PASSWDif?[?!?-d?$DATADIR?];thenmkdir?-p?$DATADIRfiyum?install?cmake?make?gcc-c++?bison-devel?ncurses-devel?-yid?mysql?&>/dev/nullif?[?$??-ne?0?];thenuseradd?mysql?-s?/sbin/nologin?-Mfi#useradd?mysql?-s?/sbin/nologin?-M#change?datadir?owner?to?mysqlchown?-R?mysql.mysql?$DATADIRcd#wget?http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.38.tar.gztar?xf?$VERSION.tar.gzcd?$VERSIONcmake?.?-DCMAKE_INSTALL_PREFIX=/usr/local/$VERSION?\-DMYSQL_DATADIR=$DATADIR?\-DMYSQL_UNIX_ADDR=$DATADIR/mysql.sock?\-DDEFAULT_CHARSET=utf8?\-DDEFAULT_COLLATION=utf8_general_ci?\-DENABLED_LOCAL_INFILE=ON?\-DWITH_INNOBASE_STORAGE_ENGINE=1?\-DWITH_FEDERATED_STORAGE_ENGINE=1?\-DWITH_BLACKHOLE_STORAGE_ENGINE=1?\-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1?\-DWITHOUT_PARTITION_STORAGE_ENGINE=1make?&&?make?installif?[?$??-ne?0?];thenaction?"install?mysql?is?failed"??/bin/falseexit?$?fisleep?2#linkln?-s?/usr/local/$VERSION/?/usr/local/mysqlln?-s?/usr/local/mysql/bin/*?/usr/bin/#copy?config?and?start?file/bin/cp?/usr/local/mysql/support-files/my-small.cnf?/etc/my.cnfcp?/usr/local/mysql/support-files/mysql.server?/etc/init.d/mysqldchmod?700?/etc/init.d/mysqld#init?mysql/usr/local/mysql/scripts/mysql_install_db??--basedir=/usr/local/mysql?--datadir=$DATADIR?--user=mysqlif?[?$??-ne?0?];thenaction?"install?mysql?is?failed"??/bin/falseexit?$?fi#check?mysql/etc/init.d/mysqld?startif?[?$??-ne?0?];thenaction?"mysql?start?is?failed"??/bin/falseexit?$?fichkconfig?--add?mysqldchkconfig?mysqld?on/usr/local/mysql/bin/mysql?-e?"update?mysql.user?set?password=password('$PASSWD')?where?host='localhost'?and?user='root';"/usr/local/mysql/bin/mysql?-e?"update?mysql.user?set?password=password('$PASSWD')?where?host='127.0.0.1'?and?user='root';"/usr/local/mysql/bin/mysql?-e?"delete?from?mysql.user?where?password='';"/usr/local/mysql/bin/mysql?-e?"flush?privileges;"#/usr/local/mysql/bin/mysql?-e?"select?version();"?>/dev/null?2>&1if?[?$??-eq?0?];thenecho?"+---------------------------+"echo?"+------mysql安裝完成--------+"echo?"+---------------------------+"fi#/etc/init.d/mysqld?stop }install_mysql

創建gitlab-ci相關數據庫信息

mysql>?CREATE?DATABASE?IF?NOT?EXISTS?`gitlab_ci`?DEFAULT?CHARACTER?SET?`utf8`??COLLATE?`utf8_unicode_ci`; Query?OK,?1?row?affected?(0.04?sec)#創建用戶和密碼 mysql>?CREATE?USER?'gitlab_ci'@'localhost'?IDENTIFIED?BY?'123456'; Query?OK,?0?rows?affected?(0.00?sec)#賦予相關權限 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)

四.創建系統用戶gitlab_ci

[root@gitlab-ci?~]#?useradd?gitlab_ci [root@gitlab-ci?~]#?passwd?gitlab_ci Changing?password?for?user?gitlab_ci. New?password:?????????????????#這里設置密碼為gitlab_ci Retype?new?password:? passwd:?all?authentication?tokens?updated?successfully. [root@gitlab-ci?~]#?chmod?755?/home/gitlab_ci

五.安裝ruby

[root@gitlab-ci?~]#?wget?ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.2.0.tar.gz [root@gitlab-ci?~]#?tar?xf?ruby-2.2.0.tar.gz? [root@gitlab-ci?~]#?cd?ruby-2.2.0 [root@gitlab-ci?ruby-2.2.0]#?./configure [root@gitlab-ci?ruby-2.2.0]#?make?&&?make?install#安裝bundler [root@gitlab-ci?ruby-2.2.0]#?gem?install?bundler?--no-doc 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)#報錯解決如下 [root@gitlab-ci?ruby-2.2.0]#?gem?sources?--remove?https://rubygems.org/ https://rubygems.org/?removed?from?sources [root@gitlab-ci?ruby-2.2.0]#?gem?sources?-a?https://ruby.taobao.org/ https://ruby.taobao.org/?added?to?sources [root@gitlab-ci?ruby-2.2.0]#?gem?sources?-l ***?CURRENT?SOURCES?***https://ruby.taobao.org/#從新安裝 [root@gitlab-ci?ruby-2.2.0]#?gem?install?bundler?--no-doc

六.安裝gitlab ci

#切換到gitlab_ci用戶下,并進入到用戶家目錄 [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#報錯如下 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用戶下修改權限 [root@gitlab-ci?~]#?chmod?-R?777?/usr/local/lib/ruby [root@gitlab-ci?~]#?chmod?-R?777?/usr/local/bin#再次重新執行 [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 #修改內容如下 production:adapter:?mysql2encoding:?utf8reconnect:?falsedatabase:?gitlab_ci????????????#數據庫名稱pool:?5username:?gitlab_ci????????????#數據庫用戶名password:?"123456"?????????????#密碼host:?localhostsocket:?/data/mysql/data/mysql.sock????????#這里指向mysql的socket文件,由于我修改過socket文件的位置,所以這個地方需要手動修改[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的服務啟動腳本

#切換到root用戶下,執行下面的命令 [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#復制站點配置文件 [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; }#測試nginx配置是否有誤,并啟動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


轉載于:https://blog.51cto.com/ly36843/1693196

總結

以上是生活随笔為你收集整理的安装部署gitlab ci的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。