注意:::內存要2g以上
yum install curl openssh-server openssh-clients postfix cronie lokkit git -y
service postfix start
chkconfig postfix on
lokkit -s http -s ssh
sudo lokkit -s http -s ssh 會提示沒法找到lokkit命令,這個時候須要手動安裝,安裝的命令以下:
yum install lokkit,lokkit 能夠幫助咱們設定iptables 打開http和ssh。
要開啓ssh端口才能夠ssh終端登陸
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
開啓web8001端口
/sbin/iptables -I INPUT -p tcp --dport 8001 -j ACCEPT
/sbin/service iptables save
service iptables restart
一、配置yum源
vim /etc/yum.repos.d/gitlab-ce.repo
複製如下內容:
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
Repo_gpgcheck=0
Enabled=1
Gpgkey=https://packages.gitlab.com/gpg.key
二、更新本地yum緩存
sudo yum makecache
三、安裝GitLab社區版
warning:Package xxx.rpm is not signed
yum install gitlab-ce --nogpgcheck -y
sudo yum install gitlab-ce #自動安裝最新版
sudo yum install gitlab-ce-x.x.x #安裝指定版本
wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/ol/7/gitlab-ce-9.3.6-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-XXX.rpm
GitLab經常使用命令
sudo gitlab-ctl start # 啓動全部 gitlab 組件;
sudo gitlab-ctl stop # 中止全部 gitlab 組件;
sudo gitlab-ctl restart # 重啓全部 gitlab 組件;
sudo gitlab-ctl status # 查看服務狀態;
sudo gitlab-ctl reconfigure # 啓動服務;
sudo vim /etc/gitlab/gitlab.rb # 修改默認的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace # 檢查gitlab;
sudo gitlab-ctl tail # 查看日誌;
修改配置
gitlab.rb修改
vim /etc/gitlab/gitlab.rb
## Advanced settings
## unicorn['listen'] = '127.0.0.1'
## unicorn['port'] = 8080
gitlab-rails修改
vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
listen "127.0.0.1:8080", :tcp_nopush => true
listen "/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket", :backlog => 1024
gitlab nginx 修改
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
listen *:8001;
### 若是仍是想從80端口訪問gitlab,咱們能夠用監聽在80端口的nginx作一個反向代理。service nginx restart後能夠正常訪問。
server {
listen 80;
server_name git.yangsoon.cn;
location / {
proxy_pass http://127.0.0.1:8001;
}
}
giltab-shell修改
vim /var/opt/gitlab/gitlab-shell/config.yml
gitlab_url: "http://127.0.0.1:8080"
改生成的Git項目地址
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
host: git.yangsoon.cn
port: 80
https: false
登陸GitLab
Username: root
Password: 5iveL!fe