$ sudo chkconfig redis on
$ sudo service redis start f、配置邮件服务器
笔者注:这个过程笔者没有配置,请参考英文文档。 2、安装Ruby
下载并编译:
$ su -
$ mkdir /tmp/ruby && cd /tmp/ruby
$ curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz
$ cd ruby-2.0.0-p353
$ ./configure --prefix=/usr/local/
$ make && make install
安装完成后,重新登录终端确保$PATH生效,检测ruby的安装成功与否:
# 登录数据库
$ mysql -u root -p
# 输入root密码
# 为gitlab创建使用用户
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab账号的密码';
# 创建gitlaba使用的数据库
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# 给予gitlab用户权限
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
# 登出数据库
\q 6、安装GitLab
将GitLab安装在git的家目录下:
$ su - git
$ cd gitlab/
$ bundle exec rake gitlab:check RAILS_ENV=production
这里会提示一个Init script up-to-date的错误,如下:
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.
原文说明不用介意这个问题。 7、安装web服务器 最简单配置:
user root git;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# GITLAB
# Maintainer: @randx
# App Version: 5.0
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen *:80 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
# Set value of client_max_body_size to at least the value of git.max_size in gitlab.yml
client_max_body_size 5m;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gitlab;
}
}
}
笔者选择的是nginx,关于apache方面的请参考原文档
$ su -
$ yum -y install nginx
$ chkconfig nginx on
$ mkdir /etc/nginx/sites-available
$ mkdir /etc/nginx/sites-enabled
$ wget -O /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/web-server/nginx/gitlab-ssl
$ ln -sf /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
编辑/etc/nginx/nginx.conf,将 include /etc/nginx/conf.d/*.conf; 替换成 include /etc/nginx/sites-enabled/*;,就是修改额外加载的配置文件目录。
编辑/etc/nginx/sites-available/gitlab,将配置中server_name替换成实际访问的域名。
将nginx加入git用户组