文章目录
Ubuntu14.04搭建gitlab版本管理平台
1.安装依赖包
sudo apt-get install curl openssh-server ca-certificates postfix
注:执行完成后,出现邮件配置,选择Internet那一项(不带Smarthost的)
然后需要填写邮箱配置。
2.添加GitLab安装包镜像源
利用清华大学的镜像(https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/)来进行主程序的安装
2.1 首先信任 GitLab 的 GPG 公钥
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
2.2 使用root用户修改配置文件
sudo gedit /etc/apt/sources.list.d/gitlab-ce.list
添加下一行内容:
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main
3 安装gitlab-ce
每次添加完软件源后要必须要update一下。
sudo apt-get update
sudo apt-get install gitlab-ce
/**注意:安装需要2GB存储空间
0 upgraded, 1 newly installed, 0 to remove and 448 not upgraded.
Need to get 799 MB of archives.
After this operation, 2,090 MB of additional disk space will be used.
********************************************************************************/
安装完成耗时半小时,出现以下界面:
It looks like GitLab has not been configured yet; skipping the upgrade script.
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting external_url
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
3.1 查看安装的gitlab版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
版本为:
12.10.3
4 配置GitLab IP地址
4.1 修改 externval_url 之后的域名
方法1:(使用GNU nano 2.2.6工具编辑gitlab.rb)
sudo -e /etc/gitlab/gitlab.rb
nano编辑器保存步骤:CTRL+X --> 按Y保存 --> 然后按回车
方法2:使用 vim gedit都可以。
域名值可以是本机 IP 或指向本机 IP的域名
默认未修改的值:
external_url ‘http://gitlab.example.com’
默认是端口80
修改后的值:
external_url ‘http://192.168.19.128’
其他参考配置(8080是自定义端口必须要要和 unicorn[‘port’]一致)
external_url ‘http://192.168.19.128:8080’
(这个端口同上的那个external_url 后的端口)
unicorn[‘port’] = 8080
5.启动sshd和postfix服务
5.1 安装sshd
已经安装成功了可以忽略该步骤。
sudo apt-get install openssh-server
5.2 启动sshd和postfix
sudo service sshd start
如果无效者执行