Git是時下最普遍的版本控制系統,之前用過了網絡上的bitbucket,後來想要用才在深入去找資料才安裝.之前習慣了CVS,後來改用SVN用了一點時間來從新適應,現在改用git也是一樣,好在網絡的發達的確帶個人們很多方便,很多資料可循.
網絡版的git很好用,加上有方便的GUI.不過免費的沒幾個,通常免費的只供一兩個用戶,bitbucket就是其中一個有提供免費共5個用戶的配套,還有就是gitlab,網絡版的gitlab就少了invite user這個function,所以我打算自己裝在電腦裡.
跟著這個gitlab的網頁,就可以安裝gitlab了.
1. 在Centos 7安裝所需要的軟件:
#yum install curl openssh-server
#systemctl enable sshd
#systemctl start sshd
#yum install postfix (如果你需要用postfix)
#systemctl enable postfix (如果你需要用postfix)
#systemctl start postfix
#firewall-cmd --permanent --add-service=http
#systemctl reload firewalld
2. 接下來安裝gitlab
#curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
#yum install gitlab-ce
3. 再來開啟gitlab
#gitlab-ctl reconfigure
4. 完成,可以登錄了,用你的瀏覽器,去你的伺服器的url.
Username: root, Password: 5iveL!fe
5. 如果你想用gmail來發電郵那就得加把勁,依循gitlab網頁的教導.
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md#smtp-on-localhost
打開/etc/gitlab/gitlab.rb,在 SMTP on localhost那部分
gitlab_rails['smtp_enable'] = true
Gmail
gitlab_rails['gitlab_email_from'] = 'my.email@gmail.com'
gitlab_rails['gitlab_email_reply_to'] = 'my.email@gmail.com'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "my.email@gmail.com"
gitlab_rails['smtp_password'] = "my-gmail-password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
事成後記得執行#gitlab-ctl reconfigure
如果還感覺到不完美,還可以安裝https,步驟如下:
1. 打開/etc/gitlab/gitlab.rb把external_url的http改去https
external_url "https://gitlab.example.com
2. 在/etc/gitlab裡建造一個ssl文件夾
#mkdir -p /etc/gitlab/ssl
#chmod 700 /etc/gitlab/ssl
3. 打開/etc/gitlab/gitlab.rb,更改以下的設置
nginx['redirect_http_to_https'] = true
nginx['enable'] = true
nginx['redirect_http_to_https_port'] = 80
4. 弄一個ssl.
#openssl genrsa -des3 -out /etc/gitlab/ssl/gitlab.domain.com.key 2048 (記得輸入Pass phrase)
#openssl req -new -key /etc/gitlab/ssl/gitlab.domain.com.key -out /etc/gitlab/ssl/gitlab.domain.com.
Enter Country Name:
Enter State or Province Full Name:
ENter City Name:
Enter Company Name:
Enter Organization Unit Name:
Enter server hostname: 192.168.1.15
Enter Admin Email Address:
Skip Challenge Password (Hit Enter)
Skip Optional Company Name (Hit Enter)
#cp -v /etc/gitlab/ssl/gitlab.domain.com.{key,original} (拿掉pass phrase)
#openssl rsa -in /etc/gitlab/ssl/gitlab.domain.com.original -out /etc/gitlab/ssl/gitlab.domain.com.key
#rm -v /etc/gitlab/ssl/gitlab.domain.com.original
#openssl x509 -req -days 1460 -in /etc/gitlab/ssl/gitlab.domain.com.csr -signkey /etc/gitlab/ssl/gitlab.domain.com.key -out /etc/gitlab/ssl/gitlab.domain.com.crt
#rm -v /etc/gitlab/ssl/gitlab.domain.com.csr
#chmod 600 /etc/gitlab/ssl/gitlab.domain.com.*
5. 設定防火牆
#firewall-cmd --permanent --add-service=https
#systemctl reload firewalld
相關網頁:
https://about.gitlab.com/downloads/#centos7
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md#smtp-on-localhost
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md
http://www.bonusbits.com/wiki/HowTo:Setup_HTTPS_for_Gitlab
http://samwize.com/2014/07/24/how-to-setup-git-server-gitlab-with-ssl/
https://futurestud.io/blog/how-to-run-gitlab-with-self-signed-ssl-certificate/
How to unblock websites on your iPhone with Surfshark VPN
-
From a potential TikTok ban to blocked content, it has never been more
important to take back control of the web with Surfshark VPN for Mac and
iPhone to u...
3 小時前
沒有留言:
張貼留言