Gitlab Perfect Installation "CentOS6.5 installation gitlab-6.9.2"

Source: Internet
Author: User
Tags ldap

Summary: After a few days of demolition, and finally found today the rapid installation of Gitlab method. CentOS6.5 installation gitlab-6.9.2

Reference URL: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#installation

Install version Gitlab: 6.9.2
RPM Release file name: gitlab-6.9.2_omnibus.1-1.el6.x86_64.rpm

Installation Step Code:
#sudo Yum Install Openssh-server
#sudo yum install postfix # SendMail or Exim is also OK
#sudo Rpm-i gitlab-6.9.2_omnibus.1-1.el6.x86_64.rpm # This is the. RPM Downloaded
#sudo Gitlab-ctl Reconfigure
#sudo lokkit-s http-s SSH # Open up the firewall for HTTP and SSH requests

Ok!
#sudo gitlab-ctl status; #查看安装后的程序运行情况! The output is as follows:

Run:nginx: (PID 3012) 53s; Run:log: (PID 3011) 53s
Run:postgresql: (PID 2857) 87s; Run:log: (PID 2856) 87s
Run:redis: (PID 2759) 98s; Run:log: (PID 2758) 98s
Run:sidekiq: (PID 2967) 60s; Run:log: (PID 2966) 60s
Run:unicorn: (PID 2938) 66s; Run:log: (PID 2937) 66s

Indicates that the installation was successful.

Access via browser: http://localhost or HTTP://IP


Input: ROOT/5IVEL!FE login!
OK, login success, the first login need to change the password, I modified to: 12345678, and then re-login, you can start the Gitlab trip.
Configuration:
sudo mkdir-p/etc/gitlab
sudo touch/etc/gitlab/gitlab.rb
sudo chmod 600/etc/gitlab/gitlab.rb

Configuring the external URL for GitLab:

Add to:/etc/gitlab/gitlab.rb file:
External_url "Http://gitlab.example.com"

After changing the configuration, execute the following command (load configuration takes effect):
sudo gitlab-ctl reconfigure

The service opens, shuts down, restarts:
# Start All GITLAB components
sudo gitlab-ctl start

# Stop All GITLAB components
sudo gitlab-ctl stop

# Restart All GITLAB components
sudo gitlab-ctl restart

Start well, pay attention to the firewall.


Unloading:

# Stop Gitlab and remove its supervision process
sudo gitlab-ctl Uninstall

# Debian/ubuntu
sudo dpkg-r Gitlab

# Redhat/centos
sudo rpm-e Gitlab

=============================================================================================================== ==============
Official Complete Installation Guide:
=============================================================================================================== ==============
GitLab Omnibus Project

This is Project creates Full-stack platform-specific downloadable packages for GitLab. For other installation options, see the GitLab project README.
Documentation version

Please make sure viewing the documentation for the version of Omnibus-gitlab you is using. Cases this should is the highest numbered stable branch (example shown below).

Installation

Download the package and follow the steps below.
Ubuntu 12.04

sudo apt-get install Openssh-server
sudo apt-get install postfix # SendMail or Exim is also OK
sudo dpkg-i Gitlab_x.y.z-omnibus-x.ubuntu.12.04_amd64.deb # This is the. Deb downloaded
sudo gitlab-ctl reconfigure
Debian 7.4

sudo apt-get install Openssh-server
sudo apt-get install Exim4-daemon-light
sudo dpkg-i Gitlab-x.y.z.deb # This is the. Deb downloaded
sudo gitlab-ctl reconfigure
During the Exim installation you may follow http://alexatnet.com/references/server-setup-debian/ Send-only-mail-server-with-exim to ensure you get a secure mailserver
CentOS 6.5

sudo yum install Openssh-server
sudo yum install postfix # SendMail or Exim is also OK
sudo rpm-i gitlab-x.y.z_omnibus-x.el6.x86_64.rpm # This is the. RPM You downloaded
sudo gitlab-ctl reconfigure
sudo lokkit-s http-s ssh # Open up the firewall for HTTP and SSH requests
After installation

