centos 6.5安装GitLab安装

1、安装操作系统

a、安装wget(系统版本是6.5

#yum -y install wget

b、增加EPEL安装源

EPEL,即Extra Packages for Enterprise Linux,这个软件仓库里有很多非常常用的软件,而且是专门针对RHEL设计的,对RHEL标准yum源是一个很好的补充,完全免费使用,由 Fedora项目维护,所以如果你使用的是RHEL,或者CentOS,Scientific等RHEL系的linux,可以非常放心的使用EPEL的 yum源。

下载并安装GPG key

#wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 https://www.fedoraproject.org/static/0608B895.txt
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

安装epel-release-6-8.noarch包

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

c、增加PUIAS安装源

PUIAS Linux是面向桌面和服务器的完整的操作系统,它靠编译Red Hat Enterprise Linux的源代码包来创建。除了这些上游的软件包外,该项目还提供一些其他的软件仓库:“Addons”包含了通常的Red Hat发行中未收入的额外软件包,“Computational”提供专门针对科学计算的软件,“Unsupported”则收入各种各样的测试性软件 包。该发行由美国普林斯顿 大学的高等研究所维护。

创建/etc/yum.repos.d/PUIAS_6_computational.repo,并添加如下内容:

[PUIAS_6_computational]
name=PUIAS computational Base $releasever - $basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias

下载并安装GPG key

#wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-puiashttp://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias

#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias

检验下是否安装成功

# rpm -qa gpg*

Tips:安装完EPEL和PUIAS两个源后,可以检测下:

#yum repolist

d、安装GitLab的所需依赖包和工具

# yum -y groupinstall ‘Development Tools‘
# yum -y install vim-enhanced readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis sudo wget crontabs logwatch logrotate perl-Time-HiRes gitRHEL提示如果部分包不能安装,例如: eg. gdbm-devel, libffi-devel and
libicu-devel,那么增加rhel6的安装源。# yum-config-manager --enable rhel-6-server-optional-rpmse、配置redis(redis安装见备注)备注:#tar zxvf redis-3.0.0.tar.gz#cd redis-3.0.0#make && make install配置redis使其在开机时启动:# sudo chkconfig redis on# sudo service redis startf、配置邮件服务器(这里不做设置)2、安装Ruby下载并编译:# mkdir /tmp/ruby && cd /tmp/ruby# curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz# cd ruby-2.0.0-p353# ./configure --prefix=/usr/local/# make && make install安装完成后,重新登录终端确保$PATH生效,检测ruby的安装成功与否:# which ruby/usr/local/bin/ruby# cd /usr/local/bin/# ruby -vruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]安装bundle:# sudo gem install bundler --no-ri --no-rdoc如果提示sudo: gem: command notfound,使用root账号登录执行该命令即可。安装过程中会出现下面的错误.解决方法:[[email protected]]# geminstall bundler --no-ri --no-rdocERROR:  Could not find a valid gem ‘bundler‘ (>=0), here is why: Unable to download data from https://rubygems.org/ -Errno::ETIMEDOUT: Connection timed out - connect(2)(https://rubygems.org/latest_specs.4.8.gz)是因为国内网络导致rubygems.org存放在Amazon S3上面的资源文件间歇性连接失败,用国内的RubyGems镜像(参见http://ruby.taobao.org/)替换官方镜像,方法如下:[[email protected]]# gemsources --remove https://rubygems.org/https://rubygems.org/removed from sources[[email protected]]# gemsources -a https://ruby.taobao.org/https://ruby.taobao.org/added to sources[[email protected]]# gemsources -l*** CURRENT SOURCES***https://ruby.taobao.org/[[email protected]]# geminstall bundler --no-ri --no-rdocFetching:bundler-1.7.6.gem (100%)Successfullyinstalled bundler-1.7.61 gem installed3、系统用户创建用户git#adduser --system --shell /bin/bash --comment ‘GitLab‘ --create-home --home-dir /home/git/ git因为git用户不需要登录,所以这里不需要设置git的密码。4、配置GitLab shellGitLabshell是专门为GitLab开发的提供ssh访问和版本管理的软件。先使用root登录,而后切换成git# su - git克隆gitlab shell$ git clone https://github.com/gitlabhq/gitlab-shell.git$ cd gitlab-shell切换成1.8.0版本,并编辑配置$ git checkout v1.8.0$ cp config.yml.example config.yml这里最重要的是将gitlab_url修改成gitlab的访问域名。形如:http://test.gitlab.com/笔者注:如果gitlab是使用https访问,则需将http替换成https,配置文件中的self_signed_cert要修改成true,否则 gitlab shell在通过api和gitlab进行通信的时候就会出现错误,导致项目push出错。因为后面配置web服务器的时候是使用ssl,所以这里要按照 ssl的方式配置。Tips:另外如果使用的域名是测试域名,不要忘记在系统的/etc/hosts做域名映射。安装一些需要的目录和文件$ ./bin/install5、安装数据库这里使用的是msyql,(cmake+mysql见备注)备注:cmake安装#tar zxvf cmake-3.0.0.tar.gz#cd cmake-3.0.0#./configure --prefix=/usr/local/cmake#make && make install设置环境变量#vi /etc/profile添加以下PATH=/usr/local/cmake/bin:$PATHwq!使配置生效:#source /etc/profilemysql安装groupadd mysql useradd -g mysql mysql -s /bin/falsemkdir -p /data/mysql chown -R mysql:mysql /data/mysqlmkdir -p /usr/local/mysql tar zxvf mysql-5.5.17.tar.gzcd mysql-5.5.17cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etcmake && make installcp -r /usr/local/mysql/support-files/my-large.cnf /etc/my.cnfsed -i ‘25a datadir = /data/mysql‘ /etc/my.cnfcd /usr/local/mysql/./scripts/mysql_install_db --user=mysqlcp -r /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqldsed -i "46s#basedir=#basedir=/usr/local/mysql#g" /etc/rc.d/init.d/mysqldsed -i "47s#datadir=#datadir=/data/mysql#g" /etc/rc.d/init.d/mysqldchmod 755 /etc/init.d/mysqldchkconfig mysqld onecho -e "export PATH=\$PATH:/usr/local/mysql/bin" >> /etc/profileln -s /usr/local/mysql/lib/mysql /usr/lib/mysqlln -s /usr/local/mysql/include/mysql /usr/include/mysqlservice mysqld start# chkconfig mysqld on# service mysqld start
设置mysql root账号的密码:# mysqladmin -u root password ‘123456‘创建新用户和数据库给gitlab使用# 登录数据库# mysql -u root -p# 输入root密码# 为gitlab创建使用用户CREATE USER ‘gitlab‘@‘localhost‘ IDENTIFIED BY ‘123456‘;

# 创建gitlaba使用的数据库CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;

# 给予gitlab用户权限GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO ‘gitlab‘@‘localhost‘;

# 登出数据库\q6、安装GitLab将GitLab安装在git的家目录下:#su - gita、克隆GitLab并切换分支到6-3-stable# 克隆GitLab$ git clone https://github.com/gitlabhq/gitlabhq.git gitlab# 进入gitlab目录$ cd /home/git/gitlab# 切换到6-3-stable分支$ git checkout 6-3-stableb、配置项目复制配置文件$ cp config/gitlab.yml.example config/gitlab.yml修改配置文件中$ sed -i ‘s|localhost|192.169.1.171|g‘ config/gitlab.yml备注:192.168.1.171是我要安装的机器设定log和tmp目录所有者和权限$ chown -R git log/$ chown -R git tmp/$ chmod -R u+rwX log/$ chmod -R u+rwX tmp/创建gitlab-satellites目录$ mkdir /home/git/gitlab-satellites创建tmp/pids/和tmp/sockets/目录,确保gitlab有相应的权限$ mkdir tmp/pids/$ mkdir tmp/sockets/$ chmod -R u+rwX tmp/pids/$ chmod -R u+rwX tmp/sockets/创建public/uploads目录$ mkdir public/uploads$ chmod -R u+rwX public/uploads复制unicorn配置$ cp config/unicorn.rb.example config/unicorn.rb编辑resque.yml配置$ vim config/resque.ymldevelopment: redis://192.168.1.171:6379test: redis://192.168.1.171:6379production: redis://192.168.1.171:6379配置git的用户和邮件$ git config --global user.name "GitLab"$ git config --global user.email "[email protected]"(以你真实的域名填写)$ git config --global core.autocrlf inputc、配置数据库访问文件$ cp config/database.yml.mysql config/database.yml编辑config/database.yml,设置其中连接数据库的账号密码,笔者的配置部分如下:# PRODUCTION#production:  adapter: mysql2  encoding: utf8  reconnect: false  database: gitlabhq_production  pool: 10  username: gitlab  password: "123456"  # host: localhost  # socket: /tmp/mysql.sock修改其中username和password就可以了,其中密码就是上面数据库步骤中创建gitlab用户的密码。确保该文件只有git账号有权限读取。$ chmod o-rwx config/database.ymld、安装Gems$ su -# gem install charlock_holmes --version ‘0.6.9.4‘# exit安装mysql包$ su - git$ cd /home/git/gitlab/$ bundle install --deployment --without development test postgres puma aws备注:[转]Could not find modernizr-2.6.2 in any of the sources 解决办法:[[email protected] gitlab]$ vi Gemfilesource "https://rubygems.org"改为source "http://rubygems.org"[[email protected] gitlab]$ bundle install --deployment--without development test postgresFetching source indexfrom http://rubygems.org/Fetchinghttps://github.com/gitlabhq/grit.gitCould not findmodernizr-2.6.2 in any of the sources#出现错误:Could not find modernizr-2.6.2 in any of thesources#解决办法:[[email protected] gitlab]$ vi Gemfile第114行   gem"modernizr",       "2.6.2"更改改为:第114行   gem "modernizr-rails",  "2.7.1"[[email protected] gitlab]$ vi Gemfile.lock第252行     modernizr (2.6.2)更改改为:第252行     modernizr-rails (2.7.1)第523行   modernizr (= 2.6.2)更改改为:第523行   modernizr-rails (= 2.7.1)#重新执行:[[email protected] gitlab]$ bundleinstall --deployment --without development test postgres puma awse、初始化数据和激活高级功能$ cd /home/git/gitlab$ bundle exec rake gitlab:setup RAILS_ENV=production这步完成后,会生一个默认的管理员账号:[email protected]5iveL!fef、安装启动脚本# cd /home/git/gitlab    # cp lib/support/init.d/gitlab /etc/init.d/    # chmod +x /etc/init.d/gitlab 设置logarate# cd /home/git/gitlab# cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab# chkconfig --add gitlab开机时启动# chkconfig gitlab ong、检测应用程序状态$ su - git$ cd gitlab/$ bundle exec rake gitlab:env:info RAILS_ENV=production$ exit可以查看到系统、Ruby、GitLab和GitLabShell的版本和其他信息。启动GitLab实例$ service gitlab starth、查看应用更加详细的信息$ su - git$ cd gitlab/$ bundle exec rake gitlab:check RAILS_ENV=production7、安装web服务器选择的是nginx,$ su -# yum -y install nginx# chkconfig nginx on# mkdir /etc/nginx/sites-available# mkdir /etc/nginx/sites-enabled#cd /home/git/gitlab# cp lib/support/nginx/gitlab /etc/nginx/sites-available/# ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab       修改域名vim /etc/nginx/sites-enabled/gitlabserver_name 192.168.1.171;修改nginx配置文件其中    # Load configfiles from the /etc/nginx/conf.d directory    # The defaultserver is in conf.d/default.conf#    include/etc/nginx/conf.d/*.conf;         include /etc/nginx/sites-enabled/*;}重启服务/etc/init.d/nginx restart8 测试访问:http://192.168.1.171/
时间: 2024-07-28 21:22:23

centos 6.5安装GitLab安装的相关文章

CentOS服务器上搭建Gitlab安装步骤、中文汉化详细步骤、日常管理以及异常故障排查

一, 服务器快速搭建gitlab方法 可以参考gitlab中文社区 的教程 centos7安装gitlab:https://www.gitlab.cc/downloads/#centos7 centos6安装gitlab:https://www.gitlab.cc/downloads/#centos6 如下方法按照官网来操作,手工安装过于麻烦.当前测试平台为小鸟云的三个月centos 7测试机. 1. 安装配置依赖项 如想使用Postfix来发送邮件,在安装期间请选择'Internet Site

GitLab安装说明

http://blog.csdn.net/huangzhijie3918/article/details/51330425 GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用. gitlab是基于Ruby on Rails的,安装和配置非常麻烦,不过有傻瓜安装包,https://about.gitlab.com/downloads/,或者,https://bitnami.com/stack/gitl

安装Gitlab 10.5.2社区版

1.准备操作系统CentOS 7 2.安装gitlab #安装 yum install curl policycoreutils openssh-server openssh-clients postfix curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash EXTERNAL_URL="http://gitlab.domain.com" yum install gitlab-ce

CentOs7安装gitlab(转!)

转自:https://www.cnblogs.com/chenfool/p/7689438.html 环境说明:虚拟机 centos 7 64位内存:4GB存储:100GBCPU: CORE 版本:gitlab 10.0.3 配置系统基础环境 配置阿里巴巴 yum 源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 重建yum 的缓存 yum clean all yum

linux下安装gitlab

gitlab安装: 可以根据自己操作系统类型,根据以下链接进行对应的操作,https://about.gitlab.com/install/(gitlab不同服务器安装步骤) 以Centos为例,安装如下: 在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问. 1.安装ssh sudo yum install -y curl policycoreutils-pythonopenssh-serv

Gitlab安装、汉化及使用

环境:centos 关闭防火墙和selinux [root@Gitlab ~]# setenforce 0 [root@Gitlab ~]# service iptables stop && chkconfig iptables off 安装Gitlab 安装方式分两种: RPM安装.YUM安装 <不演示YUM安装> rpm安装: [root@Gitlab ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/e

Centos7下安装Gitlab

安装依赖 yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python systemctl start postfix systemctl status postfix.service Yum安装 使用这种方式安装的gitlab永远都是最新版的,也会比较慢 curl https://packages.gitlab.com/install/repositories/gitlab/gi

CentOS源码安装GitLab汉化版

示例环境: 软件 版本 CentOS 6.5 x86_64 Git 2.6.2 Ruby 2.2.3 Node.js 4.2.1 Redis 3.0.5 MariaDB 10.0.21 GitLab 8.0.5汉化版 GitLab Shell 2.6.6 Nginx 1.8.0 Go 1.5.1 Gitlab-git-http-server 0.2.14 一.修改Yum源为阿里云提高下载速度 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.

centos 7 安装gitlab

#配置安装EPEL及依赖环境 #更新包     yum update      yum -y install wget yum -y --nogpgcheck install http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm#添加epel源      http://www.cnblogs.com/Irving/p/3729074.html    #安装所需依赖包     yum -y