How To Install GitLab As Your Private GitHub Clone - PowerPoint PPT Presentation

About This Presentation
Title:

How To Install GitLab As Your Private GitHub Clone

Description:

In this tutorial, we will explain how to get your own GitHub instance running on your own Ubuntu 12.04 VPS. Ubuntu 12.04 is recommended because of some incompatibilities between Python and Ruby on other Linux distributions. Also, make sure you have at least 1GB RAM memory on your VPS. Our first step is to install some required packages and dependencies. Presented by VEXXHOST, provider of Openstack based public and Private Cloud Infrastructure – PowerPoint PPT presentation

Number of Views:17
Updated: 18 January 2022
Slides: 14
Provided by: VEXXHOSTPrivateCloud
Category:

less

Transcript and Presenter's Notes

Title: How To Install GitLab As Your Private GitHub Clone


1
(No Transcript)
2
  • Git is a distributed revision control and source
    code management (SCM) system with an emphasis on
    speed. Every Git working directory is a
    full-fledged repository with complete history and
    full version tracking capabilities, not dependent
    on network access or a central server. Git is
    free software distributed under the terms of the
    GNU General Public License version 2.
  • GitHub is a web-based hosting service for
    software development projects that use the Git
    revision control system. GitHub offers both paid
    plans for private repositories and free accounts
    for open-source projects.

In this tutorial, we will explain how to get your
own GitHub instance running on your own Ubuntu
12.04 VPS. Ubuntu 12.04 is recommended because of
some incompatibilities between Python and Ruby on
other Linux distributions. Also, make sure you
have at least 1GB RAM memory on your VPS. Our
first step is to install some required packages
and dependencies.
3
  • sudo apt-get update sudo apt-get install -y
    build-essential zlib1g-dev libyaml-dev libssl-dev
    libgdbm-dev libreadline-dev libncurses5-dev
    libffi-dev curl git-core openssh-server
    redis-server checkinstall libxml2-dev libxslt-dev
    libcurl4-openssl-dev libicu-dev
  • Then, we are going to install Ruby 2.0.
  • mkdir /tmp/ruby cd /tmp/ruby curl
    --progress ftp//ftp.ruby-lang.org/pub/ruby/2.0/ru
    by-2.0.0-p247.tar.gz tar xz cd
    ruby-2.0.0-p247 ./configure make sudo make
    install
  • Once it is finished, we should make sure we are
    having the required version with and we should
    get an output with the Ruby version
  • ruby version

4
  • Then, we need to install Bundler gem. Bundler
    provides a consistent environment for Ruby
    projects by tracking and installing the exact
    gems and versions that are needed. We also need
    to add a git user that will be used by GitLab.
  • sudo gem install bundler --no-ri --no-rdoc
    sudo adduser --disabled-login --gecos 'GitLab'
    git
  • Once we are done with this, our next task is to
    clone the GitLab shell from its repository and
    set the environment.
  • cd /home/git sudo -u git -H git clone
    https//github.com/gitlabhq/gitlab-shell.git cd
    gitlab-shell sudo -u git -H git checkout
    v1.7.0 sudo -u git -H cp config.yml.example
    config.yml

5
  • Now we have a local copy of the GitLab shell.
    There should be a sample config.yml file with it.
    We should open config.yml using our favourite
    text editor and edit as follows
  • gitlab_url http//yourdomain.com/
  • Once thats done, you can move on to running the
    GitLab shell installer
  • sudo -u git -H ./bin/install
  • We will use MySQL as the database backend and
    connect GitLab to it. We need to install MySQL
    database server packages first. We will be asked
    to set a password during the installation. Make
    sure you remember or write it down because we
    will need it later.
  • sudo apt-get install -y mysql-server
    mysql-client libmysqlclient-dev

6
  • Now, we should log in to MySQL, using the
    password that we set and create the required user
    and database for GitLab.
  • mysql -u root p
  • Once we enter the password, we are in the MySQL
    command prompt. We will add users, create
    databases and set the correct privileges to it.
  • CREATE USER 'gitlab'_at_'localhost' IDENTIFIED BY
    'enter-mysql-password' CREATE DATABASE IF
    NOT EXISTS gitlabhq_production DEFAULT
    CHARACTER SET utf8 COLLATE utf8_unicode_ci
    GRANT SELECT, LOCK TABLES, INSERT, UPDATE,
    DELETE, CREATE, DROP, INDEX, ALTER ON
    gitlabhq_production. TO 'gitlab'_at_'localhost
  • To make sure your new MySQL user was created
    successfully lets log in to mysql using the
    GitLab user. When youll be asked for the
    password, make sure to enter the one you selected
    above.
  • mysql -u gitlab p

