码迷,mamicode.com
首页 > 其他好文 > 详细

安装部署gitlab ci

时间:2015-09-09 19:40:56      阅读:369      评论:0      收藏:0      [点我收藏+]

标签:安装部署gitlab ci

一.环境

系统    CentOS 6.4x64

二.安装依赖包

#添加epel源
[root@gitlab-ci ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@gitlab-ci ~]# sed -i ‘s@#b@b@g‘ /etc/yum.repos.d/epel.repo 
[root@gitlab-ci ~]# sed  -i ‘s@mirrorlist@#mirrorlist@g‘ /etc/yum.repos.d/epel.repo

#配置时间同步
[root@gitlab-ci ~]# echo "*/10 * * * * /usr/sbin/ntpdate asia.pool.ntp.org  &>/dev/null" >/var/spool/cron/root
[root@gitlab-ci ~]# yum groupinstall "Development Tools" -y
[root@gitlab-ci ~]# yum update && yum upgrade
[root@gitlab-ci ~]# yum install vim python wget curl git openssh-server -y
[root@gitlab-ci ~]# yum install sqlite sqlite-devel mysql mysql-libs mysql-devel -y
[root@gitlab-ci ~]# yum install ncurses-devel libcurl-devel libcurl patch -y
[root@gitlab-ci ~]# yum install libxslt-devel libyaml-devel libxml2 libxml2-devel gdbm-devel libffi libffi-devel zlib zlib-devel openssl-devel readline readline-devel curl-devel openssl-devel pcre-devel memcached-devel valgrind-devel ImageMagick-devel ImageMagick libicu libicu-devel make bzip2 autoconf automake libtool bison redis libpq-devel libicu-devel postgresql-libs postgresql-devel -y
[root@gitlab-ci ~]# chkconfig redis on
[root@gitlab-ci ~]# chkconfig postfix on
[root@gitlab-ci ~]# service redis start
Starting redis-server:                                     [  OK  ]

三.安装配置mysql

这里使用脚本安装mysql,版本为事先下载好的mysql-5.5.37

脚本内容如下

[root@gitlab-ci ~]# cat install_mysql.sh 
#!/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/1693196

安装部署gitlab ci

标签:安装部署gitlab ci

原文地址:http://ly36843.blog.51cto.com/3120113/1693196

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!