建议使用非root账户安装,先同步系统时间:

ntpdate cn.pool.ntp.org

1、创建用户gitlab

注意:centos下,adduser和useradd的命令效果是一样的,但ubunut下,useradd只创建用户不生成用户主目录,adduser会用向导提示你一步步创建一个完整的用户:

[gitlab@localhost ~]$ su root
Password:
[root@localhost gitlab]# cd ~
[root@localhost ~]# passwd gitlab
Changing password for user gitlab.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# su gitlab
[gitlab@localhost root]$ cd ~
[gitlab@localhost ~]$

2、安装gitlab

访问 https://about.gitlab.com/downloads/#centos6

按照第一步安装必要的依赖。如果你不想用sendmail或者postfix作为发送邮件的服务端,你可以不安装postfix,而使用内置的smtp配置第三方的邮箱即可,或者是你的企业邮箱:

1. Install and configure the necessary dependencies
sudo yum install curl openssh-server openssh-clients postfix cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh

第二步我使用的是下载rpm包的方式安装,而不是使用官方的脚本:

2. Add the GitLab package server and install the package

rpm包到这里下载,https://packages.gitlab.com/gitlab/gitlab-ce

包很大比较慢,不建议使用wget或者curl,建议下载到本地再上传到服务器。

下载完成后,

sudo rpm -i gitlab-ce-8.5.4-ce.0.el6.x86_64.rpm

3、配置LDAP认证

编辑配置文件。注意,最后那个EOS的注释要取消掉:

sudo vim /etc/gitlab/gitlab.rb
## For setting up LDAP
## see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#setting-up-ldap-sign-in
## Be careful not to break the identation in the ldap_servers block. It is in
## yaml format and the spaces must be retained. Using tabs will not work. gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: '192.168.100.100'
port: 389
uid: 'sAMAccountName'
method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: 'cn=your_ldap_name,ou=your_ou_name,dc=your_2nd_domain,dc=your_1st_domain'
password: 'yourpassword'
active_directory: true
allow_username_or_email_login: false
block_auto_created_users: false
base: 'dc=tima,dc=local'
user_filter: ''
# ## EE only
# group_base: ''
# admin_group: ''
# sync_ssh_keys: false
#
# secondary: # 'secondary' is the GitLab 'provider ID' of second LDAP server
# 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'
# active_directory: true
# allow_username_or_email_login: false
# block_auto_created_users: false
# base: ''
# user_filter: ''
# ## EE only
# group_base: ''
# admin_group: ''
# sync_ssh_keys: false
EOS

4、取消用户注册功能

注意:由于大家呼声很高,似乎从7.7版开始,gitlab默认启用了用户注册功能,并且在 /etc/gitlab/gitlab.rb 中找不到

#gitlabrails['gitlabsignup_enabled'] = false

#gitlabrails[

'signinenabled'] = false

配置部分了,但是可以登录root账户在GUI下的Admin Area 中配置,如下:

5、配置发送邮件功能

邮件发送其实不必要用到postfix或sendmail,所以我是先停掉了postfix,以免配置过程中的错误日志产生误导:

sudo service postfix status
sudo service postfix stop
sudo service postfix disable
sudo chkconfig postfix off
sudo chkconfig

编辑配置文件:

sudo vim /etc/gitlab/gitlab.rb

取消注释并修改:

################################
# GitLab email server settings #
################################
# see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/smtp.md#smtp-settings
# Use smtp instead of sendmail/postfix. gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.yourdomain.com"
gitlab_rails['smtp_port'] = 25 #465 for SSL
gitlab_rails['smtp_user_name'] = "your_mail_sender_name"
gitlab_rails['smtp_password'] = "your_password"
gitlab_rails['smtp_domain'] = "smtp.yourdomain.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'none' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
# gitlab_rails['smtp_ca_path'] = "/etc/ssl/certs"
# gitlab_rails['smtp_ca_file'] = "/etc/ssl/certs/ca-certificates.crt"

然后reconfigure:

sudo gitlab-ctl reconfigure

同时可能需要检查以下两个配置文件是否与你配置的信息一致:

sudo vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

sudo vim /opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb

SecureCRT另开session观察日志输出:

sudo tail -f /var/log/gitlab/gitlab-rails/production.log

测试邮件推送功能是否正常:

使用ldap账户登录到gitlab,创建一个项目如pythonweb,这时候默认的group是你的用户名,如果你想用别的项目,可以点击Create a group,添加一个group,创建完成后我的git路径是:

git@172.16.224.246:openstack/pythonweb.git

