Read the table of contents:
1. Turn off firewall and Selinux
2. Install dependent libraries
3. Download and install GitLab 7.13.x version
4. Configure and start GitLab
5. Log in to GitLab
6. Reset root account password
7. Configuration requirements and instructions
1. Turn off firewall and Selinux
The firewall of Linux is a nightmare for us newbies. In many cases, it can be pinged, but the Web page cannot be accessed. So start killing it!
1.1 Turn off the firewall
[root@localhost ~]# /etc/init.d/iptables stop iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ]
1.2 Turn off the firewall automatically after booting
[root@localhost ~]# chkconfig iptables off
1.3 View Selinux status
[root@localhost ~]# sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 28
1.4 Turn off selinux
[root@localhost ~]# vim /etc/selinux/config
Modify SELINUX=disabled and restart the machine.
Note: Permanently open -> change to: SELINUX=enforcing
2. Install dependent libraries
2.1 Install dependent libraries
[root@localhost ~]# yum -y install curl policycoreutils openssh-server openssh-clients postfix cronie
2.2 Start postfix to send mail
[root@localhost ~]# service postfix start
2.2.1 Set postfix to start automatically
[root@localhost ~]# chkconfig postfix on
2.3 Start sshd
[root@localhost ~]# service sshd start
2.3.1 Set sshd to start automatically
[root@localhost ~]# chkconfig sshd on
Optional: not recommended -> set to prevent users from accessing via ssh and http
[root@localhost ~]# lokkit -s http -s ssh
3. Download and install GitLab 7.13.x version
3.1 Download GitLab (two ways)
[root@localhost ~]# cd /
3.1.1 curl download
[root@localhost/]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
3.1.2 wget download
[root@localhost /]# wget -c https://packages.gitlab.com/gitlab/gitlab-ce/el/6/x86_64/gitlab-ce-7.13.3-ce.1.el6.x86_64.rpm
3.2 Install GitLab (two ways)
3.2.1 yum installation
[root@localhost /]# yum -y install gitlab-ce
The entire package has more than 300 MB. If you cannot download it using yum , you can directly download the RPM package .
3.2.2 rpm installation
[root@localhost /]# rpm -ivh gitlab-ce-7.13.3-ce.1.el6.x86_64.rpm
4. Configure and start GitLab
4.1 View ip
[root@localhost /]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:DD:0E:62
inet addr:192.168.28.131 Bcast:192.168.163.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fedd:e62/64 Scope:Link
4.2 Edit configuration file
[root@localhost /]# vim /etc/gitlab/gitlab.rb
# Specify the host address (change it to your own ip here)
external_url 'http://192.168.28.131'
Note: If port 8080 is also occupied by other programs, for example, we have tomcat started . Then, we also need to modify the port of unicorn
# Also find and modify
unicorn['port'] = 18080
Optional: Modify the Gitlab data storage path
#Find git_data_dir "/var/opt/gitlab/git-data" and modify it to
git_data_dir "/gitlab"
#It is possible that the data storage path of the configuration file is like this,
#git_data_dirs({ "default" => { "path" => "/var/opt/gitlab/git-data" } }) 修改为
git_data_dirs({ "default" => { "path" => "/gitlab } })
4.3 After modifying the configuration file, you need to reload
[root@localhost /]# gitlab-ctl reconfigure
4.4 Start GitLab
[root@localhost /]# gitlab-ctl start
5. Log in to GitLab
5.1 Open the browser and enter ip:18080
http://192.168.28.131:18080
5.2 root administrator login
Account: root
Initial password: 5iveL!fe
6. Reset root account password
6.1 Obtain user data and modify user password. <Red is for input>
[root@localhost /]# gitlab-rails console production Loading production environment (Rails 4.2.5.2) irb(main):001:0> user = User.where(id: 1).first => #<User id: 1, email: "[email protected]", encrypted_password: "$2a$10$Ig35HkpOYVnOHepZNsFsaO1H7Uq 4eUIx2o8CWWPYGfk...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: n il, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_si gn_in_ip: nil, created_at: "2018-01-26 09:12:32", updated_at: "2018-01-26 09:12:32", name: "Administr ator", admin: true, projects_limit: 10000, skype: "", linkedin: "", twitter: "", authentication_token : "Zz4KYrJXqGh7-PHtMzv1", theme_id: 2, bio: nil, failed_attempts: 0, locked_at: nil, username: "root", can_create_group: true, can_create_team: false, state: "active", color_scheme_id: 1, notification_leve l: 1, password_expires_at: "2018-01-26 09:12:31", created_by_id: nil, last_credential_check_at: nil, a vatar: nil, confirmation_token: nil, confirmed_at: "2018-01-26 09:12:32", confirmation_sent_at: "2018- 01-26 09:12:32", unconfirmed_email: nil, hide_no_ssh_key: false, website_url: "", github_access_token: nil, gitlab_access_token: nil, notification_email: "[email protected]", hide_no_password: false, passw ord_automatically_set: false, bitbucket_access_token: nil, bitbucket_access_token_secret: nil, locatio n: nil, encrypted_otp_secret: nil, encrypted_otp_secret_iv: nil, encrypted_otp_secret_salt: nil, otp_r equired_for_login: false, otp_backup_codes: nil, public_email: "", dashboard: 0, project_view: 0> irb(main):002:0> user.password=12345678 => 12345678 irb(main):003:0> user.password_confirmation=12345678 => 12345678 irb(main):004:0> user.save! => true irb(main):005:0> quit
7. Configuration requirements, precautions and instructions
Configuration requirements:
- cpu: 2 cores support 500 users, which is also the officially recommended minimum standard.
- Memory: 4GB physical memory supports 100 users, which is also the officially recommended configuration.
Precautions:
Port 8080 is occupied by Tomcat, and a 502 page will appear.
Description: this use
Operating System: CentOS 6.8 64-bit
GitLab version: 7.13.3
Next: GitLab 7.13.x Installation and Configuration <2>--Linux
https://my.oschina.net/u/3209432/blog/1613898