CENTOS7 Installation Configuration Gitlab
This text I will introduce to install Gitlab on CENTOS7, configure Gitlab SMTP, and create project demo.
sudo yum install openssh-serversudo yum install postfixsudo yum install Croniesudo service postfix startsudo chkconfig POS Tfix onsudo lokkit-s http-s ssh
Use the image of Tsinghua University Gitlab https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
Curl Https://packages.gitlab.com/gpg.key 2>/dev/null | sudo apt-key add-&>/dev/nullvi/etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]name=gitlab-cebaseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7repo_gpgcheck=0gpgcheck= 0enabled=1gpgkey=https://packages.gitlab.com/gpg.key
And then
Then open /etc/gitlab/gitlab.rb
, will be external_url = ‘http://git.example.com‘
modified to their own IP address or their own domain name, and then compiled, this will be done with chef,
sudo gitlab-ctl reconfigure
So if there is no error, the installation is complete.
Directly in the browser access just modified their own IP or domain name, you can see the Gitlab page, login with the following user name and password.
username:root password:5ivel!fe
You will be asked to change your password after landing.
Next Configure the
Configure SMTP
$ sudo vi/etc/gitlab/GITLAB.RB # The External_url to the address your users would typeinchtheir browserexternal_url'http://xxhost.com'#Sending Application Email via smtpgitlab_rails['smtp_enable'] =truegitlab_rails['smtp_address'] ="smtp.163.com"gitlab_rails['Smtp_port'] = -gitlab_rails['Smtp_user_name'] ="[email protected]"gitlab_rails['Smtp_password'] ="Xxpassword"gitlab_rails['Smtp_domain'] ="163.com"gitlab_rails['smtp_authentication'] =: logingitlab_rails['Smtp_enable_starttls_auto'] =true# #修改gitlab配置的发信人gitlab_rails ['Gitlab_email_from'] ="[email protected]"user["Git_user_email"] ="[email protected]"
Pay attention to 163,qq what to remember whitelist, or may be as junk e-mail ...
And then compile the
sudo gitlab-ctl reconfigure
Log in to modify your own mailbox, in profile
Create a new group named DevOps
Create a new project in this group named OpenStack
After success, you will be prompted to add an SSH key at the top, which prompts you how to create it.
On the host # ssh-keygen-c [email protected]
Then the space continues, and finally the public key is visible under ~/.ssh/, which is copied to the page.
Then register a new user Wenbin, here will ask you to enter the mailbox verification, here you can see the mailbox will be received before the mail sent to set up SMTP, activation on the line.
Then go to the host to generate a new user, generate SSH key.
Log in dashboard with root and add the Wenbin user to the DevOps group with permissions of reporter
Then login with Wenbin, you can see the OpenStack project, and then add Sshkey, so you can pull the project.
Installing Git:sudo yum install git,
Then you can clone the code:
git clone [email protected]:d Evops/openstack.git
You'll be prompted to clone an empty directory.
[[email protected] ~]$ git clone [email protected]:d evops/openstack.gitcloning into ' OpenStack ' ... warning: You appear to has cloned an empty repository. [[email protected] ~]$ CD openstack/[[email protected] openstack]$ lltotal 0[[email protected] openstack]$ git config user.name wenbin[[email protected] openstack]$ git config user.email [email protected] [[email protected] openstack]$ vim test.txt[[email protected] openstack]$ lltotal 4-rw-rw-r--. 1 wenbin wenbin 5 Mar 23:47 test.txt[[email protected] openstack]$ git Add. [[email protected] openstack]$ git status# on branch master## Initial commit## changes to being committed:# (use "Git RM--cached <file> unstage) # #new file:test.txt#[[email protected] openstack]$ git commit-m ' for test ' [Master (root-commit) 42eb67c] for test 1 file changed, 1 insertion (+) Create mode 100644 test.txt[[email protected] openstack]$ git pushwarning:push.default is unset;Its implicit value was changing Ingit 2.0 from ' matching ' to ' simple '. To squelch this messageand maintain the current behavior after the default changes, Use:git config--global push.default Matchingto squelch This message and adopt the new behavior now, use:git config--global push.default simplesee ' git hel P config ' and search for ' push.default ' for further information. (the ' simple ' mode is introduced in Git 1.7.11. Use the similar mode ' instead of ' simple ' if you sometimes use older versions of Git) gitlab:you is not allowed T O Push code to this project.fatal:Could not the read from remote repository. Please make sure the correct access rightsand the repository exists.
You can see the prompt push failed because Wenbin is just reporter
Once the permission has changed to developer, execute the
Git push-u Origin Master
We found a push that could be successful.
So far, centos7 install Gitlab, configure SMTP, build users and projects, clone code and push are OK, look forward to the integration of Gerrit and Jenkins later.
Resources:
http://blog.csdn.net/williamwanglei/article/details/38498465
https://about.gitlab.com/downloads/#centos7
1190000002722631
CENTOS7 Installation Configuration Gitlab