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

Gitlab deployment

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Configure epel source

Wget http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpmrpm-ivh epel-release-6-8.noarch.rpm

Second, install dependency packages

Yum-y install libicu-devel patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make cmake autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

Third, install git

Download link:

Wget-O git-src.zip https://github.com/git/git/archive/master.zip

[root@localhost ~] # unzip git-src.zip [root@localhost ~] # cd git-master/ [root@localhost git-master] # make prefix=/usr/local all [root@localhost git-master] # make prefix=/usr/local install [root@localhost git-master] # ln-fs / usr/local/bin/git* / usr/bin/

Fourth, install ruby

[root@localhost src] # wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.1.5.tar.gz[root@localhost src] # tar-zxf ruby-2.1.5.tar.gz [root@localhost src] # cd ruby-2.1.5 [root@localhost ruby-2.1.5] #. / configure-- disable-install-rdoc & & make & make install [root@localhost ~] # ln-s / usr/local/bin/ruby / usr/bin/ruby [root@localhost ~] # ln-s / usr/local/bin/gem / usr/bin/gem [root@localhost ~] # gem install bundler-no-ri-no-rdoc [root@localhost ~] # ln-s / usr/local/bin/bundle / usr/bin/bundle

Install mysql and initialize the gitlab library

[root@localhost ~] # yum-y install mysqlmysql-devel mysql-server [root@localhost ~] # service mysqld start [root@localhost ~] # chkconfig mysqld on [root@localhost ~] # mysqlmysql > create database gitlab;mysql > grant all privileges on gitlab.* to 'gitlab'@'localhost' identified by' gitlab'

Test whether you can log in to the database using gitlab:

[root@localhost] # mysql-u gitlab-p-D gitlabEnter password:

6. Install redis

[root@localhost ~] # yum-y install redis [root@localhost ~] # vi / etc/redis.conf 36 unixsocket / tmp/redis.sock 37 unixsocket perm 755 [root@localhost] # service redis start [root@localhost ~] # chkconfig redis on

Create git users and allow sudo

[root@localhost ~] # useradd gitecho "git ALL= (ALL) NOPASSWD: ALL" > > / etc/sudoers

8. Install gitlab

[root@localhost ~] # cd / home/git/ [root@localhost git] # sudo-u git-H git clone-b 7-8-stable gitlab [root@localhost git] # cd gitlab [root@localhost gitlab] # cp config/gitlab.yml.example config/gitlab.yml [root@localhost gitlab] # vi config/gitlab.yml 20 host: localhost 21 port: 80 267 bin_path: / usr/bin/git [root@localhost gitlab] # chown-R git log/ [root@ Localhost gitlab] # chown-R git tmp/ [root@localhost gitlab] # chmod-R u+rwX log/ [root@localhost gitlab] # chmod-R u+rwX tmp/ [root@localhost gitlab] # sudo-u git-H mkdir / home/git/gitlab-satellites [root@localhost gitlab] # sudo chmod u+rwx GroupRX root@localhost gitlab / home/git/gitlab-satellites [root@localhost gitlab] # chmod-R u+rwX tmp/pids/ [root@localhost gitlab] # chmod-R u+rwX tmp/sockets [root@localhost gitlab] # chmod-R u+rwX public/uploads/ [root@localhost gitlab] # cp config/unicorn.rb.example config/unicorn.rb [root@localhost gitlab] # cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb

Manually create directories for which the above does not exist.

Configure the database:

[root@localhost gitlab] # cp config/database.yml.mysql config/database.yml [root@localhost gitlab] # vi config/database.yml 9 database: gitlab # the database here should match the name of the library created in mysql. 10 pool: 10 11 username: gitlab 12 password: gitlab

IX. Install gitlab-shell

[root@localhost ~] # cd / home/git/ [root@localhostgit] # sudo-u git-H git clone-b v2.6.0 [root@localhostgit] # cd gitlab-shell/ [root@localhostgitlab-shell] # cp config.yml.example config.yml [root@localhostgitlab-shell] # vi config.yml 9 gitlab_url: http://localhost:8080/ 30 bin: / usr/bin/redis-cli [root@localhostgitlab-shell] # sudo-u git-H. / bin/install

10. Nginx installation