第一次配的时候应该是

这里的localhost是不合理的,别人提交代码的时还得修改成ip或者域名,这个可以在配置文件里修改默认值:

sudo vim /etc/gitlab/gitlab.rb

在最顶部修改如下:

## Url on which GitLab will be reachable.
external_url 'http://172.16.224.246' #这里是ip地址或者域名

回到gitlab界面,点击左下角的settings--services--Emails on push, 勾选Active,Recipients填写本项目更新需要推送知晓的人员,多个用空格或者逗号隔开:

本机添加git目录并push到远程主机:

我在windows下,使用cygwin,cygwin配置可以参考:

https://xstarcd.github.io/wiki/cygwin/index.html(我同事)

http://www.cnblogs.com/astwish/articles/3700459.html

git使方法推荐廖雪峰老师的git教程。

第一次提交项目前会要求添加SSH key,点击add an SSH key,可以添加自己的公钥到(公钥可以有多个):

本机生成SSH key,并复制蓝底部分到上面的key框中:

$

ssh-keygen -t rsa -C valiant.jiang@timanetworks.com

#email要填你登录gitlab的ldap关联的email
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ONE/.ssh/id_rsa):
/home/ONE/.ssh/id_rsa already exists.
Overwrite (y/n)? n #我是no 因为已经有了不想再改 ONE@DESKTOP-BGP4M01 ~$

cat ~/.ssh/id_rsa.pub


ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0V2KJgXp3O0p/5pE2apMJLg9W9ePQF8cOFUo03nEIX6IRjrHGmZjMX8napr9lJRU676pgJhekW/gbyn1DuSyBxurPe65vr/MpQMCMq/Pd00tA/z3irT5DIvfhLb+xhaTMJcT7UIBNvSjw4pUb2la3cKJzkbV01RzbESoNnpEqtnZsVY8Ys1WNHzRkgxO+EGQphf9HdEanRxOoIUKmOKtVUA8oiCpz0z6yyWnNFYnL6OMeviYiJ26n7eKTV5pqUmQtbzc3sKNTXsi+1Cw+3l1/l8Mbro2o6NGQP4lNfJGjFU6Q3t/uV4l+mpP11r0cqfzjF4gegxk0G9NiIomgAHmp valiant.jiang@timanetworks.com

ONE@DESKTOP-BGP4M01 ~$

按照project页面的提示,设置全局的免密钥代码提交账户:

git config --global user.name "Valiant Jiang"
git config --global user.email valiant.jiang@timanetworks.com
 
git clone git@172.16.224.246:openstack/pythonweb.git
cd pythonweb
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

做完这一步,应该就可以收到系统发给你的push报告邮件了:

6、升级到最新稳定版

针对不同的安装方式,GitLab官方提供了不同的升级方法,我们是手动安装omnibus包,所以用下面的链接升级:

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update/README.md#updating-from-gitlab-66-and-higher-to-the-latest-version

Updating from GitLab 6.6 and higher to the latest version

The procedure can also be used to upgrade from a CE omnibus package to an EE omnibus package.

First, download the latest CE or EE (license key required) package to your GitLab server.

Stop services but leave postgresql running for the database migrations and create a backup
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl stop nginx
sudo gitlab-rake gitlab:backup:create
Install the latest package
# Ubuntu/Debian:
sudo dpkg -i gitlab_x.x.x-omnibus.xxx.deb # CentOS:
sudo rpm -Uvh gitlab-x.x.x_xxx.rpm
Reconfigure GitLab (includes running database migrations) and restart all services
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

Done!

Trouble? Check status details
sudo gitlab-ctl status
sudo gitlab-rake gitlab:check SANITIZE=true

7、实用链接

log文件详解:http://doc.gitlab.com/ee/logs/logs.html

ldap配置:http://doc.gitlab.com/ce/integration/ldap.html

smtp配置:http://doc.gitlab.com/omnibus/settings/smtp.html

各版本升级地址:https://about.gitlab.com/update/

本次升级地址:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update/README.md#updating-from-gitlab-66-and-higher-to-the-latest-version

