Ali cloud server -Linux system set up in the detailed process gitlab

GitLab installation and tutorial

GitLab Profile

GitLab, is an open source application using the Ruby on Rails development, to achieve a self-hosted Git repository project, accessible public or private project to install through the Web interface. 
It has similar features with GitHub can browse the source code management deficiencies and comments. Management team can access to the repository, it is very easy to browse submitted version of the file and provides a historical repository. 
Team members can communicate using the built-in simple chat program (Wall). It also provides a snippet collection functions can easily achieve code reuse, to facilitate future need time to find out.

  • Check the port number 80 is turned on

If the port number does not open, please see this article in your own cloud server up to add Ali port number 80

https://jingyan.baidu.com/article/92255446fe79bac51648f497.html

  • installation

Configuring source yum

vim /etc/yum.repos.d/gitlab-ce.repo

Copy the following contents:


  
  
  1. [Gitlab it]
  2. name=Gitlab CE Repository
  3. baseurl = https: //mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
  4. gpgcheck= 0
  5. enabled= 1

2. Update the local cache yum

yum makecache

3. Install GitLab Community Edition

yum install gitlab-ce # to automatically install the latest version

Note: For installing the specified version, the version number can then be added, namely yum install gitlab-ce-xxx

4. Turn GitLab

gitlab-ctl start

GitLab commonly used commands

gitlab-ctl start # start all gitlab components;

gitlab-ctl stop # gitlab stop all components;

gitlab-ctl restart # restart all gitlab components;

gitlab-ctl status # check the service status;

gitlab-ctl reconfigure # start the service; ( reload the configuration file, you can use GitLab after the initial installation, but not free to use in the business environment, reconfigure the config will restore some of the past, lead to a revision of the port, and so there is no domain name . )

vim /etc/gitlab/gitlab.rb # modify the default configuration file;

gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab;

sudo gitlab-ctl tail # view the log;

  • GitLab use

1. Log GitLab

In a public address bar enter the server browser to display GitLab IP interface. First log forces the user to change the password. After the password is changed successfully, enter your user name and password.

Note: If you can not access, you can use the ps -ef command to see if the service starts normally, if not start, then re-open, if still can not start, you can use gitlab-ctl reconfigure (using the initial environments only) command to start the service , then visit gitlab .

2. Create Project

Will appear after successful login the following page:

 

3. Modify the domain name

Since there is no DNS server can not resolve domain names, so it is necessary to modify the domain name as a host name, enter the terminal modify files.

vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml


  
  
  1.   ## GitLab settings
  2.   GitLab:
  3.     ## Web server settings (note: host is the FQDN, do not include http: //)
  4.     host: 10.0. 0.210
  5.     port: 8888
  6.     https: false

Restart GitLab

gitlab-ctl restart

Refresh the page to see if the amendment is successful GitLab

 

  • GitLab backup and recovery
  1. GitLab create a backup

gitlab-rake gitlab:backup:create

Use the above command will create a default name similar to archive 1520580592_2018_03_09_10.5.3_gitlab_backup.tar in / var / opt / gitlab under / backups directory, this archive is an integral part of Gitlab whole, which is the beginning of the backup creation 1520580592_2018_03_09_10.5.3 date.

2. Delete the project

"Remove project" button at the bottom of the page, click Create a project, delete project.

At this point no longer project

3.GitLab recovery

Stop data connection services

gitlab-ctl stop unicorn

gitlab-ctl stop sidekiq

Number restored from a backup 1520580592_2018_03_09_10.5.3

gitlab-rake gitlab:backup:restore BACKUP=1520580592_2018_03_09_10.5.3

Start Gitlab

gitlab-ctl start

4. View GitLab page is restored project.

  • Gitlab  modify the backup file in the default directory

You can modify the default directory to store the backup file by modifying /etc/gitlab/gitlab.rb.

 vim /etc/gitlab/gitlab.rb

gitlab_rails['backup_path'] = "/mnt/gitlab/backup" >>修改文件路径即可
  
  

Use gitlab-ctl reconfigure command to reload the configuration file after the modification is complete.

Note: Because it involves the re-loading configuration, reconfigure put some past config reduction, resulting in a modified port, and domain name are all gone. That suggestion to modify the repository after the service default installation path, if the change this late stage business, the business would have been affected. If the latter business needs change this, please be prepared in advance, and then modify the parameters in the configuration file.

After reload the configuration file find / mnt / gitlab / backup permissions changes

  • Modify the default path Warehouse

Modify the configuration file, find git_data_dirs

vim /etc/gitlab/gitlab.rb


  
  
  1. # git_data_dirs({
  2. # "default" => {
  3. # "path" => "/mnt/nfs-01/git-data"
  4. # }
  5. # })
  6. is git_data_ "/ the Data / gitlab" >> here to add a custom repository path of the directory to be created in advance

Add a git_data_dir git_data_dir below the "/ data / gitlab"

2. Stop the current gitlab, reload the configuration

Note: Modify repository path will lead to the existing project loss, make a backup in advance, the specific backup operation please refer to the above " gitlab backup and recovery", and then modify the parameters in the configuration file.

gitlab-ctl stop

gitlab-ctl reconfigure

3. After reload, you will find in the / data / gitlab directory more than a directory repositories

4. Finally, you can start gitlab

gitlab-ctl start

  • GitLab service port modification

GitLab profile path attached to the yum / var / opt / gitlab / nginx / conf (installation configuration file path is not necessarily the same as the other, find themselves).

1, modify the configuration file

vim /var/opt/gitlab/nginx/conf/gitlab-http.conf


  
  
  1. ###################################
  2. ## configuration ##
  3. ###################################
  4. upstream gitlab-workhorse {
  5. server unix: /var/opt /gitlab/gitlab-workhorse/ socket;
  6. }
  7. server {
  8. the listen *: 8888 ; you can modify the port here >>

2, restart the service

gitlab-ctl restart

3. Access ip: port, see page are normal

Note 1 : port after revision, Project the IP also requires corresponding changes, see above "Modify" domains that modify the port parameter.

Note 2: Perform gitlab-ctl reconfigure command, the configuration file is reloaded, service port will be restored to the default port 80, so, If you need to change the port, follow the instructions after the above two steps.

Gitlab deployments do not pay attention to port conflict.

Of course, I think this blog writing is particularly good:

https://blog.csdn.net/duyusean/article/details/80011540

Ssh configuration steps of:

https://blog.csdn.net/xyzchenxiaolin/article/details/51852333

These are my steps to install, configure, and some of the problems can later refer to the following steps:

        1. Install, look at my own blog

         2. Modify the port, do not conflict
        sometimes not only need to modify the port external_url, but also to modify the Unicorn
        https://blog.csdn.net/fengchao2016/article/details/77851234
        3. Modify git file storage path
        https: //www.cnblogs .com / dieyaxianju / the p-/ 7586203.html
        4. set sending mail function
        reference link: http: //www.fayfox.com/post/39.html
        mailbox configuration official document: https: //docs.gitlab.com/ settings omnibus / / smtp.html # mandrill
        test after installation: https: //blog.csdn.net/yelllowcong/article/details/79939589
        If the test is unsuccessful, refer to this article: https: // ruby-china. org / topics / 20450 (To authenticate the sender account and be consistent.)

Published an original article · won praise 0 · Views 42

GitLab installation and tutorial

Guess you like

Origin blog.csdn.net/yilulihuakai/article/details/104804104