如果你嫌弃下面的方法麻烦,那么久使用docker版本的gitlab吧
[[email protected] ~]# curl -Lk onekey.sh/docker-install|bash [[email protected] ~]# for i in benyoo-redis:3.2.3.tgz benyoo-mariadb:10.0.27.tgz benyoo-gitlab:8.8.5.tgz; do curl -Lk "https://mirrors.dwhd.org/gitlab_docker_tar/${i}"|gunzip -c|docker load;done [[email protected] ~]# curl -LkO https://github.com/xiaoyawl/docker-gitlab/raw/master/docker-compose.yml [[email protected] ~]# docker-compose up -d
不建议在centos6版本的系统上运行,因为centos6系统上安装的docker-compose不知version2格式的写法,那么运行docker-compose up -d的时候会提示出错的。
1、关闭SELinux
[[email protected] ~]# sed -i 's/^SELINUX=.*/#&/;s/^SELINUXTYPE=.*/#&/;/SELINUX=.*/a SELINUX=disabled' /etc/sysconfig/selinux [[email protected] ~]# setenforce 0 setenforce: SELinux is disabled [[email protected] ~]#
2、安装EPEL源
[[email protected] ~]# yum install epel-release -y [[email protected] ~]# rpm --import http://mirrors.dwhd.org/EPEL/RPM-GPG-KEY-EPEL-7
3、安装RPMforge源
[[email protected] ~]# yum install http://mirrors.dwhd.org/RepoForgeRPM/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm -y [[email protected] ~]# rpm --import http://mirrors.dwhd.org/RepoForge/RPM-GPG-KEY.dag.txt
4、安装bash-completion包(TAB补齐增强包)
[[email protected] ~]# yum -y install bash-completion
5、安装PUIAS源和导入对应key
[[email protected] ~]# wget -qO- https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/install/centos/PUIAS_6_computational.repo > /etc/yum.repos.d/PUIAS_6_computational.repo [[email protected] ~]# rpm --import http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias [[email protected] ~]#
6、检测KEY和更新源缓存
[[email protected] ~]# rpm -qa gpg*|grep 352c64e5 gpg-pubkey-352c64e5-52ae6884 [[email protected] ~]# rpm -qa gpg*|grep 41a40948 gpg-pubkey-41a40948-4ce19266 [[email protected] ~]# yum clean all && yum makecache
7、安装Development Tools开发组包和一下必要的包文件
[[email protected] ~]# yum -y groupinstall 'Development Tools' [[email protected] ~]# 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 sudo crontabs logwatch logrotate perl-Time-HiRes \ libcom_err-devel.i686 libcom_err-devel.x86_64 nodejs python-docutils postfix ntp
8、安装vim且设置为默认编辑器
[[email protected] ~]# yum -y install vim-enhanced [[email protected] ~]# update-alternatives --set editor /usr/bin/vim.basic [[email protected] ~]# ln -sv /usr/bin/vim /usr/bin/editor [[email protected] ~]#
9、设置时间同步
[[email protected] ~]# rm -rf /etc/localtime You are going to execute "/bin/rm -rf /etc/localtime",please confirm (yes or no):yes [[email protected] ~]# ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime "/etc/localtime" -> "/usr/share/zoneinfo/Asia/Shanghai" [[email protected] ~]# ntpdate pool.ntp.org 6 Apr 09:14:53 ntpdate[11275]: adjust time server 212.26.18.41 offset -0.105925 sec [[email protected] ~]# echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' >>/var/spool/cron/root [[email protected] ~]# date -R Wed, 06 Apr 2016 09:15:14 +0800 [[email protected] ~]#
10、编译高版本Git (Git version >= 2.7.3)
[[email protected] ~]# yum -y install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel [[email protected] ~]# yum -y remove git [[email protected] /tmp/git]# URL='https://www.kernel.org/pub/software/scm/git/' && wget -c `curl -s $URL|awk --posix -F'"' '$2~/git-([0-9]+.){3}tar.xz/{a=$2}END{print "'"$URL"'"a}'` [[email protected] /tmp/git]# tar xf git-*.tar.xz [[email protected] /tmp/git]# cd git-* [[email protected] /tmp/git/git-2.8.1]# ./configure --prefix=/usr/local [[email protected] /tmp/git/git-2.8.1]# make -j $(awk '/processor/{i++}END{print i}' /proc/cpuinfo) && make install && cd ../.. [[email protected] /tmp]# echo "PATH=/usr/local/bin:\$PATH" > /etc/profile.d/git.sh [[email protected] /tmp]# . /etc/profile.d/git.sh [[email protected] /tmp]# which git /usr/local/bin/git [[email protected] /tmp]# git version git version 2.8.1 [[email protected] /tmp]#
11、编译安装高版本ruby ( Ruby version >= 2.1.0)
[[email protected] /tmp]# yum -y remove ruby [[email protected] /tmp/ruby]# URL1='http://mirrors.dwhd.org/Ruby/ruby/' && URL2=`curl -s $URL1|awk -PF'"' '{if ($2~/^[0-9]+\.[0-9]+/)a=$2}END{print "'$URL1'"a}'` && wget -c `curl -s $URL2|awk -PF'"' '{if ($2~/^ruby.*xz$/)a=$2}END{print "'$URL2'"a}'` [[email protected] /tmp/ruby]# tar xf ruby-* [[email protected] /tmp/ruby]# cd ruby-* [[email protected] /tmp/ruby/ruby-2.3.0]# ./configure --prefix=/usr/local --disable-install-rdoc [[email protected] /tmp/ruby/ruby-2.3.0]# make -j $(awk '/processor/{i++}END{print i}' /proc/cpuinfo) && make install && cd ../.. [[email protected] /tmp]# ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] [[email protected] /tmp]#
12、安装bundler
[[email protected] /tmp]# gem install bundler --no-doc [[email protected] /tmp]# bundler -v Bundler version 1.11.2 [[email protected] /tmp]#
13、安装go (gitlab 8.0 以后的版本需要go语言的支持)
[[email protected] /tmp]# mkdir /tmp/go && cd /tmp/go [[email protected] /tmp/go]# URL='https://storage.googleapis.com/golang/' && wget -c `curl -s $URL|xmllint --format - |awk -PF'[><]' '{if ($3~/linux/ && $3!~/(beta|rc)[0-9]+|armv6l|386/)a=$3}END{print "'$URL'"a}'` [[email protected] /tmp/go]# tar xf go*.linux-amd64.tar.gz -C /usr/local/ [[email protected] /tmp/go]# echo "PATH=/usr/local/go/bin:\$PATH" >/etc/profile.d/go.sh [[email protected] /tmp/go]# . /etc/profile.d/go.sh [[email protected] /tmp/go]# go version go version go1.6 linux/amd64 [[email protected] /tmp/go]# cd ..
14、添加git系统用户
[[email protected] /tmp]# mkdir -p /data/ [[email protected] /tmp]# adduser -r -s /bin/bash -c 'GitLab' -m -d /data/git/ git
15、安装MariaDB
[[email protected] /tmp]# wget http://mirrors.dwhd.org/SQL/MariaDB/mariadb-10.1.13/bintar-linux-x86_64/mariadb-10.1.13-linux-x86_64.tar.gz [[email protected] /tmp]# tar xf mariadb-10.1.13-linux-x86_64.tar.gz -C /usr/local/ [[email protected] /tmp]# ln -sv /usr/local/mariadb-10.1.13-linux-x86_64 /usr/local/mariadb "/usr/local/mariadb" -> "/usr/local/mariadb-10.1.13-linux-x86_64" [[email protected] /tmp]# cd /usr/local/mariadb [[email protected] /usr/local/mariadb]# Username="mysql" [[email protected] /usr/local/mariadb]# for i in `seq 1000 1500`;do [ -z "$(awk -F: '{print$3,$4}' /etc/passwd | grep "$i")" -a -z "$(awk -F: '{print$3}' /etc/group | grep "$i")" ] && UGID=$i && break;done && groupadd -g $UGID $Username && useradd -M -u $UGID -g $UGID -s /sbin/nologin $Username [[email protected] /usr/local/mariadb]# chown -R mysql.mysql /data/mariadb [[email protected] /usr/local/mariadb]# ls -l /data/ 总用量 0 drwx------ 2 git git 59 4月 6 16:16 git drwxr-xr-x 2 mysql mysql 6 4月 6 16:14 mariadb [[email protected] /usr/local/mariadb]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld [[email protected] /usr/local/mariadb]# sed -i "s@^basedir=.*@basedir=/usr/local/mariadb@" /etc/init.d/mysqld [[email protected] /usr/local/mariadb]# sed -i "s@^datadir=.*@datadir=/data/mariadb@" /etc/init.d/mysqld [[email protected] /usr/local/mariadb]# chmod +x /etc/rc.d/init.d/mysqld [[email protected] /usr/local/mariadb]# cat /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock default-character-set = utf8 [mysql] default-character-set=utf8 [mysqld] port = 3306 socket = /tmp/mysql.sock character-set-server=utf8 basedir = /usr/local/mariadb datadir = /data/mariadb pid-file = /data/mariadb/mysql.pid user = mysql bind-address = 0.0.0.0 server-id = 1 skip-name-resolve #skip-networking back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 max_allowed_packet = 4M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M read_buffer_size = 2M read_rnd_buffer_size = 8M sort_buffer_size = 8M join_buffer_size = 8M key_buffer_size = 4M thread_cache_size = 8 query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed expire_logs_days = 30 log_error = /data/mariadb/mysql-error.log slow_query_log = 1 long_query_time = 1 slow_query_log_file = /data/mariadb/mysql-slow.log performance_schema = 0 #lower_case_table_names = 1 skip-external-locking default_storage_engine = InnoDB #default-storage-engine = MyISAM innodb_file_per_table = 1 innodb_open_files = 500 innodb_buffer_pool_size = 64M innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_thread_concurrency = 0 innodb_purge_threads = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 2M innodb_log_file_size = 32M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 bulk_insert_buffer_size = 8M myisam_sort_buffer_size = 8M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 interactive_timeout = 28800 wait_timeout = 28800 [mysqldump] quick max_allowed_packet = 16M [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M read_buffer = 4M write_buffer = 4M [[email protected] /usr/local/mariadb]# /usr/local/mariadb/scripts/mysql_install_db --user=mysql --datadir=/data/mariadb Installing MariaDB/MySQL system tables in '/data/mariadb' ... 2016-04-06 16:22:35 140361217341312 [Note] /usr/local/mariadb/bin/mysqld (mysqld 10.1.13-MariaDB) starting as process 11169 ... OK Filling help tables... 2016-04-06 16:22:47 139961125017472 [Note] /usr/local/mariadb/bin/mysqld (mysqld 10.1.13-MariaDB) starting as process 11199 ... OK Creating OpenGIS required SP-s... 2016-04-06 16:22:50 139730244343680 [Note] /usr/local/mariadb/bin/mysqld (mysqld 10.1.13-MariaDB) starting as process 11259 ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: '/usr/local/mariadb/bin/mysqladmin' -u root password 'new-password' '/usr/local/mariadb/bin/mysqladmin' -u root -h 10.0.1.83 password 'new-password' Alternatively you can run: '/usr/local/mariadb/bin/mysql_secure_installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '/usr/local/mariadb' ; /usr/local/mariadb/bin/mysqld_safe --datadir='/data/mariadb' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/local/mariadb/mysql-test' ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Support MariaDB development by buying support/new features from MariaDB Corporation Ab. You can contact us about this at [email protected]. Alternatively consider joining our community based development effort: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/ [[email protected] /usr/local/mariadb]# service mysqld start Reloading systemd: [ 确定 ] Starting mysqld (via systemctl): [ 确定 ] [[email protected] /usr/local/mariadb]# chkconfig mysqld on [[email protected] /usr/local/mariadb]# chkconfig |grep mysql mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关 [[email protected] /usr/local/mariadb]# echo "export PATH=/usr/local/mariadb/bin:\$PATH" > /etc/profile.d/mariadb.sh [[email protected] /usr/local/mariadb]# . /etc/profile.d/mariadb.sh [[email protected] /usr/local/mariadb]# which mysql /usr/local/mariadb/bin/mysql [[email protected] /usr/local/mariadb]# usermod -a -G git mysql
16、配置数据库
[[email protected] /usr/local/mariadb]# mysql -uroot Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 10.1.13-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> USE mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]> UPDATE user SET password=PASSWORD('lookback') WHERE USER='root'; Query OK, 4 rows affected (0.00 sec) Rows matched: 4 Changed: 4 Warnings: 0 MariaDB [mysql]> DELETE FROM user WHERE User=''; Query OK, 2 rows affected (0.00 sec) MariaDB [mysql]> DROP DATABASE test; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> CREATE USER 'git'@'localhost' IDENTIFIED BY 'lookback'; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> SET storage_engine=INNODB; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; Query OK, 1 row affected (0.00 sec) MariaDB [mysql]> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON gitlabhq_production.* TO 'git'@'localhost'; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> SELECT USER,PASSWORD,HOST FROM user; +------+-------------------------------------------+--------------------------+ | USER | PASSWORD | HOST | +------+-------------------------------------------+--------------------------+ | root | *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | localhost | | root | *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | ds-vm-node83.cluster.com | | root | *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | 127.0.0.1 | | root | *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | ::1 | | git | *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | localhost | +------+-------------------------------------------+--------------------------+ 5 rows in set (0.00 sec) MariaDB [mysql]> SHOW DATABASES; +---------------------+ | Database | +---------------------+ | gitlabhq_production | | information_schema | | mysql | | performance_schema | +---------------------+ 4 rows in set (0.00 sec) MariaDB [mysql]> \q Bye
17、编译安装redis(Redis version >= 2.8.0)
[[email protected] /usr/local/mariadb]# mkdir /tmp/redis && cd /tmp/redis [[email protected] /tmp/redis]# wget -c `curl -s http://redis.io/download | awk -F"'" '/[0-9].[0-9].*.tar.gz/{print $4;exit}'` [[email protected] /tmp/redis]# tar xf redis-*.tar.gz [[email protected] /tmp/redis]# cd redis-* [[email protected] /tmp/redis/redis-3.0.7]# make [[email protected] /tmp/redis/redis-3.0.7]# mkdir -p /usr/local/redis/{bin,etc,var} [[email protected] /tmp/redis/redis-3.0.7]# cp -af src/{redis-benchmark,redis-check-aof,redis-check-dump,redis-cli,redis-sentinel,redis-server} /usr/local/redis/bin/ [[email protected] /tmp/redis/redis-3.0.7]# cp -a redis.conf /usr/local/redis/etc/ [[email protected] /tmp/redis/redis-3.0.7]# echo "export PATH=/usr/local/redis/bin:\$PATH" > /etc/profile.d/redis.sh [[email protected] /tmp/redis/redis-3.0.7]# . /etc/profile.d/redis.sh [[email protected] /tmp/redis/redis-3.0.7]# sed -i '[email protected].*@pidfile /var/run/redis.pid@' /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# sed -i "[email protected].*@logfile /usr/local/redis/var/redis.log@" /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# sed -i "s@^dir.*@dir /usr/local/redis/var@" /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# sed -i '[email protected] [email protected] yes@' /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# [ -z "`grep ^maxmemory /usr/local/redis/etc/redis.conf`" ] && sed -i '[email protected] <bytes>@maxmemory <bytes>\nmaxmemory 360000000@' /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# mkdir -p /var/run/redis && chown -R git /var/run/redis/ [[email protected] /tmp/redis/redis-3.0.7]# sed -ri 's/^(port).*/\1 0/' /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# echo 'unixsocket /var/run/redis/redis.sock' >> /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# echo 'unixsocketperm 0770' >> /usr/local/redis/etc/redis.conf [[email protected] /tmp/redis/redis-3.0.7]# wget -q http://www.dwhd.org/script/Redis-server-init-CentOS -O /etc/init.d/redis-server [[email protected] /tmp/redis/redis-3.0.7]# sed -i "/touch $lockfile/a \ chown git $(awk '/^unixsocket /{print $2}' /usr/local/redis/etc/redis.conf)" /etc/init.d/redis-server [[email protected] /tmp/redis/redis-3.0.7]# chmod +x /etc/init.d/redis-server [[email protected] /tmp/redis/redis-3.0.7]# chkconfig redis-server on [[email protected] /tmp/redis/redis-3.0.7]# service redis-server start Starting redis-server (via systemctl): [ 确定 ] [[email protected] /tmp/redis/redis-3.0.7]# ls -l /var/run/redis 总用量 0 srwxrwx--- 1 git root 0 4月 6 16:37 redis.sock [[email protected] /tmp/redis/redis-3.0.7]# redis-cli -s /var/run/redis/redis.sock <<< "info" | grep 'redis.version' && cd ../.. redis_version:3.0.7 [[email protected] /tmp]#
18、编译安装Nginx
[[email protected] /tmp/nginx]# wget http://mirrors.dwhd.org/Nginx/nginx-1.9.14.tar.gz [[email protected] /tmp/nginx]# tar xf nginx-1.9.14.tar.gz [[email protected] /tmp/nginx]# cd nginx-1.9.14/ [[email protected] /tmp/nginx/nginx-1.9.14]# adduser -r -s /sbin/nologin -c 'Web Server' -M www [[email protected] /tmp/nginx/nginx-1.9.14]# yum -y install pcre-devel pcre [[email protected] /tmp/nginx/nginx-1.9.14]# ./configure --prefix=/usr/local/nginx/ \ --user=www --group=www \ --error-log-path=/tmp/nginx/error.log \ --http-log-path=/tmp/nginx/access.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --with-pcre \ --with-http_ssl_module \ --with-http_flv_module \ --with-http_v2_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --http-client-body-temp-path=/usr/local/nginx/client/ \ --http-proxy-temp-path=/usr/local/nginx/proxy/ \ --http-fastcgi-temp-path=/usr/local/nginx/fcgi/ \ --http-uwsgi-temp-path=/usr/local/nginx/uwsgi \ --http-scgi-temp-path=/usr/local/nginx/scgi [[email protected] /tmp/nginx/nginx-1.9.14]# make -j $(awk '/processor/{i++}END{print i}' /proc/cpuinfo) && make install && cd ../.. [[email protected] /tmp]# echo "export PATH=/usr/local/nginx/sbin:\$PATH" > /etc/profile.d/nginx.sh [[email protected] /tmp]# . /etc/profile.d/nginx.sh [[email protected] /tmp]# wget -q http://www.dwhd.org/script/Nginx-init-CentOS -O /etc/rc.d/init.d/nginx [[email protected] /tmp]# chmod +x /etc/rc.d/init.d/nginx [[email protected] /tmp]# chkconfig nginx on [[email protected] /tmp]# nginxCONF=/usr/local/nginx/conf/nginx.conf [[email protected] /tmp]# sed -i "$(awk '{a=NR}END{print a}' $nginxCONF)s@^@ include vhost/*.conf;\n&@" $nginxCONF [[email protected] /tmp]# mkdir -p /usr/local/nginx/conf/vhost/ [[email protected] /tmp]# mkdir -p /var/log/nginx/ [[email protected] /tmp]# wget -q https://gitlab.com/gitlab-org/gitlab-ce/raw/master/lib/support/nginx/gitlab -O /usr/local/nginx/conf/vhost/git.dwhd.org.conf [[email protected] /tmp]# usermod -a -G git www [[email protected] /tmp]# sed -i 's/server.*gitlab-workhorse.socket.*/#&/' /usr/local/nginx/conf/vhost/git.dwhd.org.conf [[email protected] /tmp]# sed -i '/upstream/a \ \ server 127.0.0.1:8080 fail_timeout=0;' /usr/local/nginx/conf/vhost/git.dwhd.org.conf [[email protected] /tmp]# sed -i 's/YOUR_SERVER_FQDN/你的域名/' /usr/local/nginx/conf/vhost/git.dwhd.org.conf
19、修改sudo配置
[[email protected] /tmp]# chmod u+w /etc/sudoers [[email protected] /tmp]# sed -ri 's@^(Defaults\s+secure_path\s+=).*@\1 /usr/local/go/bin:/usr/local/mariadb/bin:/usr/local/nginx/sbin:/usr/local/redis/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin@' /etc/sudoers [[email protected] /tmp]# chmod ugo-w /etc/sudoers [[email protected] /tmp]#
20、 检测各种环境安装情况
[[email protected] /tmp]# mysql -V mysql Ver 15.1 Distrib 10.1.13-MariaDB, for Linux (x86_64) using readline 5.1 [[email protected] /tmp]# nginx -v nginx version: nginx/1.9.14 [[email protected] /tmp]# ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] [[email protected] /tmp]# go version go version go1.6 linux/amd64 [[email protected] /tmp]# bundle -v Bundler version 1.11.2 [[email protected] /tmp]# git --version git version 2.8.1 [[email protected] /tmp]#
二、安装GitLab
1、克隆GitLab 8.6中文版分支
[[email protected] /tmp]# cd /data/git/ [[email protected] /data/git]# sudo -u git -H git clone https://gitlab.com/larryli/gitlab.git -b 8-6-zh gitlab 正克隆到 'gitlab'... remote: Counting objects: 214761, done. remote: Compressing objects: 100% (45405/45405), done. remote: Total 214761 (delta 166493), reused 214623 (delta 166408) 接收对象中: 100% (214761/214761), 111.36 MiB | 266.00 KiB/s, 完成. 处理 delta 中: 100% (166493/166493), 完成. 检查连接... 完成。 [[email protected] /data/git]# cd gitlab/ [[email protected] /data/git/gitlab]# sudo -u git -H git branch -va |head -1
2、复制GitLab配置文件config/gitlab.yml
[[email protected] /data/git/gitlab]# sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
3、修改gitlab配置文件
[[email protected] /data/git/gitlab]# sudo -u git -H sed -i 's@/home/git@/data/git@' config/gitlab.yml [[email protected] /data/git/gitlab]# sudo -u git -H sed -ri "s/^(\s+email_from:).*/\1 [email protected]/" config/gitlab.yml [[email protected] /data/git/gitlab]# sudo -u git -H sed -ri "s/^(\s+host:).*/\1 git.dwhd.org/" config/gitlab.yml [[email protected] /data/git/gitlab]# sed -ri "s@(bin_path: ).*@\1$(which git)@" config/gitlab.yml [[email protected] /data/git/gitlab]# sed -ri "s/(time_zone: ).*/\1'Beijing'/" config/gitlab.yml
###下面是我的配置文件参考 [[email protected] /data/git/gitlab]# grep -Ev '^(\s+)?(#|$)' config/gitlab.yml production: &base gitlab: host: git.dwhd.org port: 80 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details email_from: [email protected] email_display_name: GitLab email_reply_to: [email protected] default_projects_features: issues: true merge_requests: true wiki: true snippets: false builds: true incoming_email: enabled: false address: "gitlab-incoming+%{key}@gmail.com" user: "[email protected]" password: "[REDACTED]" host: git.dwhd.org port: 993 ssl: true start_tls: false mailbox: "inbox" artifacts: enabled: true lfs: enabled: true gravatar: enabled: true # Use user avatar image from Gravatar.com (default: true) cron_jobs: stuck_ci_builds_worker: cron: "0 0 * * *" gitlab_ci: ldap: enabled: false servers: main: # 'main' is the GitLab 'provider ID' of this LDAP server label: 'LDAP' host: git.dwhd.org port: 389 uid: 'sAMAccountName' method: 'plain' # "tls" or "ssl" or "plain" bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' password: '_the_password_of_the_bind_user' timeout: 10 active_directory: true allow_username_or_email_login: false block_auto_created_users: false base: '' user_filter: '' attributes: username: ['uid', 'userid', 'sAMAccountName'] email: ['mail', 'email', 'userPrincipalName'] name: 'cn' first_name: 'givenName' last_name: 'sn' omniauth: enabled: false allow_single_sign_on: ["saml"] block_auto_created_users: true auto_link_ldap_user: false auto_link_saml_user: false providers: shared: satellites: path: /data/git/gitlab-satellites/ backup: path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) gitlab_shell: path: /data/git/gitlab-shell/ repos_path: /data/git/repositories/ hooks_path: /data/git/gitlab-shell/hooks/ upload_pack: true receive_pack: true git: bin_path: /usr/local/bin/git max_size: 20971520 # 20.megabytes timeout: 10 extra: rack_attack: git_basic_auth: development: <<: *base test: <<: *base gravatar: enabled: true lfs: enabled: false gitlab: host: git.dwhd.org port: 80 satellites: path: tmp/tests/gitlab-satellites/ backup: path: tmp/tests/backups gitlab_shell: path: tmp/tests/gitlab-shell/ repos_path: tmp/tests/repositories/ hooks_path: tmp/tests/gitlab-shell/hooks/ issues_tracker: redmine: title: "Redmine" project_url: "http://redmine/projects/:issues_tracker_id" issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new" ldap: enabled: false servers: main: label: ldap host: git.dwhd.org port: 3890 uid: 'uid' method: 'plain' # "tls" or "ssl" or "plain" base: 'dc=example,dc=com' user_filter: '' group_base: 'ou=groups,dc=example,dc=com' admin_group: '' staging: <<: *base [[email protected] /data/git/gitlab]#
4、给目录log/和tmp/ git用户有写权限
[[email protected] /data/git/gitlab]# sudo -u git mkdir /data/git/gitlab/public/uploads [[email protected] /data/git/gitlab]# sudo -u git chown -R git {log,tmp}/ public/uploads [[email protected] /data/git/gitlab]# sudo -u git chmod -R u+rwX {log,tmp}/ public/uploads [[email protected] /data/git/gitlab]# sudo -u git chmod -R ug+rwX,o-rwx /data/git/repositories/ [[email protected] /data/git/gitlab]# sudo -u git chmod -R ug-s /data/git/repositories/ [[email protected] /data/git/gitlab]# find /data/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s [[email protected] /data/git/gitlab]# sudo -u git ls -ld {log,tmp}/ public/uploads drwxr-xr-x 2 git git 4096 4月 6 18:52 log/ drwxr-xr-x 2 git git 6 4月 8 00:50 public/uploads drwxr-xr-x 6 git git 58 4月 6 18:52 tmp/ [[email protected] /data/git/gitlab]#
5、创建satellites目录并设置权限
[[email protected] /data/git/gitlab]# sudo -u git mkdir /data/git/gitlab-satellites [[email protected] /data/git/gitlab]# chmod u+rwx,g=rx,o-rwx /data/git/gitlab-satellites
6、给tmp/pids、tmp/sockets以及public/uploads/目录 git用户有写权限
[[email protected] /data/git/gitlab]# chmod -R u+rwX tmp/{pids,sockets} [[email protected] /data/git/gitlab]# ls -ld tmp/{pids,sockets} drwxr-xr-x 2 git git 21 4月 6 17:56 tmp/pids drwxr-xr-x 2 git git 21 4月 6 17:56 tmp/sockets [[email protected] /data/git/gitlab]#
7、从模版拷贝出Unicorn配置文件
[[email protected] /data/git/gitlab]# sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb [[email protected] /data/git/gitlab]# sudo -u git -H sed -i 's@/home/git@/data/git@' config/unicorn.rb
8、如果你负载比较大请启用集群模式
[[email protected] /data/git/gitlab]# sudo -u git -H sed -ri "s/^(worker_processes ).*/\1 $(nproc)/" config/unicorn.rb [[email protected] /data/git/gitlab]# sudo -u git -H sed -ri "s/^(timeout ).*/\1 300/" config/unicorn.rb
9、从模版拷贝出Rack attack配置文件
[[email protected] /data/git/gitlab]# sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
10、为git用户做全局配置
[[email protected] /data/git/gitlab]# sudo -u git -H git config --global user.name "GitLab" [[email protected] /data/git/gitlab]# sudo -u git -H git config --global user.email "[email protected]" [[email protected] /data/git/gitlab]# sudo -u git -H git config --global core.autocrlf input [[email protected] /data/git/gitlab]#
11、配置redis的连接
[[email protected] /data/git/gitlab]# sudo -u git -H cp config/resque.yml.example config/resque.yml [[email protected] /data/git/gitlab]# sudo -u git -H sed -ri "s@^(development:).*@\1 unix:/var/run/redis/redis.sock@" config/resque.yml
12、配置Gitlab 数据库设置
[[email protected] /data/git/gitlab]# sudo -u git cp config/database.yml.mysql config/database.yml [[email protected] /data/git/gitlab]# sudo -u git -H editor config/database.yml [[email protected] /data/git/gitlab]# sudo -u git -H chmod o-rwx config/database.yml
13、安装Gems
[[email protected] /data/git/gitlab]# sudo -u git -H bundle install --deployment --without development test postgres aws ##如果是国内服务器安装请修改为淘宝的ruby源 ##[[email protected] /data/git/gitlab]# sed -ri 's@^(source ).*@\1"https://ruby.taobao.org"@' Gemfile
[[email protected] /data/git/gitlab]# sudo -u git -H bundle install --deployment --without development test postgres aws Fetching gem metadata from https://rubygems.org/........ Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Installing rake 10.5.0 Installing CFPropertyList 2.3.2 Installing RedCloth 4.2.9 with native extensions Installing ace-rails-ap 2.0.1 Installing i18n 0.7.0 Using json 1.8.3 Installing minitest 5.7.0 Installing thread_safe 0.3.5 Installing builder 3.2.2 Installing erubis 2.7.0 Installing mini_portile2 2.0.0 Installing rack 1.6.4 Installing mime-types 1.25.1 Installing arel 6.0.3 Installing activerecord-deprecated_finders 1.0.4 Installing thor 0.19.1 Installing addressable 2.3.8 Installing akismet 2.0.0 Installing allocations 1.0.4 with native extensions Installing multipart-post 2.0.0 Installing multi_json 1.11.2 Installing jwt 1.5.2 Installing multi_xml 0.5.5 Installing asciidoctor 1.5.3 Installing encryptor 1.3.0 Installing attr_required 1.0.0 Installing execjs 2.6.0 Installing ice_nine 0.11.1 Installing babosa 1.0.2 Installing bcrypt 3.1.10 with native extensions Installing sass 3.4.20 Installing browser 1.0.1 Installing cal-heatmap-rails 3.5.1 Installing cause 0.1 Installing charlock_holmes 0.7.3 with native extensions Installing chunky_png 1.3.5 Installing coffee-script-source 1.10.0 Installing colorize 0.7.7 Installing concurrent-ruby 1.0.0 Installing connection_pool 2.2.0 Installing safe_yaml 1.0.4 Installing creole 0.5.0 Installing orm_adapter 0.5.0 Installing rotp 2.1.1 Installing diff-lcs 1.2.5 Installing diffy 3.0.7 Using bundler 1.11.2 Installing email_reply_parser 0.5.8 Installing equalizer 0.0.11 Installing escape_utils 1.1.0 with native extensions Installing eventmachine 1.0.8 with native extensions Installing excon 0.45.4 Installing expression_parser 0.9.0 Installing formatador 0.2.5 Installing ipaddress 0.8.2 Installing xml-simple 1.1.5 Installing inflecto 0.0.2 Installing rugged 0.24.0 with native extensions Installing get_process_mem 0.2.0 Installing github-markup 1.3.3 Installing posix-spawn 0.3.11 with native extensions Installing gitlab_meta 7.0 Installing net-ldap 0.12.1 Installing hashie 3.4.3 Installing pyu-ruby-sasl 0.0.3.3 Installing rubyntlm 0.5.2 Installing rouge 1.10.1 Installing stringex 2.5.2 Installing request_store 1.2.1 Installing tilt 2.0.2 Installing sexp_processor 4.6.0 Installing mimemagic 0.3.0 Installing htmlentities 4.3.4 Installing http_parser.rb 0.5.3 with native extensions Installing httpclient 2.7.0.1 Installing jquery-atwho-rails 1.3.2 Installing kgio 2.10.0 with native extensions Installing systemu 2.6.5 Installing mail_room 0.6.1 Installing method_source 0.8.2 Installing mousetrap-rails 1.4.6 Installing mysql2 0.3.20 with native extensions Installing nested_form 0.3.2 Installing net-ssh 3.0.1 Installing newrelic_rpm 3.14.1.311 Installing oauth 0.4.7 Installing timfel-krb5-auth 0.8.3 with native extensions Installing rubypants 0.2.0 Installing rack-cors 0.4.0 Installing raindrops 0.15.0 with native extensions Installing raphael-rails 2.1.2 Installing redcarpet 3.3.3 with native extensions Installing redis 3.2.2 Installing rinku 1.7.3 with native extensions Installing rufus-scheduler 3.1.10 Installing settingslogic 2.0.9 Installing simple_oauth 0.1.9 Installing six 0.2.0 Installing slack-notifier 1.2.1 Installing state_machines 0.4.0 Installing underscore-rails 1.8.3 Installing unf_ext 0.0.7.1 with native extensions Installing version_sorter 2.0.0 with native extensions Installing fission 0.5.0 Installing gemojione 2.2.1 Installing rdoc 3.12.2 Installing recaptcha 1.0.2 Installing tzinfo 1.2.2 Installing descendants_tracker 0.0.4 Installing nokogiri 1.6.7.2 with native extensions Installing rack-test 0.6.3 Installing warden 1.2.4 Installing sprockets 3.3.5 Installing rack-accept 0.4.5 Installing rack-mount 0.8.3 Installing rack-attack 4.3.1 Installing rack-protection 1.5.3 Installing mail 2.6.3 Installing select2-rails 3.5.9.3 Installing css_parser 1.3.7 Installing faraday 0.9.2 Installing httparty 0.13.7 Installing attr_encrypted 1.3.4 Installing autoprefixer-rails 6.2.3 Installing uglifier 2.7.2 Installing influxdb 0.2.3 Installing rqrcode 0.7.0 Installing coffee-script 2.4.1 Installing crack 0.4.3 Installing fog-core 1.35.0 Installing gemnasium-gitlab-service 0.2.6 Installing github-linguist 4.7.5 Installing gollum-rugged_adapter 0.4.2 Installing gitlab-grit 2.7.3 Installing omniauth 1.3.1 Installing haml 4.0.7 Installing ruby_parser 3.7.2 Installing macaddr 1.7.1 Installing org-ruby 0.9.12 Installing unicorn 4.9.0 with native extensions Installing redis-store 1.1.7 Installing redis-namespace 1.5.2 Installing sidekiq 4.0.1 Installing wikicloth 0.8.1 Installing twitter-stream 0.1.16 Installing unf 0.1.4 Installing gitlab_emoji 0.3.1 Installing activesupport 4.2.5.2 Installing axiom-types 0.1.1 Installing coercible 1.0.0 Installing loofah 2.0.3 Installing sanitize 2.1.0 Installing sinatra 1.4.6 Installing premailer 1.8.6 Installing faraday_middleware 0.10.0 Installing oauth2 1.0.0 Installing sawyer 0.6.0 Installing sentry-raven 0.15.6 Installing flowdock 0.7.1 Installing hipchat 1.5.2 Installing bootstrap-sass 3.3.6 Installing rqrcode-rails3 0.1.7 Installing ruby-fogbugz 0.2.1 Installing fog-json 1.0.2 Installing fog-xml 0.1.2 Installing fog-local 0.2.1 Installing fog-vmfusion 0.1.0 Installing gollum-grit_adapter 1.0.0 Installing gitlab_omniauth-ldap 1.2.1 Installing omniauth-oauth 1.1.0 Installing omniauth-cas3 1.1.3 Installing omniauth-multipassword 0.4.2 Installing omniauth-shibboleth 1.2.1 Installing html2haml 2.0.0 Installing uuid 2.3.8 Installing unicorn-worker-killer 0.4.4 Installing redis-rack 1.5.0 Installing sidekiq-cron 0.4.0 Installing rails-deprecated_sanitizer 1.0.3 Installing globalid 0.3.6 Installing activemodel 4.2.5.2 Installing gitlab_git 10.0.0 Installing grape-entity 0.4.8 Installing html-pipeline 1.11.0 Installing omniauth_crowd 2.2.3 Installing rack-oauth2 1.2.1 Installing redis-activesupport 4.1.5 Installing virtus 1.0.5 Installing rails-html-sanitizer 1.0.3 Installing faraday_middleware-multi_json 0.0.6 Installing tinder 1.10.1 Installing omniauth-oauth2 1.3.1 Installing octokit 3.8.0 Installing gitlab-flowdock-git-hook 1.0.1 Installing fog-aliyun 0.1.0 Installing fog-brightbox 0.10.1 Installing fog-sakuracloud 1.7.5 Installing fog-serverlove 0.1.2 Installing fog-softlayer 1.0.3 Installing fog-storm_on_demand 0.1.1 Installing fog-atmos 0.1.0 Installing fog-aws 0.8.1 Installing fog-dynect 0.0.2 Installing fog-ecloud 0.3.0 Installing fog-google 0.1.0 Installing fog-powerdns 0.1.1 Installing fog-profitbricks 0.0.5 Installing fog-radosgw 0.0.5 Installing fog-riakcs 0.1.0 Installing fog-terremark 0.1.0 Installing fog-voxel 0.1.0 Installing fog-xenserver 0.2.2 Installing gollum-lib 4.1.0 Installing omniauth-bitbucket 0.0.2 Installing omniauth-twitter 1.2.1 Installing omniauth-kerberos 0.3.0 Installing ruby-saml 1.1.2 Installing rails-dom-testing 1.0.7 Installing activejob 4.2.5.2 Installing activerecord 4.2.5.2 Installing carrierwave 0.10.0 Installing state_machines-activemodel 0.3.0 Installing task_list 1.0.2 Installing grape 0.13.0 Installing asana 0.4.0 Installing omniauth-auth0 1.4.1 Installing omniauth-azure-oauth2 0.0.6 Installing omniauth-facebook 3.0.0 Installing omniauth-github 1.1.2 Installing omniauth-gitlab 1.0.1 Installing omniauth-google-oauth2 0.2.10 Installing fog 1.36.0 Installing omniauth-saml 1.5.0 Installing actionview 4.2.5.2 Installing acts-as-taggable-on 3.5.0 Installing after_commit_queue 1.3.0 Installing default_value_for 3.0.1 Installing paranoia 2.1.4 Installing seed-fu 2.3.5 Installing state_machines-activerecord 0.3.0 Installing actionpack 4.2.5.2 Installing actionmailer 4.2.5.2 Installing railties 4.2.5.2 Installing sprockets-rails 2.3.3 Installing gon 6.0.1 Installing kaminari 0.16.3 Installing redis-actionpack 4.0.1 Installing premailer-rails 1.9.0 Installing activerecord-session_store 0.1.2 Installing coffee-rails 4.1.0 Installing d3_rails 3.5.11 Installing responders 2.1.1 Installing doorkeeper 2.2.2 Installing font-awesome-rails 4.5.0.0 Installing haml-rails 0.9.0 Installing jquery-rails 4.0.5 Installing jquery-scrollto-rails 1.4.3 Installing jquery-ui-rails 5.0.5 Installing rails 4.2.5.2 Installing sass-rails 5.0.4 Installing redis-rails 4.0.0 Installing turbolinks 2.5.3 Installing devise 3.5.4 Installing dropzonejs-rails 0.7.2 Installing jquery-turbolinks 2.1.0 Installing devise-async 0.9.0 Installing devise-two-factor 2.0.1 Bundle complete! 173 Gemfile dependencies, 267 gems now installed. Gems in the groups development, test, postgres and aws were not installed. Bundled gems are installed into ./vendor/bundle. Post-install message from browser: #################### WARNING ############################## # # # Internet Explorer detection has changed on v1.0.0+. # # If this is important for you, please read # # https://github.com/fnando/browser#internet-explorer # # # ########################################################### Post-install message from mousetrap-rails: Remember to run generator to generate sample file and include mousetrap-rails with Rails Asset Pipeline $ rails generate mousetrap:install Post-install message from rdoc: Depending on your version of ruby, you may need to install ruby rdoc/ri data: <= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install >= 1.9.2 : nothing to do! Yay! Post-install message from httparty: When you HTTParty, you must party hard! Post-install message from haml: HEADS UP! Haml 4.0 has many improvements, but also has changes that may break your application: * Support for Ruby 1.8.6 dropped * Support for Rails 2 dropped * Sass filter now always outputs <style> tags * Data attributes are now hyphenated, not underscored * html2haml utility moved to the html2haml gem * Textile and Maruku filters moved to the haml-contrib gem For more info see: http://rubydoc.info/github/haml/haml/file/CHANGELOG.md Post-install message from html-pipeline: ------------------------------------------------- Thank you for installing html-pipeline! You must bundle Filter gem dependencies. See html-pipeline README.md for more details. https://github.com/jch/html-pipeline#dependencies ------------------------------------------------- Post-install message from acts-as-taggable-on: When upgrading Re-run the migrations generator rake acts_as_taggable_on_engine:install:migrations This will create any new migrations and skip existing ones Version 3.5.0 has a migration for mysql adapter [[email protected] /data/git/gitlab]#
14、安装gitlab-shell
[[email protected] /data/git/gitlab]# sudo -u git -H bundle exec rake gitlab:shell:install[v$(cat GITLAB_SHELL_VERSION)] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production WARNING: This version of GitLab depends on gitlab-shell 2.6.11, but you're running Unknown. Please update gitlab-shell. Missing `db_key_base` for 'production' environment. The secrets will be generated and stored in `config/secrets.yml` 正克隆到 '/data/git/gitlab-shell'... remote: Counting objects: 2558, done. remote: Compressing objects: 100% (895/895), done. remote: Total 2558 (delta 1607), reused 2501 (delta 1571) 接收对象中: 100% (2558/2558), 360.62 KiB | 221.00 KiB/s, 完成. 处理 delta 中: 100% (1607/1607), 完成. 检查连接... 完成。 HEAD 现在位于 bceed73 Update CHANGELOG for 2.6.11 mkdir -p /data/git/repositories/: OK mkdir -p /data/git/.ssh: OK chmod 700 /data/git/.ssh: OK touch /data/git/.ssh/authorized_keys: OK chmod 600 /data/git/.ssh/authorized_keys: OK chmod ug+rwX,o-rwx /data/git/repositories/: OK [[email protected] /data/git/gitlab]#
15、配置gitlab-shell
[[email protected] /data/git/gitlab]# cat /data/git/gitlab-shell/config.yml --- user: git gitlab_url: http://git.dwhd.org/ http_settings: self_signed_cert: false repos_path: "/data/git/repositories/" auth_file: "/data/git/.ssh/authorized_keys" redis: bin: "/usr/local/redis/bin/redis-cli" namespace: resque:gitlab socket: "/var/run/redis/redis.sock" log_level: INFO audit_usernames: false [[email protected] /data/git/gitlab]#
16、安装 gitlab-workhorse
[[email protected] /data/git/gitlab]# cd .. [[email protected] /data/git]# sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git [[email protected] /data/git]# cd gitlab-workhorse [[email protected] /data/git]# sudo -u git -H make
17、初始化数据并且激活高级特性
[[email protected] /data/git/gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=lookback [email protected]
18、安装启动脚本和设置开机启动
[[email protected] /data/git/gitlab]# cd /etc/systemd/system/ [[email protected] /etc/systemd/system]# wget -O gitlab-sidekiq.service https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab-sidekiq.service [[email protected] /etc/systemd/system]# wget -O gitlab-unicorn.service https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab-unicorn.service [[email protected] /etc/systemd/system]# wget -O gitlab-workhorse.service https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab-workhorse.service [[email protected] /etc/systemd/system]# wget -O gitlab-mailroom.service https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab-mailroom.service [[email protected] /etc/systemd/system]# sed -i 's/Requires=redis.service/#&/' /etc/systemd/system/gitlab-* [[email protected] /etc/systemd/system]# sed -i 's@/home@/[email protected]' /etc/systemd/system/gitlab-* [[email protected] /etc/systemd/system]# sed -i 's@/usr/bin/bundle@/usr/local/bin/[email protected]' /etc/systemd/system/gitlab-* && cd /data/git/gitlab [[email protected] /data/git/gitlab]# systemctl daemon-reload [[email protected] /data/git/gitlab]# systemctl start gitlab-sidekiq gitlab-unicorn gitlab-workhorse gitlab-mailroom [[email protected] /data/git/gitlab]# systemctl enable gitlab-sidekiq.service gitlab-unicorn.service gitlab-workhorse.service gitlab-mailroom.service
[[email protected] /data/git/gitlab]# systemctl status gitlab-sidekiq.service gitlab-unicorn.service gitlab-workhorse.service gitlab-mailroom.service ● gitlab-sidekiq.service - GitLab Sidekiq Worker Loaded: loaded (/etc/systemd/system/gitlab-sidekiq.service; enabled; vendor preset: disabled) Active: active (running) since 五 2016-04-08 02:17:10 CST; 1min 19s ago Process: 9394 ExecStop=/usr/local/bin/bundle exec sidekiqctl stop /data/git/gitlab/tmp/pids/sidekiq.pid >> /data/git/gitlab/log/sidekiq.log 2>&1 (code=exited, status=0/SUCCESS) Process: 9444 ExecStart=/usr/local/bin/bundle exec sidekiq -d -q archive_repo -q post_receive -q mailers -q system_hook -q incoming_email -q project_web_hook -q gitlab_shell -q common -q default -e production -P tmp/pids/sidekiq.pid -d -L log/sidekiq.log >> log/sidekiq.log 2>&1 (code=exited, status=0/SUCCESS) Main PID: 9484 (ruby) CGroup: /system.slice/gitlab-sidekiq.service └─9484 sidekiq 4.0.1 gitlab [0 of 25 busy] 4月 08 02:17:09 DS-VM-Node83.cluster.com systemd[1]: Starting GitLab Sidekiq Worker... 4月 08 02:17:10 DS-VM-Node83.cluster.com systemd[1]: PID file /data/git/gitlab/tmp/pids/sidekiq.pid not readable (yet?) after start. 4月 08 02:17:10 DS-VM-Node83.cluster.com systemd[1]: gitlab-sidekiq.service: Supervising process 9484 which is not our child. We'll most likely not notice when it exits. 4月 08 02:17:10 DS-VM-Node83.cluster.com systemd[1]: Started GitLab Sidekiq Worker. ● gitlab-unicorn.service - GitLab Unicorn Server Loaded: loaded (/etc/systemd/system/gitlab-unicorn.service; enabled; vendor preset: disabled) Active: active (running) since 五 2016-04-08 02:17:09 CST; 1min 20s ago Main PID: 9478 (ruby) CGroup: /system.slice/gitlab-unicorn.service ├─9478 unicorn_rails master -D -c /data/git/gitlab/config/unicorn.rb -E production ├─9576 unicorn_rails worker[0] -D -c /data/git/gitlab/config/unicorn.rb -E production └─9579 unicorn_rails worker[1] -D -c /data/git/gitlab/config/unicorn.rb -E production 4月 08 02:17:09 DS-VM-Node83.cluster.com systemd[1]: Started GitLab Unicorn Server. 4月 08 02:17:09 DS-VM-Node83.cluster.com systemd[1]: Starting GitLab Unicorn Server... ● gitlab-workhorse.service - Gitlab Workhorse handles slow HTTP requests for Gitlab. Loaded: loaded (/etc/systemd/system/gitlab-workhorse.service; enabled; vendor preset: disabled) Active: active (running) since 五 2016-04-08 02:17:10 CST; 1min 20s ago Process: 9446 ExecStart=/data/git/gitlab/bin/daemon_with_pidfile /data/git/gitlab/tmp/pids/gitlab-workhorse.pid /data/git/gitlab-workhorse/gitlab-workhorse -listenUmask 0 -listenNetwork unix -listenAddr /data/git/gitlab/tmp/sockets/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSocket /data/git/gitlab/tmp/sockets/gitlab.socket -documentRoot /data/git/gitlab/public >> /data/git/gitlab/log/gitlab-workhorse.log 2>&1 (code=exited, status=0/SUCCESS) Main PID: 9460 (gitlab-workhors) CGroup: /system.slice/gitlab-workhorse.service └─9460 /data/git/gitlab-workhorse/gitlab-workhorse -listenUmask 0 -listenNetwork unix -listenAddr /data/git/gitlab/tmp/sockets/gitlab-workhorse.socket -authBackend http://127.0.... 4月 08 02:17:09 DS-VM-Node83.cluster.com systemd[1]: Starting Gitlab Workhorse handles slow HTTP requests for Gitlab.... 4月 08 02:17:10 DS-VM-Node83.cluster.com systemd[1]: Started Gitlab Workhorse handles slow HTTP requests for Gitlab.. ● gitlab-mailroom.service - Gitlab mailroom Worker Loaded: loaded (/etc/systemd/system/gitlab-mailroom.service; enabled; vendor preset: disabled) Active: active (exited) since 五 2016-04-08 02:17:10 CST; 1min 20s ago Process: 9395 ExecStop=/data/git/gitlab/bin/mail_room stop (code=exited, status=0/SUCCESS) Process: 9447 ExecStart=/data/git/gitlab/bin/mail_room start (code=exited, status=0/SUCCESS) Main PID: 9447 (code=exited, status=0/SUCCESS) CGroup: /system.slice/gitlab-mailroom.service └─9464 ruby /data/git/gitlab/vendor/bundle/ruby/2.3.0/bin/mail_room -q -c /data/git/gitlab/config/mail_room.yml 4月 08 02:17:09 DS-VM-Node83.cluster.com systemd[1]: Starting Gitlab mailroom Worker... 4月 08 02:17:10 DS-VM-Node83.cluster.com systemd[1]: Started Gitlab mailroom Worker. [[email protected] /data/git/gitlab]#
19、设置日志滚动
[[email protected] /data/git/gitlab]# cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab [[email protected] /data/git/gitlab]# chmod g+rx /data/git
20、检查应用程序状态
[[email protected] /data/git/gitlab]# sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production System information System: Current User: git Using RVM: no Ruby Version: 2.3.0p0 Gem Version: 2.5.1 Bundler Version:1.11.2 Rake Version: 10.5.0 Sidekiq Version:4.0.1 GitLab information Version: 8.6.2 Revision: cc5211c Directory: /data/git/gitlab DB Adapter: mysql2 URL: http://git.dwhd.org HTTP Clone URL: http://git.dwhd.org/some-group/some-project.git SSH Clone URL: [email protected]:some-group/some-project.git Using LDAP: no Using Omniauth: no GitLab Shell Version: 2.6.11 Repositories: /data/git/repositories/ Hooks: /data/git/gitlab-shell/hooks/ Git: /usr/local/bin/git [[email protected] /data/git/gitlab]# ../gitlab-shell/bin/check Check GitLab API access: OK Check directories and files: /data/git/repositories/: OK /data/git/.ssh/authorized_keys: OK Test redis-cli executable: redis-cli 3.0.7 Send ping to redis server: PONG [[email protected] /data/git/gitlab]#
[[email protected] /data/git/gitlab]# sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production Checking GitLab Shell ... GitLab Shell version >= 2.6.12 ? ... OK (2.6.12) Repo base directory exists? ... yes Repo base directory is a symlink? ... no Repo base owned by git:git? ... yes Repo base access is drwxrws---? ... yes hooks directories in repos are links: ... Benyoo / test ... ok jason / ceshi ... ok Running /data/git/gitlab-shell/bin/check Check GitLab API access: OK Check directories and files: /data/git/repositories/: OK /data/git/.ssh/authorized_keys: OK Test redis-cli executable: redis-cli 3.0.6 Send ping to redis server: PONG gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Checking Reply by email ... Reply by email is disabled in config/gitlab.yml Checking Reply by email ... Finished Checking LDAP ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab ... Git configured with autocrlf=input? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config outdated? ... no Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory setup correctly? ... no Try fixing it: sudo find /data/git/gitlab/public/uploads -type d -not -path /data/git/gitlab/public/uploads -exec chmod 0700 {} \; For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. Init script exists? ... yes Init script up-to-date? ... no Try fixing it: Redownload the init script For more information see: doc/install/installation.md in section "Install Init Script" Please fix the error above and rerun the checks. projects have namespace: ... Benyoo / test ... yes jason / ceshi ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.1.0 ? ... yes (2.3.0) Your git bin path is "/usr/local/bin/git" Git version >= 2.7.3 ? ... yes (2.8.0) Active users: 3 Checking GitLab ... Finished [[email protected] /data/git/gitlab]#
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