树莓派3B+ Git服务(GitLab)

来源:互联网 发布:linux统计目录文件数 编辑:程序博客网 时间:2024/05/23 12:46

树莓派3B+ Git服务(GitLab)


对于git,相信对于一个程序员并不陌生,因为正如我们经常逛的GitHub一样,也是使用了Git服务器,但是对于GitHub在国外,国内访问并不理想,而且你如果有一些私人项目,那么搭建一个Git服务器就必不可少了。


1.下载安装GitLab

GitLab官网:https://www.gitlab.com

下载链接:https://packages.gitlab.com/gitlab/raspberry-pi2/packages/raspbian/jessie/gitlab-ce_10.2.0-rc2.ce.0_armhf.deb
文件大小:378 MB,故请自行下载好再拷贝到树莓派!
备用下载:

// 安装和配置必需的依赖项sudo apt-get install -y curl openssh-server ca-certificates apt-transport-httpscurl https://packages.gitlab.com/gpg.key | sudo apt-key add -// 安装postfix发送通知邮件。sudo apt-get install -y postfix// 在安装配置的屏幕可能会出现postfix。选择“Internet站点”并按Enter键。使用服务器的外部DNS“邮件名称”并按Enter键。如果出现额外的屏幕,继续按回车键接受默认值。// 添加gitlab下载源。sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash// 配置 EXTERNAL_URL` http://gitlab.example.com `的URL,并安装// sudo EXTERNAL_URL="http://192.168.1.120" apt-get install gitlab-ce

注意:这里直接下载安装会比较慢,所以就采用下载好安装包,再安装的形式。
请自行下载好,再拷贝到树莓派。

// 安装下载好的gitlabsudo dpkg -i gitlab-ce_10.2.0-rc2.ce.0_armhf.deb// 配置 EXTERNAL_URL` http://gitlab.example.com `的URLsudo vim /etc/gitlab/gitlab.rb// 修改如下内容:external_url 'http://192.168.1.120'// 配置生效sudo gitlab-ctl reconfigure// 启动sudo gitlab-ctl start// 浏览到主机名和登录,设置密码(用户名root)

有关安装和配置的详细说明,请参见文档。

其它命令:

#使配置生效。sudo gitlab-ctl reconfigure#清除缓存页面:sudo gitlab-rake cache:clear RAILS_ENV=production#GitLab各组件启动:sudo gitlab-ctl start#GitLab各组件停止:sudo gitlab-ctl stop#GitLab各组件重启:sudo gitlab-ctl restart#禁用GitLab开机启动:sudo systemctl disable gitlab-runsvdir#启用GitLab开机自启:sudo systemctl enable gitlab-runsvdir

后记:对于树莓派来说,跑GitLab还是比较费力的。

原创粉丝点击