在vm中试了下搭建git代码托管服务gitlab,公司现在用的也是gitlab,觉得挺好用的就搜了下自己搭建了一个
先上一下gitlab截图,能用markdown写东西真的很爽啊,为啥wordpress博客对markdown的支持不好捏(所以看到我的文章有点乱请小喷)
下面把步骤写一下:
安装必要的包
-
@H_404_27@
sudo yum install curl openssh-server
安装curl 和 openssh-server
@H_404_27@sudo systemctl enable sshd
systemctl
是chkconfig
和service
命令的合体,上面这个命令是设置sshd开机自启
sudo systemctl start sshd
启动 sshd 服务
@H_404_27@sudo yum install postfix
安装 postfix 邮件服务器
@H_404_27@sudo systemctl enable postfix
设置 postfix 开机自启动
@H_404_27@sudo systemctl start postfix
启动 postfix 服务
@H_404_27@sudo firewall-cmd --permanent --add-service=http
防火墙永久开启 http 服务
@H_404_27@sudo systemctl reload firewalld
防火墙设定生效
下载rpm包
进入 清华的镜像:http://mirror.tuna.tsinghua.edu.cn/gitlab-ce/
选择一个包下载下来,我下载的包名为:gitlab-ce-8.3.1-ce.1.el7.x86_64.rpm
chmod +x gitlab-ce-8.3.1-ce.1.el7.x86_64.rpm
rpm -i gitlab-ce-8.3.1-ce.1.el7.x86_64.rpm
配置
打开配置文件:vim /etc/gitlab/gitlab.rb
-
@H_404_27@配置仓库URL地址
修改配置项:external_url
,修改为你的gitlab的域名或IP地址
注:此处必改,否则生成的仓库地址是http://localhost/XXXX/XXX.git
@H_404_27@配置仓库保存位置 修改配置项:git_data_dir
默认为 /var/opt/gitlab/git-data
sudo gitlab-ctl reconfigure
在浏览器访问
默认的用户名密码为:root
/5iveL!fe
修改监听端口
修改这个文件
sudo vim /etc/gitlab/gitlab.rb
external_url 'http://ip_adress:9000' unicorn['port'] = 9001
- Nginx: /var/opt/gitlab/Nginx/conf/gitlab-http.conf
- Unicorn: /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
- Gitlab-shell: /var/opt/gitlab/gitlab-shell/config.yml
# sudo gitlab-ctl reconfigure