ubuntu 安装 gitlab最新版(下载慢问题)

Debian/Ubuntu 用户

首先信任 GitLab 的 GPG 公钥:

curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null

再选择你的 Debian/Ubuntu 版本,文本框中内容写进 /etc/apt/sources.list.d/gitlab-ce.list

Debian7(Wheezy)
echo "deb http://mirrors.lifetoy.org/gitlab-ce/debian wheezy main" | sudo tee -a /etc/apt/sources.list.d/gitlab-ce.list

Debian8(Jessie)
echo "deb http://mirrors.lifetoy.org/gitlab-ce/debian jessie main" | sudo tee -a /etc/apt/sources.list.d/gitlab-ce.list

Ubuntu 14.04 LTS
echo "deb http://mirrors.lifetoy.org/gitlab-ce/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/gitlab-ce.list

安装Gitlab-CE:

sudo apt-get update
sudo apt-get install gitlab-ce

然后修改默认的域名:

sudo vim /etc/gitlab/gitlab.rb

但我在服务器上测试后发现不能正常访问,检查log后发现主要问题是:gitlab安装包自带了nginx,要使用80端口对外服务,同时unicorn要使用8080端口对内服务,但在我们的服务器上这两个端口都已经被占用了。

因此,解决办法是:修改nginx的默认端口为8000,指定unicorn的默认端口为8001,修改gitlab-shell的默认端口为8000。

vim /var/opt/gitlab/nginx/etc/gitlab-http.conf
将其中的listen *:80改为listen *:8000,

vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
将listen行的内容改为 :listen “127.0.0.1:8001”, :tcp_nopush => true

然后修改:/var/opt/gitlab/gitlab-shell/config.yml
gitlab_url: “http://127.0.0.1:8000”

最后执行:gitlab-ctl reconfigure

 启动服务:gitlab-ctl start

停止服务:gitlab-ctl stop

重启服务:gitlab-ctl restart

查看日志

reids:gitlab-ctl tail -f redis

postgresql:gitlab-ctl tail -f postgresql

gitlab-workhorse:gitlab-ctl tail -f gitlab-workhorse

gitlab-ctl tail  -f logrotate

gitlab-ctl tail -f  nginx

gitlab-ctl tail -f sidekiq

gitlab-ctl tail -f unicorn

 

对于配置比较低的服务器暗转7.2.1

1、wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.2.1-omnibus-1_amd64.deb

2、sudo apt-get install openssh-server

3、sudo apt-get install postfix

安装的时候选择local

4、sudo dpkg -i gitlab_7.2.1-omnibus-1_amd64.deb

5、sudo -vim /etc/gitlab/gitlab.rb

6、sudo gitlab-ctl reconfigure

 

安装可能会出现未安装 swap相关异常

先看看是否有swap分区

deploy@web03:~$ sudo swapon -s
[sudo] password for deploy:
Filename                Type        Size    Used    Priority

这样就是没有

也可以通过free命令

deploy@web03:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          3951        504       3447          0        151        199
-/+ buffers/cache:        153       3798
Swap:            0          0          0

swap total是0

创建swapfile

sudo fallocate -l 4G /swapfile

设置/swapfile权限

sudo chmod 600 /swapfile

设置swapfile

sudo mkswap /swapfile

启用

sudo swapon /swapfile

查看

deploy@web03:~$ sudo swapon -s
[sudo] password for deploy:
Filename                Type        Size    Used    Priority
/swapfile                               file        1048572 0   -1

修改fstab

sudo vi /etc/fstab

添加

/swapfile   none    swap    sw    0   0

分区就创建完成了,再次重新安装gitlab应该不会有问题了

posted @ 2017-07-06 09:03  Binz  阅读(772)  评论(0编辑  收藏  举报