7
  • If everything worked fine, we can proceed with
    the GitLab installation
  • cd /home/git sudo -u git -H git clone
    https//github.com/gitlabhq/gitlabhq.git gitlab
    cd /home/git/gitlab sudo -u git -H git checkout
    6-0-stable sudo -u git -H cp config/gitlab.yml.e
    xample config/gitlab.yml
  • Similar like we did with the GitLab shell set up
    if we have a domain configured for our VPS we
    need to edit the config.yml to use that domain.
    We should edit the file as followsgitlab
    Web server settingshost yourdomain.comport
    80https false

8
  • Now we need to execute several commands in order
    to set the proper privileges for everything we
    installed
  • cd /home/git/gitlabsudo chown -R git log/sudo
    chown -R git tmp/sudo chmod -R urwX log/sudo
    chmod -R urwX tmp/sudo -u git -H mkdir
    /home/git/gitlab-satellitessudo -u git -H mkdir
    tmp/pids/sudo -u git -H mkdir tmp/sockets/sudo
    chmod -R urwX tmp/pids/sudo chmod -R urwX
    tmp/sockets/sudo -u git -H mkdir
    public/uploadssudo chmod -R urwX
    public/uploadssudo -u git -H cp
    config/unicorn.rb.example config/unicorn.rbsudo
    -u git -H git config --global user.name
    "GitLabsudo -u git -H git config --global
    user.email "gitlab_at_localhostsudo -u git -H git
    config --global core.autocrlf inputsudo -u git
    cp config/database.yml.mysql config/database.yml

9
  • Now we need to configure GitLab to be able to
    connect to the MySQL database using the user we
    set up earlier. To do this, we need to edit
    the config/database.yml file as follows
  • production
  • adapter mysql2encoding utf8reconnect
    falsedatabase gitlabhq_productionpool
    10usernamegitlabpassword "enter-mysql-passwo
    rd
  • Once we save the file, we should change its
    access level, so the other users cant find our
    password
  • sudo -u git -H chmod o-rwx config/database.yml

10
  • Now we need to install a few gem and the final
    step (enter yes when asked)
  • cd /home/git/gitlab sudo gem install
    charlock_holmes --version '0.6.9.4 sudo -u git
    -H bundle install --deployment --without
    development test postgres aws sudo -u git -H
    bundle exec rake gitlabsetup RAILS_ENVproduction
  • If everything is installed successfully, we will
    get output similar to
  • Administrator account created
  • login.........admin_at_local.hostpassword......yo
    ur-password

11
  • Remember to change the password after the first
    login. We should set GitLab to start on server
    boot
  • sudo cp lib/support/init.d/gitlab
    /etc/init.d/gitlab sudo chmod x
    /etc/init.d/gitlab sudo update-rc.d gitlab
    defaults 21
  • In order to make sure that everything is running,
    we execute the following command. If no error
    message is displayed, we are good. We can proceed
    and start GitLab
  • sudo -u git -H bundle exec rake gitlabenvinfo
    RAILS_ENVproduction sudo service gitlab start

12
  • Now we need to install and make everything
    accessible via the web. We will use Nginx for
    this, once you install it, we copy the same
    configuration file that came with GitLab. cd
    /home/git/gitlab sudo cp lib/support/nginx/gitla
    b /etc/nginx/sites-available/gitlab sudo ln -s
    /etc/nginx/sites-available/gitlab
    /etc/nginx/sites-enabled/gitlab
  • We need to edit /etc/nginx/sites-available/gitlab 
    file to use your domain name. The setting is in
    the beginning on the file, so it should look
    similar to
  • server listen 80 default_server e.g.,
    listen 192.168.1.180 In most cases 80 is a
    good ideaserver_name yourdomain.com

13
  • You will have to put your fully qualified domain
    name instead of yourdomain.com then restart
    Nginx
  • sudo service nginx restart
  • That should be all. We have our own GitLab server
    fully functional. If we point our browser to the
    domain name we used for this installation, we
    will get the GitLab login prompt. We can log in
    with the username and provided that you used when
    installing, but we should change it right away.
    Now we can host and manage as many projects as we
    like.
Write a Comment
User Comments (0)
About PowerShow.com