十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要讲解了“centos6如何搭建gitlab”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos6如何搭建gitlab”吧!
公司主营业务:成都网站建设、网站制作、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。成都创新互联是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。成都创新互联推出丰顺免费做网站回馈大家。
基本环境安装(git\redis\ruby\MySQL...)
yum -y groupinstall 'development tools' yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis sudo wget crontabs logwatch logrotate perl-time-hires git cmake libcom_err-devel.i686 libcom_err-devel.x86_64 nodejs yum -y install python-docutils yum -y install postfix git --version #安装高于2.7.4的git版本 yum -y remove git yum install zlib-devel perl-cpan gettext curl-devel expat-devel gettext-devel openssl-devel mkdir /tmp/git && cd /tmp/git curl --progress https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz | tar xz cd git-2.9.0 ./configure make make prefix=/usr/local install yum remove ruby #安装高于2.1版本的ruby,删除老的 mkdir /tmp/ruby && cd /tmp/ruby curl --progress https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.9.tar.gz | tar xz cd ruby-2.1.9 ./configure --disable-install-rdoc make make prefix=/usr/local install gem install bundler --no-doc yum install redis mysql /data/apps/mysql/bin/mysqld_safe & /data/apps/mysql/bin/mysql -uroot mysql> create database if not exists `gitlabhq_production` default character set `utf8` collate `utf8_unicode_ci`; mysql> grant all on gitlabhq_production.* to 'git'@'localhost' identified by 'git';
配置redis
vim /etc/redis.conf
unixsocket /var/run/redis/redis.sock unixsocketperm 0770
mkdir -p /var/run/redis chown redis:redis /var/run/redis chmod 755 /var/run/redis /etc/init.d/redis start usermod -ag redis git
配置gitlab相关
# 下载git,用的国内源。国外的太慢了 cd /home/git sudo -u git -h git clone http://git.oschina.net/qiai365/gitlab-ce gitlab cd /home/git/gitlab sudo -u git -h cp config/gitlab.yml.example config/gitlab.yml sudo -u git -h editor config/gitlab.yml # 修改成自己的host host: iaasgit1.prod.bj1 sudo -u git -h cp config/secrets.yml.example config/secrets.yml sudo -u git -h chmod 0600 config/secrets.yml sudo chown -r git log/ sudo chown -r git tmp/ sudo chmod -r u+rwx,go-w log/ sudo chmod -r u+rwx tmp/ sudo chmod -r u+rwx tmp/pids/ sudo chmod -r u+rwx tmp/sockets/ sudo -u git -h mkdir public/uploads/ sudo chmod 0700 public/uploads sudo chmod ug+rwx,o-rwx /home/git/repositories/ sudo chmod -r u+rwx builds/ sudo chmod -r u+rwx shared/artifacts/ sudo -u git -h cp config/unicorn.rb.example config/unicorn.rb nproc sudo -u git -h editor config/unicorn.rb sudo -u git -h cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb sudo -u git -h git config --global core.autocrlf input sudo -u git -h git config --global gc.auto 0 sudo -u git -h cp config/resque.yml.example config/resque.yml sudo -u git -h editor config/resque.yml
配置db部分 only for mysql
sudo -u git cp config/database.yml.mysql config/database.yml sudo -u git -h editor config/database.yml #配置production部分的password: "密码" sudo -u git -h chmod o-rwx config/database.yml
安装gitlab相关,并启动
# install gems cd /home/git/gitlab sudo -u git -h bundle install --deployment --without development test postgres aws kerberos # install gitlab shell sudo -u git -h bundle exec rake gitlab:shell:install[v3.3.3] redis_url=unix:/var/run/redis/redis.sock rails_env=production sudo -u git -h editor /home/git/gitlab-shell/config.yml # install gitlab-workhorse cd /home/git sudo -u git -h git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git cd gitlab-workhorse sudo -u git -h git checkout v0.7.5 sudo -u git -h make # initialize database and activate advanced features cd /home/git/gitlab sudo -u git -h bundle exec rake gitlab:setup rails_env=production sudo -u git -h bundle exec rake gitlab:setup rails_env=production gitlab_root_password=yourpassword gitlab_root_email=youremail cp lib/support/init.d/gitlab /etc/init.d/gitlab cp lib/support/init.d/gitlab.default.example /etc/default/gitlab chkconfig gitlab on cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab sudo -u git -h bundle exec rake gitlab:env:info rails_env=production sudo -u git -h bundle exec rake assets:precompile rails_env=production service gitlab start
配置nginx
yum install nginx cp lib/support/nginx/gitlab /data/apps/nginx/conf/include/gitlab.conf usermod -a -g git nginx chmod g+rx /home/git/ /data/apps/nginx/conf/include/gitlab.conf #把这个配置里的server_name配置好
最后check一下
cd /home/git/gitlab sudo -u git -h bundle exec rake gitlab:check rails_env=production # 启动gitlab /etc/init.d/gitlab restart # 直接打开server_name对应的url,发现样式都没了,执行 sudo -u git -h bundle exec rake assets:clean assets:precompile redis_url=unix:/var/run/redis/redis.sock rails_env=production
感谢各位的阅读,以上就是“centos6如何搭建gitlab”的内容了,经过本文的学习后,相信大家对centos6如何搭建gitlab这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!