gitlab是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用。
一、环境
系统:CentOS 6.4x64最小化安装
IP:192.168.3.71
二、安装yum源
安装epel源
[root@gitlab ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm warning: /var/tmp/rpm-tmp.yZsZfC: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY Preparing... ########################################### [100%] 1:epel-release ########################################### [100%] #编辑/etc/yum.repos.d/epel.repo文件 [root@gitlab ~]# vim /etc/yum.repos.d/epel.repo #将mirroelist注释,开启baseurl [epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - $basearch - Debug baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 6 - $basearch - Source baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1
安装阿里云开源镜像
[root@gitlab ~]# wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
三、安装基础依赖包
[root@gitlab ~]# yum -y update [root@gitlab ~]# yum -y groupinstall ‘Development Tools‘ [root@gitlab ~]# 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
四、安装git
查看默认安装的git版本
[root@gitlab ~]# git --version git version 1.7.1
先删除然后下载源码进行安装,下载地址https://www.kernel.org/pub/software/scm/git/,这里我们选择git-2.3.5版本的
[root@gitlab ~]# yum remove git -y [root@gitlab ~]# wget [root@gitlab ~]# tar xf git-2.3.5.tar.gz [root@gitlab ~]# cd git-2.3.5 [root@gitlab git-2.3.5]# ./configure [root@gitlab git-2.3.5]# make && make prefix=/usr/local install #安装过程中出现如下错误 Can‘t locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3. BEGIN failed--compilation aborted at Makefile.PL line 3. make[1]: *** [perl.mak] Error 2 make: *** [perl/perl.mak] Error 2 #解决如下 [root@gitlab git-2.3.5]# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker -y #重新make [root@gitlab git-2.3.5]# make && make prefix=/usr/local install [root@gitlab git-2.3.5]# ln -s /usr/local/bin/git /usr/bin/git
安装完成后验证结果
[root@gitlab git-2.3.5]# which git /usr/local/bin/git [root@gitlab git-2.3.5]# git --version git version 2.3.5
五、安装ruby环境
下载软件安装包,并安装
[root@gitlab ~]# wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.1.5.tar.gz [root@gitlab ~]# tar xf ruby-2.1.5.tar.gz [root@gitlab ~]# cd ruby-2.1.5 [root@gitlab ruby-2.1.5]# ./configure --disable-install-rdoc [root@gitlab ruby-2.1.5]# make && make prefix=/usr/local install
安装bundler
#设置ruby gem源为淘宝 [root@gitlab ruby-2.1.5]# gem source -r https://rubygems.org/ https://rubygems.org/ removed from sources [root@gitlab ruby-2.1.5]# gem source -a http://ruby.taobao.org/ http://ruby.taobao.org/ added to sources #安装bundler [root@gitlab ruby-2.1.5]# gem install bundler --no-doc Fetching: bundler-1.9.6.gem (100%) Successfully installed bundler-1.9.6 1 gem installed
验证安装后的结果
[root@gitlab ruby-2.1.5]# which ruby /usr/local/bin/ruby [root@gitlab ruby-2.1.5]# ruby --version ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
六、创建系统用户
[root@gitlab ~]# useradd --comment ‘Gitlab‘ git [root@gitlab ~]# echo "git ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
七、安装mysql-5.5-37
这里使用源码进行安装,使用的是安装脚本。脚本内容如下
#!/bin/bash DATADIR=‘/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: " PASSWD if [ ! -d $DATADIR ];then mkdir -p $DATADIR fi yum install cmake make gcc-c++ bison-devel ncurses-devel -y id mysql &>/dev/null if [ $? -ne 0 ];then useradd mysql -s /sbin/nologin -M fi #useradd mysql -s /sbin/nologin -M #change datadir owner to mysql chown -R mysql.mysql $DATADIR cd #wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.38.tar.gz tar xf $VERSION.tar.gz cd $VERSION cmake . -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=1 make && make install if [ $? -ne 0 ];then action "install mysql is failed!" /bin/false exit $? fi sleep 2 #link ln -s /usr/local/$VERSION/ /usr/local/mysql ln -s /usr/local/mysql/bin/* /usr/bin/ #copy config and start file /bin/cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chmod 700 /etc/init.d/mysqld #init mysql /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=$DATADIR --user=mysql if [ $? -ne 0 ];then action "install mysql is failed!" /bin/false exit $? fi #check mysql /etc/init.d/mysqld start if [ $? -ne 0 ];then action "mysql start is failed!" /bin/false exit $? fi chkconfig --add mysqld chkconfig 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>&1 if [ $? -eq 0 ];then echo "+---------------------------+" echo "+------mysql安装完成--------+" echo "+---------------------------+" fi #/etc/init.d/mysqld stop } install_mysql
本文出自 “ly36843运维” 博客,请务必保留此出处http://ly36843.blog.51cto.com/3120113/1649578
原文地址:http://ly36843.blog.51cto.com/3120113/1649578