getlab 5.2 on RHEL/Centos 6.4 with SCL / Software Collection outdated
来源:互联网 发布:李凌 知象 编辑:程序博客网 时间:2024/06/15 15:14
Redhat release software collection January this year. It’s kind of cool as it lets you install newer versions of ruby perl python etc. Gitlab requires version ruby193 which is very easy to install with scl. This install guide is based on the original gitlab install guide which can be found here “https://github.com/gitlabhq/gitlab-recipes” and shows you howto make gitlab work with SCL instead of RVM.
红帽今年一月份发布了SCL,它能安装更新版本的ruby,perl和python等等。gitlab,foreman需要的ruby193版本能够轻易的用scl安装.
Step 1. Add the SCL repo to your Rhel/Centos installation
第一步:在Rhel/Centos上添加SCL的软件仓库。
http://people.redhat.com/bkabrda/scl_ruby193.repo
[scl_ruby193]
name=Ruby 1.9.3 Dynamic Software Collection
baseurl=http://people.redhat.com/bkabrda/ruby193-rhel-6/
failovermethod=priority
enabled=1
gpgcheck=0
Make sure you are also subscribed to the rhel6-server optional channel. Then install the Development tools
然后安装Development tools
# yum -y groupinstall 'Development Tools'
### 'Additional Development'
# yum -y install vim-enhanced httpd 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 mysql-server wget \
mysql-devel crontabs logwatch logrotate sendmail-cf qtwebkit qtwebkit-devel \
perl-Time-HiRes libicu-devel libxml2-devel libxslt-devel mysql-devel
Step 2. As rhel still ships with git version 1.7.1-3.el6_4.1 we also need to add the rpm forge package
第二步:因为红帽还附带git version 1.7.1-3.el6_4.1,所以我们需要添加rpmforge软件仓库。
# yum localinstall -y http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Enable the rpmforge extras
Step 3. Gitlab also needs redis which is available on epel.
第三步:gitlab也需要redis数据库,在epel上有可用的源。
# yum localinstall -y http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step 4. Lets install ruby193 and git httpd mysql-server and start all the servies
第四步:安装ruby193 and git httpd mysql-server然后开启服务。
# yum install -y ruby193 ruby193-ruby-devel git redis httpd mysql-server
# service mysqld start
# service redis start
# service httpd start
# chkconfig mysqld on
# chkconfig redis on
# chkconfig httpd on
Step 5. Add the user git and set the git globals
第五步:添加git用户,并设置全局变量。
# adduser -r -s /bin/bash -c 'Gitlab user' -m -d /home/git git
# su - git
[git@gitlab ~]$ git config --global user.name "GitLab"
[git@gitlab ~]$ git config --global user.email "gitlab@localhost"
Step 6. su to the git user to clone the git repos
第六步:切换到git帐户,下载git仓库。
# su - git
[git@gitlab ~]$ git clone https://github.com/gitlabhq/gitlab-shell.git
[git@gitlab ~]$ git clone https://github.com/gitlabhq/gitlabhq.git gitlab
Step 7. Extend your .bashrc to have the following content which will load our scl environment for us when we login
第七步:在 .bashrc 添加如下内容,以确保我们登陆的时候scl环境加载好了。
# .bashrc
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
LD_LIBRARY_PATH=/opt/rh/ruby193/root/usr/lib64:
PATH=/opt/rh/ruby193/root/usr/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/git/bin
export PATH
export LD_LIBRARY_PATH
Step 8. Make sure the paths are right. You can test this by executing env.
第八步:确保路径是对的。你可以执行env测试一下。
Step 9. Logout and login again as user gitlab. If everything went fine you should be able to do this
第九步:
[git@gitlab ~]$ which ruby
/opt/rh/ruby193/root/usr/bin/ruby
[git@gitlab ~]$ ruby --version
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
Step 10. As git cd into the git-shell dir and checkout version 1.4
[git@gitlab ~]$ cd gitlab-shell/
[git@gitlab gitlab-shell]$ git checkout v1.4.0
Note: checking out 'v1.4.0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 8343298... Fix tests and version up to 1.4.0
[git@gitlab gitlab-shell]$
Step 11. Copy the file config.yml.example to config.yml and and replace the hostname localhost with your hostname
[git@gitlab gitlab-shell]$ sed -i 's/localhost/gitlab.local.domb.com/g' config.yml
Step 12. Install gitshell
git@gitlab gitlab-shell]$ ./bin/install
mkdir -p /home/git/repositories: true
mkdir -p /home/git/.ssh: true
chmod 700 /home/git/.ssh: true
touch /home/git/.ssh/authorized_keys: true
chmod 600 /home/git/.ssh/authorized_keys: true
chmod -R ug+rwX,o-rwx /home/git/repositories: true
find /home/git/repositories -type d -print0 | xargs -0 chmod g+s: true
Step 13. IMPORTANT. Do this still as the git user! checkout gitlab 5.2
[git@gitlab ~]$ cd gitlab
[git@gitlab gitlab]$ ls
app CONTRIBUTING.md Gemfile.lock MAINTENANCE.md script
Capfile.example db Guardfile Procfile spec
CHANGELOG doc lib public tmp
config features LICENSE Rakefile vendor
config.ru Gemfile log README.md VERSION
[git@gitlab gitlab]$ git checkout 5-2-stable
Branch 5-2-stable set up to track remote branch 5-2-stable from origin.
Switched to a new branch '5-2-stable'
Step 14. Lets configure Gitlab and install the gems
[git@gitlab gitlab]$ gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5.
[git@gitlab gitlab]$ gem install charlock_holmes --version '0.6.9.4'
Building native extensions. This could take a while...
....
......................
.
Successfully installed charlock_holmes-0.6.9.4
1 gem installed
Installing ri documentation for charlock_holmes-0.6.9.4...
Installing RDoc documentation for charlock_holmes-0.6.9.4...
Step 15. Configure Gitlab
Copy the example GitLab config and edit the necessary fields.
[git@gitlab gitlab]$ cp /home/git/gitlab/config/gitlab.yml{.example,}
[git@gitlab gitlab]$ sed -i 's/localhost/gitlab.local.domb.com/g' /home/git/gitlab/config/gitlab.yml
[git@gitlab gitlab]$ chown -R git /home/git/gitlab/log/
[git@gitlab gitlab]$ chown -R git /home/git/gitlab/tmp/
[git@gitlab gitlab]$ chmod -R u+rwX /home/git/gitlab/log/
[git@gitlab gitlab]$ chmod -R u+rwX /home/git/gitlab/tmp/
[git@gitlab gitlab]$ mkdir /home/git/gitlab-satellites
[git@gitlab gitlab]$ mkdir /home/git/gitlab/tmp/pids/
[git@gitlab gitlab]$ mkdir /home/git/gitlab/tmp/sockets/
[git@gitlab gitlab]$ chmod -R u+rwX /home/git/gitlab/tmp/pids/
[git@gitlab gitlab]$ chmod -R u+rwX /home/git/gitlab/tmp/sockets/
[git@gitlab gitlab]$ mkdir /home/git/gitlab/public/uploads
[git@gitlab gitlab]$ chmod -R u+rwX /home/git/gitlab/public/uploads
Step 16. Copy the puma.rb config and configure it. Change the bind parameter so that it reads: bind ‘tcp://127.0.0.1:9292′
Step 17. Confugre Mysql and change the user and password in the database.yml file
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: gitlab
password: "iloveopensource"
# host: localhost
# socket: /tmp/mysql.sock
Step 18. Create a Mysql User
[git@gitlab gitlab]$ mysql -u root
# Create a user for GitLab. (change supersecret to a real password)
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'iloveopensource';
# Create the GitLab production database
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# Grant the GitLab user necessary permissions on the table.
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Step 19. Check if you can login as the gitlab user
[git@gitlab gitlab]$ mysql -u gitlab -p -D gitlabhq_production
Step 20. Secure MySQL by entering a root password and say “Yes” to all questions with the next command
# /usr/bin/mysql_secure_installation
Step 21. Add this as your apache config in /etc/httpd/conf.d/gitlab.conf
ServerName gitlab.local.domb.com
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPreserveHost On
ProxyPass / http://localhost:9292/
ProxyPassReverse / http://localhost:9292/
Step 22. From the gitlab dir execute
[git@gitlab gitlab]$ bundle install --deployment --without development test postgres
[git@gitlab gitlab]$ bundle exec rake gitlab:setup RAILS_ENV=production
Step 23. If everything went fine you see:
Administrator account created:
login.........admin@local.host
password......5iveL!fe
Step 24. Get the init script. As we use SCL instead of RVM we need to change some path variables
# cd /etc/init.d/
# wget https://raw.github.com/ldomb/gitlab-recipes/master/gitlab
# chmod 755 gitlab
# chkconfig gitlab on
Step 25. If you want you can now configure the mail part. Open /etc/mail/sendmail.mc and add or modify the following lines
Add:
define(`SMART_HOST', `smtp.example.com')dnl
Comment
dnl EXPOSED_USER(`root')dnl
Step 26. Restart sendmail
Step 27. forward all email to a centrail mail address
# echo adminlogs@example.com > /root/.forward
# chown root /root/.forward
# chmod 600 /root/.forward
# echo adminlogs@example.com > /home/git/.forward
# chown git /home/git/.forward
# chmod 600 /home/git/.forward
Step 28. Your done. Start up your server
# service gitlab start
- getlab 5.2 on RHEL/Centos 6.4 with SCL / Software Collection outdated
- Install Chromium (with Pepper Flash) on CentOS/Red Hat (RHEL) 6.4
- IPMI on CentOS/RHEL
- Setting Up OpenERP (Odoo) 9 with Nginx on RHEL/CentOS and Debian/Ubuntu
- Compile FFmpeg on CentOS / RHEL / Fedora
- rabbitvcs Installation on RHEL/CentOS 5
- Install xrdp on CentOS 7 / RHEL 7
- Enable Serial Console on CentOS/RHEL 7
- Installing Docker on CentOS 7 / RHEL 7
- Install Cockpit on Fedora/CentOS/RHEL
- How to Install gcc 4.7.x/4.8.x on CentOS(scl devtools)
- centos编译 Compiling FFmpeg on CentOS RHEL Fedora
- Install Apache, MySQL 5.5.32 & PHP 5.5.0 on RHEL/CentOS 6.4/5.9 & Fedora 19-12
- Setup FTP Server On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3
- RHEL(CENTOS)6.3/6.4/6.5 guest on VMware prints "UNSUPPORTED HARDWARE DEVICE: CPU"
- Oracle ASM on RHEL 6 with udev and multipath
- Migrate Xen to KVM on RHEL/CentOS 6
- Installing the EPEL Repository on CentOS or RHEL
- hdu 1710 Binary Tree Traversals(由先序和中序建树)
- nginx
- [ACM] POJ 2506 Tiling (递推,大数)
- 剑指offer 栈 c语言实现
- jsp The method getServletContext() is undefined for the type in eclipse解决方法
- getlab 5.2 on RHEL/Centos 6.4 with SCL / Software Collection outdated
- 网站分析基础概念网页浏览数
- HDU 4034 Graph(Floyd变形)
- UIView的剖析!
- 面试算法(十四)链表中倒数第k个结点
- 【读书笔记】【收获,不止Oracle】位图索引(1)
- 让你提前认识软件开发(36):如何扩展数据表字段?
- Cocos2d-x开发实例介绍特效演示
- NFC三种工作模式及选择详谈