Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build your own private GitHub library with GitLab

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how to use GitLab to build your own private GitHub library". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build your own private GitHub library with GitLab.

Installation dependency

Under Debian/Ubuntu:

The copy code is as follows:

Sudo apt-get install-y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate

Install python (note that version 2.5 or above is required):

Sudo apt-get install-y python python-docutils

Install git (note that version 1.7.10 or later is required):

Sudo apt-get install-y git-core

The software of the official warehouse under Centos is relatively old. It is recommended to add epel sources before installing dependencies:

The copy code is as follows:

Sudo yum install git patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel git python python-docutils

Install Ruby 2.0

Ruby2.0 needs to be installed, and Ruby 1.8 in the software repository does not support:

Mkdir / tmp/ruby & & cd / tmp/rubycurl-- progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xzcd ruby-2.0.0-p353./configure-- disable-install-rdocmakesudo make install

Install Bundler Gem:

Sudo gem install bundler-no-ri-no-rdoc

Configure gitlab-shell

To create a git user:

Sudo adduser-system-create-home-comment 'GitLab' git

Configure gitlab-shell

Su-git-c "git clone https://github.com/gitlabhq/gitlab-shell.git" su-git-c" cd gitlab-shell & & git checkout v1.3.0 "su-git-c" cp gitlab-shell/config.yml.example gitlab-shell/config.yml "sed-I" s/localhost/gitlab.51yip.com/g "/ home/git/gitlab-shell/config.yml su-git-c" gitlab-shell/bin/install "chmod 600 / home/git/.ssh / authorized_keys chmod 700 / home/git/.ssh

Database

GitLab supports MySQL and PostgreSQL databases. Taking MySQL as an example, the installation method is described below:

Use the following command to install under Debian/Ubuntu:

Sudo apt-get install-y mysql-server mysql-client libmysqlclient-dev

Use the following command under Centos:

Sudo yum install mysql-server sudo chkconfig mysqld on

Configure MySQL:

Sudo echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE' utf8_unicode_ci';" | mysql-u root sudo echo "UPDATE mysql.user SET Password=PASSWORD ('123456') WHERE User='root'; FLUSH PRIVILEGES;" | mysql-u root

Note that replace 123456 with your password.

Install and configure gitlab

Su-git-c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab" su-git-c "cd gitlab Git checkout 5-1-stable "su git-c" cp config/gitlab.yml.example config/gitlab.yml "su git-c" mkdir / home/git/gitlab-satellites "su git-c" mkdir public/uploads "su git-c" mkdir-p tmp/sockets/ "su git-c" mkdir-p tmp/pids/ "sed-I" s / host: localhost/ host: gitlab.segmentfault.com/g "config/gitlab.yml sed-I" s/from: gitlab@localhost/from: gitlab@gitlab .segmentfault.com / g "config/gitlab.yml su git-c" cp config/puma.rb.example config/puma.rb "su git-c 'git config-- global user.name" GitLab "' su git-c 'git config-- global user.email" gitlab@gitlab.segmentfault.com "'

Be careful to replace gitlab.segmentfault.com with your own content.

Configure the database connection:

Sudo su git-c "cp config/database.yml.mysql config/database.yml" sudo sed-I "root password of s/secure password/mysql / g" config/database.yml

Install the Gems required by MySQL

Sudo-u git-H bundle install-deployment-without development test postgres aws

Initialize:

Sudo-u git-H bundle exec rake gitlab:setup RAILS_ENV=productionsudo cp lib/support/init.d/gitlab / etc/init.d/gitlabsudo chmod + x / etc/init.d/gitlabsudo update-rc.d gitlab defaults 21

Check to see if it is properly configured:

Sudo-u git-H bundle exec rake gitlab:env:info RAILS_ENV=production

Restart GitLab:

Sudo service gitlab start

Configure Nginx

Under Debian/Ubuntu:

Sudo apt-get install-y nginx

Under CentOS:

Sudo yum install nginx

Download a sample configuration file:

Sudo cp lib/support/nginx/gitlab / etc/nginx/sites-available/gitlabsudo ln-s / etc/nginx/sites-available/gitlab / etc/nginx/sites-enabled/gitlab

Modify / etc/nginx/sites-available/gitlab, pay special attention to changing the YOUR_SERVER_FQDN to your own.

Restart nginx:

Sudo service nginx restart

All right, you can log in to GitLab. The default user name after installation is: admin@local.host, password 5iveLSecretfe.

At this point, I believe you have a deeper understanding of "how to use GitLab to build your own private GitHub library". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report