Centos6.7 minimal安装GitLab8.3.4配置LDAP、发邮件以及升级到GitLab8.5.4的更多相关文章

  1. linux(centos8):阿里云ecs配置smtps发邮件(解决不能通过25端口发邮件问题)

    一,2016年9月后购买的阿里云ecs不再支持通过25端口发送邮件 官方的建议是使用465端口 465端口(SMTPS): 465端口是为SMTPS(SMTP-over-SSL)协议服务开放的 它是S ...

  2. 在VMware上安装CentOS-6.5 minimal - 安装VMware Tools

    由于CentOS-6.5 minimal很多工具都默认没有安装,安装VMwareTools需要用到Perl,所以老伯建议先配置好网络再接着安装. 网络配置方法可以参考在VMware上安装CentOS- ...

  3. Nagios 配置自动发邮件功能

    安装sendmailyum install -y sendmail* mailx 修改防火墙设置,添加25端口到防火墙vi /etc/sysconfig/iptables 重启 iptables.se ...

  4. PCB SQL SERVER 邮箱配置与发邮件

    一.开启SQL SERVER发邮件功能 --开启发邮件功能 reconfigure with override go reconfigure with override go 二.邮箱配置 1.代码创 ...

  5. centos6.4 minimal 安装kvm

    操作系统是网易源下载的centos 64位的minimal安装包,很多工具都没有,像gcc make wget which where 等统统没有,好在有yum 这里为了简单起见直接用yum安装kvm ...

  6. centos6.6手动安装mysql5.5并配置主从同步

    0.实验环境 主机IP(Master) 192.168.61.150 centos6.6 从机IP(Slave)   192.168.61.157 centos6.6 1.查看centos系统版本 [ ...

  7. centos6.5下安装samba服务器与配置

    转自:http://www.centoscn.com/CentosServer/ftp/2014/1023/3989.html http://www.cnblogs.com/x_wukong/p/56 ...

  8. centos6.5编译安装php7,及配置与nginx通信。

    一.配置编译环境 yum update && yum upgrade yum groupinstall "Development Tools" yum instal ...

  9. CentOS-6.4 minimal - 安装VMware Tools(linux)

    本文参考自:http://www.cnblogs.com/xyq/p/4068018.html 1.挂载光驱 2./mnt下面默认显示以下文件 3.卸载/mnt 4.点击安装VMware Tools ...

随机推荐

  1. mysql基础之数据库变量(参数)管理

    数据库的数据存放路径:[root@ren7 mysql]# pwd /var/lib/mysql [root@ren7 mysql]# ls aria_log.00000001 ibdata1 mul ...

  2. 如何像如何像 NASA 顶级程序员一样编程 — 10 条重要原则

    https://www.oschina.net/news/90499/nasa-programmer-rule?from=20171112#0-qzone-1-7898-d020d2d2a4e8d1a ...

  3. python程序打包成exe(使用pyinstaller)

    pyinstaller下载地址:https://github.com/pyinstaller/pyinstaller/ (这个文件能够自动安装依赖项,其他版本的貌似还要自己安装依赖项) 下载之后解压到 ...

  4. 校准仪的开发 ---等下整理 迪文屏的ICO文件 和输出配置问题

    要有ICO文件才能

  5. 开源月刊《HelloGitHub》第 62 期

    兴趣是最好的老师,HelloGitHub 让你对编程感兴趣! 简介 分享 GitHub 上有趣.入门级的开源项目. 这里有实战项目.入门教程.黑科技.开源书籍.大厂开源项目等,涵盖多种编程语言 Pyt ...

  6. Python break/continue - Python零基础入门教程

    目录 一.break 二.continue 三.重点总结 四.猜你喜欢 零基础 Python 学习路线推荐 : Python 学习目录 >> Python 基础入门 在 Python wh ...

  7. kylin聚合组的使用案例

    在使用kylin聚合组进行优化的时候,往往不知道怎么使用. 这里有2个小案例可以参考. 1. 需要对某个维度进行隔离. 如果有些维度,你不想要它和其他维度一起出现,你就可以单独给它建一个聚合组,并且在 ...

  8. 3D-LaneNet:端到端三维多车道检测ICCV2019

    3D-LaneNet:端到端三维多车道检测ICCV2019 3D-LaneNet: End-to-End 3D Multiple Lane Detection 论文链接: http://openacc ...

  9. runtime系统的Cello

    runtime系统的Cello 通过充当一个现代的.功能强大的runtime系统,Cello使许多以前在C中不切实际或笨拙的事情变得简单,例如: 通用数据结构 多态函数 接口/类型类 构造函数/析构函 ...

  10. javaBean命名规范 get / set 后的首字母大写

    javaBean命名规范 Sun 推荐的命名规范 1 ,类名要首字母大写,后面的单词首字母大写 2 ,方法名的第一个单词小写,后面的单词首字母大写 3 ,变量名的第一个单词小写,后面的单词首字母大写 ...