상세 컨텐츠

본문 제목

GITLAP 설치 (GITLAB install) 및 사용법 (1/2)

Study/GIT

by 휀스 2012. 10. 19. 00:30

본문


GITLAP 설치 (GITLAB install) 및 사용법 (1/2)

GITLAP 설치 (GITLAB install) 및 사용법 (2/2)


SCM 종류 중 android 개발에 제일 많이 사용되는것이 GIT 이다.


이를 사용하는데 issue 관리 사용자 관리를 위해 보통 gerrit 을 쓴다.

하지만 gerrit 을 설치하는데 어려움이 따라서 대안으로 찾아낸 GITLAB

GITLAB 은 Ruby on Rails 를 기반으로 만들어졌다.


Ruby 리팩토링 관련 도서는 여기에서...


GITLAP의 설치는 아래에 설치 순서를 따라하면 된다. 



원본은 여기 (https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md)


설치 순서는 


1. Install packages /dependencies

2. Install ruby

3. Install Gitolite

4. Install and configure GitLab.

5. Start the web front-end

6. Start a Resque worker (for background processing)


이렇다.


sudo 명령어를 하나하나 치기 귀찮으므로.

sudo -i


# System update

apt-get update

apt-get upgrade


# Install curl and sudo // 보통 ubuntu system에 sudo 는 설치가 되어 있다

apt-get install curl sudo


1~3. Install packages /dependencies, ruby, Gitolite


# 이것저것 하지말고 이걸로 1~3 단계는 이 명령어로 끝난다.

필요한 Package 들과 ruby, gitolite 를 설치한다.


curl https://raw.github.com/gitlabhq/gitlab-recipes/master/install/debian_ubuntu.sh | sh


# 메일 설정하라고 하는데 사용하는 메일 도메인을 쓰면 된다. 메일 종류 선택 창에서 Internet site 를 선택하고myMailDomain.com 이런 식으로...



4. Clone GitLab source and install prerequisites


sudo gem install charlock_holmes --version '0.6.8'

sudo pip install pygments

sudo gem install bundler

cd /home/gitlab

sudo -H -u gitlab git clone -b stable https://github.com/gitlabhq/gitlabhq.git gitlab

cd gitlab


# Rename config files

sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml


우린 MySql 을 사용할 것이므로 (sqlite 는 DB 용량에 제한이 있다.) 아래와 같이 MySQL 을 설치한다. 설치시 MySQL root 비번을 잊지 않도록 주의한다.


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


# Login to MySQL

$ mysql -u root -p


# Create the gitlabhq production database 

# mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;

여기서 주의점은 ' 가 아니고 ` 를 사용한다는 것이다.

copy & paste 안하고 typing 하다가 이것 때문에 삽질했다. -_-;;;


# Create the MySQL User change $password to a real password

mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'password';

password 는 실제 사용하고 싶은 비번으로 설정하면 된다.


# Grant proper permissions to the MySQL User

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';


# Exit MySQL Server and copy the example config, make sure to update username/password in config/database.yml

sudo -u gitlab cp config/database.yml.example config/database.yml

여기까지 한 후에 config/database.yml 파일 내부의 id/password 부분을 세팅한 대로 변경해준다.


# Install gems

sudo -u gitlab -H bundle install --without development test sqlite postgres --deployment


# Setup database

sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production

이거 database 있다고 나온다. 

Done!

문구를 봤다면 성공.


20121009205010 PostgresCreateIntegerCast

Run rake db:migrate to update your database then try again.

오류가 났다면


sudo -u gitlab bundle exec rake db:migrate RAILS_ENV=production

를 실행하면 된다.


# Setup GitLab hooks

sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive

sudo chown git:git /home/git/.gitolite/hooks/common/post-receive


# Check application status

sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production

이거해서 빨간 글씨만 안보이면 성공.


/home/git/.gitolite/hooks/common/post-receive exists? ...... NO

라고 뜨면 sudo 권한으로 folder permission 을 준다.


sudo chmod 755 /home/git/.gitolite


5. Start Web Server


sudo -u gitlab bundle exec rails s -e production -d

-d 빼면 daemon 으로 돌지 않는다.


=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000 이라고 뜨면 


Browser에서 http://0.0.0.0:3000 라고 입력하고 엔터.


admin@local.host

5iveL!fe


으로 로그인이 가능하다.


여기까지 하면 IP 로 접속하여 GITLAB 을 사용할 준비가 끝났다.


다음엔 GITLAB 을 어떻게 사용하는지 알아보자.


GITLAP 설치 (GITLAB install) 및 사용법 (1/2)

GITLAP 설치 (GITLAB install) 및 사용법 (2/2)




관련글 더보기