导航菜单

关于CentOS系统安装GitLab的步骤

GitLab是用于仓库管理系统的开源项目,一般安装于Ubuntu和Debian系统,当然也可以安装于CentOS系统,今天给大家介绍的就是GitLab在CentOS系统下的安装,以及GitLab安装前的配置。
 
关于CentOS系统安装GitLab的步骤
 
  前置要求
 
  一定要先关闭iptable与selinux
 
  本文安装的系统为centos 6.2 64位系统,安装在dell r410机器
 
  1、安装epel与基础依赖库及软件
 
  cd /tmp
 
  wget http://download.Fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
 
  1rpm -Uvh epel-release-6-8.noarch.rpm
 
  2yum install -y readline-devel libyaml-devel gdbm-devel ncurses-devel redis openssl-devel
 
  3zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel
 
  4tk-devel libxml2-devel libffi-devel libxslt-devel libicu-devel httpd httpd-devel gitolite git-all python-devel python-pip sqlite-devel sendmail vim mysql-devel mysql-server patch libyaml* pcre-devel
 
  2、安装ruby(一般默认安装都是1.8的,官方要求1.9以上)
 
  mkdir /tmp/ruby && cd /tmp/ruby
 
  curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz
 
  cd ruby-1.9.3-p392/
 
  。/configure
 
  make
 
  make install
 
  gem install bundler
 
  ln -s /usr/local/bin/ruby /usr/bin/ruby
 
  ln -s /usr/local/bin/gem /usr/bin/gem
 
  ln -s /usr/local/bin/bundle /usr/bin/bundle
 
  3、创建一个git用户供GitLab使用
 
  adduser --comment ‘GitLab’ git
 
  chmod –R 755 /home/git
 
  4、安装gitlab 的shell
 
  # Login as git
 
  sudo su git
 
  # Go to home directory
 
  cd /home/git
 
  # Clone gitlab shell
 
  git clone https://github.com/gitlabhq/gitlab-shell.git
 
  cd gitlab-shell
 
  # switch to right version
 
  git checkout v1.3.0
 
  cp config.yml.example config.yml
 
  # Edit config and replace gitlab_url
 
  # with something like ‘http://domain.com/’
 
  vim config.yml
 
  # Do setup
 
  。/bin/install
 
  5、建立gitlab数据库并授权
 
  # Login to MySQL
 
  mysql -u root -p
 
  # Create a user for GitLab. (change $password to a real password)
 
  mysql》 CREATE USER ‘gitlab’@‘localhost’ IDENTIFIED BY ‘gitlab’;
 
  # Create the GitLab production database
 
  mysql》 CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
 
  # Grant the GitLab user necessary permissopns on the table.
 
  mysql》 GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO ‘gitlab’@‘localhost’;
 
  # Quit the database session
 
  mysql》 q
 
  6、克隆gitlab源
 
  # Clone GitLab repository
 
  cd /home/git
 
  sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
 
  # Go to gitlab dir
 
  cd /home/git/gitlab
 
  # Checkout to stable release
 
  sudo -u git -H git checkout 5-1-stable
 
  Configure it
 
  cd /home/git/gitlab
 
  # Copy the example GitLab config
 
  sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
 
  # Make sure to change “localhost” to the fully-qualified domain name of your
 
  # host serving GitLab where necessary
 
  sudo -u git -H vim config/gitlab.yml
 
  # Make sure GitLab can write to the log/ and tmp/ directories
 
  sudo chown -R git log/
 
  sudo chown -R git tmp/
 
  sudo chmod -R u+rwX log/
 
  sudo chmod -R u+rwX tmp/
 
  # Create directory for satellites
 
  sudo -u git -H mkdir /home/git/gitlab-satellites
 
  # Create directories for sockets/pids and make sure GitLab can write to them
 
  sudo -u git -H mkdir tmp/pids/
 
  sudo -u git -H mkdir tmp/sockets/
 
  sudo chmod -R u+rwX tmp/pids/
 
  sudo chmod -R u+rwX tmp/sockets/
 
  # Create public/uploads directory otherwise backup will fail
 
  sudo -u git -H mkdir public/uploads
 
  sudo chmod -R u+rwX public/uploads
 
  # Copy the example Puma config
 
  sudo -u git -H cp config/puma.rb.example config/puma.rb
 
  # Configure Git global settings for git user, useful when editing via web
 
  # Edit user.email according to what is set in gitlab.yml
 
  sudo -u git -H git config --global user.name “GitLab”
 
  sudo -u git -H git config --global user.email “gitlab@localhost”
 
  以上就是CentOS安装配置GitLab的方法介绍了,在安装GitLab前需要配置GitLab环境,需安装安装epel与基础依赖库及软件,再配置GitLab数据库。
赞一个 ( ) 打赏本站

如果本文对你有所帮助请打赏本站

  • 打赏方法如下:
  • 支付宝打赏
    支付宝扫描打赏
    微信打赏
    微信扫描打赏

微信扫描、关注最新系统!

纯净版系统二维码