2024年3月7日发(作者:)

官网:/

安装参考网址:/downloads/

环境

Ubuntu 14.04

如果是虚拟机的话要改成桥接模式让局域网内其他计算机访问

网络设置

1. 宿主机网络配置:

连接特定的 DNS 后缀:

描述: Intel(R) WiFi Link 1000 BGN

物理地址: 74-E5-0B-99-52-22

已启用 DHCP: 是

IPv4 地址: 172.31.0.229

IPv4 子网掩码: 255.255.248.0

IPv4 默认网关: 172.31.0.1

IPv4 DHCP 服务器: 172.31.0.1

IPv4 DNS 服务器: 223.5.5.5, 223.6.6.6

根据宿主机手动配置虚拟机的网络

2. 虚拟机网络配置:

IPv4 地址: 172.31.0.199

IPv4 子网掩码: 255.255.248.0

IPv4 默认网关: 172.31.0.1

IPv4 DNS 服务器: 223.5.5.5, 223.6.6.6

检查下虚拟机能否上网。如果不能上网的会影响后面GitLab发送邮件。

检查下能否被局域网的其他计算机访问

安装

下载

1. Download the package and install everything

wget /ubuntu-14.04/gitlab_7.2.0-omnibus-1_

sudo apt-get install openssh-server

sudo apt-get install postfix # Select 'Internet Site', using sendmail instead also works, exim has problems

sudodpkg -i gitlab_7.2.0-omnibus-1_

2. Edit the configuration file to add your hostname

sudo -e /etc/gitlab/

3. Install and start GitLab

sudo gitlab-ctl reconfigure

默认管理员账号密码:

Username: root

Password: 5iveL!fe

For troubleshooting and configuration options

/gitlab-org/omnibus-gitlab/blob/master/

配置

1. 配置postfix

sudodpkg-reconfigure postfix

选择 internet

domain:

hostname:

smtpserver:

destination:localhost

备份下原来的配置

sudocp /etc/postfix//etc/postfix/_bak

修改配置

sudonano /etc/postfix/

# See /usr/share/postfix/ for a commented, more complete version

# Debian specific: Specifying a file name will cause the first

# line of that file to be used as the name. The Debian default

# is /etc/mailname.

#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)

biff = no

# appending .domain is the MUA's job.

append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings

#delay_warning_time = 4h

readme_directory = no

# TLS parameters

#smtpd_tls_cert_file=/etc/ssl/certs/

#smtpd_tls_key_file=/etc/ssl/private/

#smtpd_use_tls=yes

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache

smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_ in the postfix-doc package for

# information on enabling SSL in the smtp client.

smtpd_relay_restrictions

permit_mynetworkspermit_sasl_authenticateddefer_unauth_destination

myhostname =

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

yorigin = /etc/mailname

mydestination = localhost

relayhost = :25

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mailbox_size_limit = 0

recipient_delimiter = +

inet_interfaces = all

default_transport = smtp

relay_transport = smtp

inet_protocols = all

# enable SASL authentication

smtp_sasl_auth_enable = yes

=

# disallow methods that allow anonymous authentication.

smtp_sasl_security_options = noanonymous

# where to find sasl_passwd

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

# Enable STARTTLS encryption#smtp_use_tls = yes

# where to find CA certificates

#smtp_tls_CAfile = /etc/ssl/certs/

填写smtp服务器登录信息:

sudonano/etc/postfix/sasl_passwd

:25 yuanzhencai1990@:yzc.1234

添加smtp登录信息:

sudopostmap /etc/postfix/sasl_passwd

sudo postfix reload

sudo postfix stop

sudo postfix start

测试postfix

sunlights@ubuntu:~$ telnet localhost 25

Trying 127.0.

Connected to localhost.

Escape character is '^]'.

220 ESMTP Postfix (Ubuntu)

helo localhost

250

mail from:yuanzhencai1990@

250 2.1.0 Ok

rcpt to:515265763@

250 2.1.5 Ok

data

354 End data with .

to:515265763@

from:yuanzhencai1990@

subject:test postfix

this is just a test

.

250 2.0.0 Ok: queued as 362BA260BCF

quit

221 2.0.0 Bye

Connection closed by foreign host.

打开邮箱可以收到邮件

2. 配置GitLab

external_url,虚拟机的ip地址

external_url " 172.31.0.199"

GitLab的邮件地址:最好是smtp邮件发送服务器的邮箱地址

gitlab_rails['gitlab_email_from'] = 'yuanzhencai1990@'

sudonano /etc/gitlab/

# Change the external_url to the address your users will type in their browser

external_url '172.31.0.199'

gitlab_rails['gitlab_signup_enabled']=true

#gitlab_rails['smtp_enable'] = true

#gitlab_rails['smtp_address'] = ""

#gitlab_rails['smtp_port'] = 25

#gitlab_rails['smtp_user_name'] = "515265763@"

#gitlab_rails['smtp_password'] = "yzc.1234"

#gitlab_rails['smtp_domain'] = ""

#gitlab_rails['smtp_authentication'] = "login"

#gitlab_rails['smtp_enable_starttls_auto'] = true

# If your SMTP server does not like the default 'From: gitlab@localhost' you

# can change the 'From' with this setting.

gitlab_rails['gitlab_email_from'] = 'yuanzhencai1990@'

重启GitLab

sudo gitlab-ctl reconfigure

查看GitLab状态

sudo gitlab-ctl status

run: nginx: (pid 1069) 11728s; run: log: (pid 1068) 11728s

run: postgresql: (pid 1078) 11728s; run: log: (pid 1070) 11728s

run: redis: (pid 1077) 11728s; run: log: (pid 1076) 11728s

run: sidekiq: (pid 1074) 11728s; run: log: (pid 1073) 11728s

run: unicorn: (pid 1072) 11728s; run: log: (pid 1071) 11728s

查看GitLab日志

sudogitlab-ctl tail

至此,GItLab配置结束

使用

访问

使用虚拟机ip地址访问:172.31.0.199,默认管理员账号登录。

Centos 6