Run sudo gitlab-ctl status; The output should:
Run:nginx: (PID 972) 7s; Run:log: (PID 971) 7s
Run:postgresql: (PID 962) 7s; Run:log: (PID 959) 7s
Run:redis: (PID 964) 7s; Run:log: (PID 963) 7s
Run:sidekiq: (PID 967) 7s; Run:log: (PID 966) 7s
Run:unicorn: (PID 961) 7s; Run:log: (PID 960) 7s
Your GitLab instance should reachable over HTTP at the IP or hostname of Your server. You can login as a Admin user with username root and password 5ivel!fe.
Common installation Problems

GitLab is unreachable in my browser

Try specifying an External_url in/etc/gitlab/gitlab.rb. Also check your firewall settings; Port (HTTP) or 443 (HTTPS) might is closed on your GITLAB server.
Reconfigure freezes at Ruby_block[supervise_redis_sleep] action run

This happens when runit have not been installed succesfully during Gitlab-ctl reconfigure. The most common cause for a failed Runit installation are installing Omnibus-gitlab on an unsupported platform. solution:double Check the download page whether you downloaded a package for the correct operating system.
TCP ports for GITLAB services is already taken

By default, the services in Omnibus-gitlab is using the following TCP Ports:redis (6379), PostgreSQL (5432) and Unicorn (8080) listen on 127.0.0.1. Nginx listens on port up (HTTP) and/or 443 (HTTPS) on all interfaces.
The ports for Redis, PostgreSQL and Unicorn can overriden in/etc/gitlab/gitlab.rb as follows:
redis[' port '] = 1234
postgresql[' port '] = 2345

# due to a bug https://gitlab.com/gitlab-org/omnibus-gitlab/issues/141
# you had to provide the port for Gitlab shell as well,
# so the 2 following lines has to point to the same port
unicorn[' port '] = 3456
gitlab_rails[' internal_api_url '] = ' http://localhost:3456 '
For Nginx port changes, see the sections on enabling HTTPS below.
Uninstalling Omnibus-gitlab

To uninstall Omnibus-gitlab, preserving your data (repositories, database, configuration), run the following commands.
# Stop Gitlab and remove its supervision process
sudo gitlab-ctl Uninstall

# Debian/ubuntu
sudo dpkg-r Gitlab

# Redhat/centos
sudo rpm-e Gitlab
Updating

Instructions for updating your Omnibus installation and upgrading from a manual installation is in the update doc.
Starting and stopping

After Omnibus-gitlab is installed and configured, your server would have a Runit service directory (RUNSVDIR) process Runni  Ng that gets started at boot Via/etc/inittab or the/etc/init/gitlab-runsvdir.conf upstart resource. You should not having to deal with the runsvdir process directly; You can use the Gitlab-ctl front-end instead.
You can start, stop or restart GitLab and all of their components with the following commands.
# Start All GITLAB components
sudo gitlab-ctl start

# Stop All GITLAB components
sudo gitlab-ctl stop

# Restart All GITLAB components
sudo gitlab-ctl restart
Note that on a single-core server it could take the up to a minute to restart Unicorn and Sidekiq. Your GitLab instance would give a 502 error until Unicorn is up again.
It is the also possible to start, the stop or restart individual components.
sudo gitlab-ctl restart Sidekiq
Unicorn supports Zero-downtime reloads. These can triggered as follows:
sudo gitlab-ctl hup Unicorn
Note that you cannot use a Unicorn reload to update the Ruby runtime.
Configuration

Creating the GITLAB.RB configuration file

sudo mkdir-p/etc/gitlab
sudo touch/etc/gitlab/gitlab.rb
sudo chmod 600/etc/gitlab/gitlab.rb
Below Several examples is given for settings in/etc/gitlab/gitlab.rb. Please restart the made a change.
Configuring the external URL for GitLab