[root@localhost src] # tar-zxf pcre-8.38.tar.gz [root@localhost src] # cd pcre-8.38 [root@localhostp cre-8.38] #. / configure-- prefix=/usr/local/pcre-8.38 & & make & & make install [root@localhost src] # wget http://124.205.69.171/files/8095000002FE839E/nginx.org/download/nginx-1.8.1.tar.gz[root@localhost src] # tar-zxf nginx- 1.8.1.tar.gz [root@localhost src] # cd nginx-1.8.1 [root@localhost nginx-1.8.1] #. / configure-prefix=/usr/local/nginx-user=git-group=git--with-http_ssl_module-with-http_stub_status_module-with-pcre=/usr/local/src/pcre-8.38/ & & make & & make install

11. Install the required gems

[root@localhost ~] # cd / home/git/gitlab [root@localhost gitlab] # sudo-u git-H bundle install-- deployment-- without development testpostgres aws

12. Initialize the database

[root@localhost gitlab] # sudo-u git-H bundle exec rake gitlab:setup RAILS_ENV=production

XIII. Copy startup file script and log cutting file

[root@localhost gitlab] # cp lib/support/init.d/gitlab / etc/init.d/gitlab [root@localhost gitlab] # cp lib/support/init.d/gitlab.default.example / etc/default/gitlab [root@localhost gitlab] # cp lib/support/logrotate/gitlab / etc/logrotate.d/gitlab

14. Set up git account information

[root@localhost gitlab] # sudo-u git-H "/ usr/bin/git" config-- global user.name "GitLab" [root@localhost gitlab] # sudo-u git-H "/ usr/bin/git" config-global user.email "example@example.com" [root@localhost gitlab] # sudo-u git-H "/ usr/bin/git" config-- global core.autocrlf "input"

15. Configure nginx

[root@localhost ~] # vi / usr/local/nginx/conf/nginx.conf upstream gitlab {server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;} server {listen 80; server_name localhost; access_log / var/log/nginx/gitlab_access.log; error_log / var/log/nginx/gitlab_error.log; root / home/git/gitlab/public Location / {try_files $uri $uri/index.html $uri.html @ gitlab;} location @ gitlab {proxy_read_timeout 300; proxy_connect_timeout 300; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host Proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://gitlab; }} [root@localhost ~] # mkdir-p / var/log/nginx [root@localhost ~] # chown-R git:git/var/log/nginx/ [root@localhost ~] # chown-R git:git/ usr/local/nginx/ [root@localhost ~] # / usr/local/nginx/sbin/nginx-t [root@localhost gitlab] # service nginx restart

16. Detect the current environment

[root@localhostgitlab] # sudo-u git-H bundle exec rake gitlab:env:info RAILS_ENV=production

There may be an error: Error: Table 'gitlab.projects' doesn't exist

At this point, reinitialize the database and execute the following command:

[root@localhost gitlab] # sudo-u git-H bundle exec rake gitlab:setup RAILS_ENV=production

You will find that a login account and password are generated at the end of the execution:

Login.rootpassword.5iveLroomfe is used to log in to gitlab

Execute the environmental check command again. OK

17. Pull gitlab static resource files

[root@localhost gitlab] # sudo-u git-H bundle exec rake assets:precompile RAILS_ENV=production

18. Start gitlab

[root@localhost gitlab] # / etc/init.d/gitlab start [root@localhost gitlab] # sudo chmod-R ug+rwX,o-rwx / home/git/repositories/ [root@localhost gitlab] # sudo chmod-R ug-s / home/git/repositories/ [root@localhost gitlab] # find / home/git/repositories/-type d-print0 | sudo xargs-0 chmod gears

Check whether each component is working properly

[root@localhost gitlab] # sudo-u git-H bundle exec rake gitlab:check RAILS_ENV=production

Error 1: Send ping to redisserver: Could not connect to Redis at / tmp/redis.sock: Permission denied

[root@localhost gitlab] # vi / home/git/gitlab-shell/config.yml35 # socket: / tmp/redis.sock # Comment out thisline if you want to use TCP

Error 2: "502 Bad Gateway" appears when accessing with a browser

Specify-- user=git-- group=git when compiling nginx

[root@localhost ~] # vi/usr/local/nginx/conf/nginx.conf 2 user git

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

Database

Wechat

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

12
Report