sgdfh 发表于 2015-9-10 08:46:18

安装部署gitlab ci

一.环境
系统    CentOS 6.4x64
二.安装依赖包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#添加epel源
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# sed -i 's@#b@b@g' /etc/yum.repos.d/epel.repo
# sed-i 's@mirrorlist@#mirrorlist@g' /etc/yum.repos.d/epel.repo

#配置时间同步
# echo "*/10 * * * * /usr/sbin/ntpdate asia.pool.ntp.org&>/dev/null" >/var/spool/cron/root
# yum groupinstall "Development Tools" -y
# yum update && yum upgrade
# yum install vim python wget curl git openssh-server -y
# yum install sqlite sqlite-devel mysql mysql-libs mysql-devel -y
# yum install ncurses-devel libcurl-devel libcurl patch -y
# 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
# chkconfig redis on
# chkconfig postfix on
# service redis start
Starting redis-server:                                    




三.安装配置mysql
这里使用脚本安装mysql,版本为事先下载好的mysql-5.5.37
脚本内容如下


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# 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



页: [1]
查看完整版本: 安装部署gitlab ci