In order for GitLab to display correct repository clones links to your users it needs to know the URL under which it's Rea Ched by your users, e.g. http://gitlab.example.com. Add the following line to/etc/gitlab/gitlab.rb:
External_url "Http://gitlab.example.com"
Run sudo gitlab-ctl reconfigure for the change to take effect.
Storing Git data in an alternative directory

By default, Omnibus-gitlab stores Git repository data in/var/opt/gitlab/git-data. You can change this to adding the following line to/etc/gitlab/gitlab.rb.
Git_data_dir "/mnt/nas/git-data"
Run sudo gitlab-ctl reconfigure for the change to take effect.
Changing the name of the Git User/group

By default, Omnibus-gitlab uses the user name git for git gitlab-shell login, ownership of the GIT data itself, and SSH URL generation on the Web interface. Similarly, git group is used for group ownership of the Git data.  you can change the user and group by adding the FO Llowing lines to/etc/gitlab/gitlab.rb.
user[' username '] = "Gitlab"
user[' group '] = "Gitlab"
Run sudo gitlab-ctl reconfigure for the change to take Effe Ct.
Setting up LDAP sign-in

If you have a LDAP directory service such as Active directory, you can configure GitLab so the your users can sign in With their LDAP credentials. Add the following to/etc/gitlab/gitlab.rb, edited for your server.
# These settings is documented in + detail at
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/ config/gitlab.yml.example#l118
gitlab_rails[' ldap_enabled '] = True
gitlab_rails[' ldap_host '] = ' hostname of LDAP server '
gitlab_rails[' ldap_port '] = 389
gitlab_rails[' ldap_uid '] = ' sAMAccountName '
gitlab_rails[' Ldap_method '] = ' plain ' # ' SSL ' or ' plain '
gitlab_rails[' ldap_bind_dn '] = ' cn=query user,cn=users,dc=mycorp,dc=com ' br>gitlab_rails[' ldap_password ' = ' query user password '
gitlab_rails[' ldap_allow_username_or_email_login '] = True
gitlab_rails[' ldap_base '] = ' dc=mycorp,dc=com '

# GitLab Enterprise Edition only
gitlab_rails[' ldap_group_base ' = ' # Example: ' ou=groups,dc=mycorp,dc=com '
gitlab_rails[' ldap_user_filter ' = ' # Example: ' (memberof=cn=my department,ou=groups,dc=mycorp,dc=com) '
Run sudo gitlab-ctl reconfigure for the LDAP settings to take effect.
Enable HTTPS

By default, Omnibus-gitlab runs does is not a use HTTPS. If you want to enable HTTPS can add the following line to/etc/gitlab/gitlab.rb.
External_url "Https://gitlab.example.com"
Redirect HTTP requests to HTTPS.
External_url "Https://gitlab.example.com"
nginx[' Redirect_http_to_https ') = True
Change the default port and the SSL certificate locations.
External_url "https://gitlab.example.com:2443"
nginx[' ssl_certificate '] = "/ETC/GITLAB/SSL/GITLAB.CRT"
nginx[' ssl_certificate_key '] = "/etc/gitlab/ssl/gitlab.key"
Create The default SSL certifcate directory and add the files:
sudo mkdir-p/etc/gitlab/ssl && sudo chmod 700/etc/gitlab/ssl
sudo cp gitlab.example.com.crt gitlab.example.com.key/etc/gitlab/ssl/
# run Lokkit to open HTTPS on the firewall
sudo lokkit-s HTTPS
# If you is using a non standard HTTPS port
sudo lokkit-p 2443:tcp
Run sudo gitlab-ctl reconfigure for the change to take effect.
changing gitlab.yml settings

Some of GitLab ' s features can be customized through GITLAB.YML. If you are want to the change a gitlab.yml setting with Omnibus-gitlab, you need to does so via/etc/gitlab/gitlab.rb. The translation works as follows.
In Gitlab.yml, you'll find structure like this:
Production: &base
Gitlab
Default_projects_limit:10
In gitlab.rb, this translates to:
gitlab_rails[' gitlab_default_projects_limit '] = 10
What the happens here is the We forget about production: &base, and join Gitlab:with Default_projects_limit:into Gitlab _default_projects_limit. Note that the GITLAB.YML settings can be changed via gitlab.rb yet;  See the Gitlab.yml ERB template. If you think an attribute are missing please create a merge request on the Omnibus-gitlab repository.
Run sudo gitlab-ctl reconfigure for changes on GITLAB.RB to take effect.
Do not edit the generated file in/var/opt/gitlab/gitlab-rails/etc/gitlab.yml since it'll be overwritten on the next git Lab-ctl reconfigure run.
Specify numeric user and group identifiers

Omnibus-gitlab creates users for Gitlab, PostgreSQL and Redis. You can specify the numeric identifiers for these users in/etc/gitlab/gitlab.rb as follows.
user[' uid '] = 1234
user[' gid '] = 1234
postgresql[' uid '] = 1235
postgresql[' gid '] = 1235
redis[' uid '] = 1236
redis[' gid '] = 1236
Storing user attachments on Amazon S3

Instead of using local storage you can also store, the user attachments for your GitLab instance on Amazon S3.
This currently only works if packaging a forked version of GitLab.
#/etc/gitlab/gitlab.rb
gitlab_rails[' aws_enable ') = True
gitlab_rails[' aws_access_key_id '] = ' Akia1111111111111ua '
gitlab_rails[' aws_secret_access_key '] = ' secret '
gitlab_rails[' aws_bucket '] = ' my_ Gitlab_bucket '
gitlab_rails[' aws_region '] = ' us-east-1 '
sending application email via SMTP

If you would rather send e-mail via an SMTP server instead of via Sendmail, add the following configuration information TO/ETC/GITLAB/GITLAB.RB and run Gitlab-ctl reconfigure.
gitlab_rails[' smtp_enable '] = True
gitlab_rails[' smtp_address '] = "smtp.server"
gitlab_rails[' Smtp_port ' ] = 456
gitlab_rails[' smtp_user_name '] = "SMTP user"
gitlab_rails[' smtp_password '] = "smtp Password"
Gitlab_ rails[' smtp_domain ' = "example.com"
gitlab_rails[' smtp_authentication '] = "Login"
gitlab_rails[' smtp_enable _starttls_auto '] = True
Omniauth (Google, Twitter, GitHub login)

Omniauth configuration is documented on doc.gitlab.com. To effect the necessary changes in GITLAB.YML, use the following syntax in/etc/gitlab/gitlab.rb. Note that the providers is specified as an array of Ruby hashes.
gitlab_rails[' omniauth_enabled ') = True
gitlab_rails[' omniauth_providers ' = [
{
"Name" = "Google_oauth2",
"app_id" = "YOUR app id",
"App_secret" = "YOUR app secret",
"Args" = "Access_type" + "Offline", "Approval_prompt" and ""}
}
]
Backups

Creating an application backup

To create a backup of your repositories and GitLab metadata, run the following command.
sudo gitlab-rake gitlab:backup:create
This would store a tar file in/var/opt/gitlab/backups. The filename would look like 1393513186_gitlab_backup.tar, where 1393513186 is a timestamp.
Scheduling a backup

To schedule a cron job this backs up your repositories and GitLab metadata, use the root user:
sudo su-
Crontab-e
There, add the following line to schedule the backup for everyday at 2 AM:
0 2 * * */opt/gitlab/bin/gitlab-rake gitlab:backup:create
Restoring an application backup

We'll assume that's installed GitLab from the omnibus package and run sudo gitlab-ctl reconfigure at least once.
First make sure your backup tar file is in/var/opt/gitlab/backups.
sudo cp 1393513186_gitlab_backup.tar/var/opt/gitlab/backups/
Next, restore the backup by running the RESTORE command. You need to specify the timestamp of the backup is restoring.
# Stop processes that is connected to the database
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop Sidekiq

# DROP the current DATABASE; Workaround for a Postgres backup restore bug in GitLab 6.6
Sudo-u gitlab-psql/opt/gitlab/embedded/bin/dropdb gitlabhq_production
# This command would overwrite the contents of your GitLab database!
sudo gitlab-rake gitlab:backup:restore backup=1393513186

# Start GitLab
sudo gitlab-ctl start
If There is a GitLab version mismatch between your backup tar file and the installed version of GitLab, the restore Comman D'll abort with an error. Install a package for the required version and try again.
Invoking Rake Tasks

To invoke a GitLab Rake task, use Gitlab-rake. For example:
sudo gitlab-rake Gitlab:check
Contrary to with a traditional GitLab installation, there are no need to change the user or the RAILS_ENV environment Varia ble This is a taken care of by the Gitlab-rake wrapper script.
Directory structure

Omnibus-gitlab uses four different directories.
/opt/gitlab holds application code for Gitlab and its dependencies.
/var/opt/gitlab holds application data and configuration files, Gitlab-ctl reconfigure writes to.
/etc/gitlab holds configuration files for Omnibus-gitlab. These is the only files, so you should ever has to edit manually.
/var/log/gitlab contains all log data generated by the components of the Omnibus-gitlab.
Starting a Rails console session

If you need access to a Rails production console for your GitLab installation you can start one with the command below. Please be warned that it's very easy-to-inadvertently modify, corrupt or destroy data from the console.
Sudo/opt/gitlab/bin/gitlab-rails Console
This would only be after you has run Gitlab-ctl reconfigure at least once.
Using a MySQL database Management Server (Enterprise Edition only)

If you want to use MySQL and is using the GitLab Enterprise Edition packages Please do the following:
Important note:if You is connecting Omnibus-gitlab to an existing Gitlab database you should create a backup before Atte Mpting this procedure.
Create a user and database for GitLab

First, set up your database server according to the upstream GitLab instructions. If you want to keep using a existing GitLab database can skip this step.
Configure Omnibus-gitlab to connect to it

Next, we add the following settings to/etc/gitlab/gitlab.rb.
# Disable the built-in Postgres
postgresql[' Enable '] = False

# Fill in the values for DATABASE.YML
gitlab_rails[' db_adapter '] = ' mysql2 '
gitlab_rails[' db_encoding '] = ' UTF8 '
gitlab_rails[' db_host '] = ' 127.0.0.1 '
gitlab_rails[' db_port ' = ' 3306 '
gitlab_rails[' db_username ' = ' git '
gitlab_rails[' db_password '] = ' password '
Parameters such as Db_adapter correspond to adapter in DATABASE.YML; See the upstream GitLab for a MySQL configuration example. We remind you that/etc/gitlab/gitlab.rb should has a file permissions 0600 because it contains plaintext passwords.
Run sudo gitlab-ctl reconfigure for the change to take effect.
Seed the database (fresh installs only)

Omnibus-gitlab would not automatically seed your external database. Run the following command to import the schema and create the first Admin user:
sudo gitlab-rake gitlab:setup
This is a destructive command; Do not run it in an existing database!
Using a non-packaged PostgreSQL database Management Server

If you don't want to use the packaged Postgres server can configure a external one similar to configuring a MySQL Server (shown above). Configuring a PostgreSQL server is possible both with GitLab Community Edition and Enterprise Edition packages. Please see the upstream GitLab for a PostgreSQL configuration example.
Building your own package

See the separate build documentation.
Running a custom GitLab version

It is not recommended to make changes to any of the files In/opt/gitlab after installing Omnibus-gitlab:they would either Conflict with or is overwritten by the future updates. If you want to run a custom version of GitLab you can build your own the package or use another installation method.
Acknowledgments

Gitlab Perfect Installation "CentOS6.5 installation gitlab-6.9.2"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.