본문 바로가기

프로그램

우분투 gerrit 설치

윈도에다가 설치를 하려고 하다가

gettit이 계정관리를 지원하지 않아 계정관리땜에 아파치도 깔아야하고

하는 김에 소규모 네트워크 환경에서 원격저장소도 한번 꾸며볼겸 

우분투에다가 설치해 봄..

 

1. apache 설치

$ sudo apt install apache2

 

2. git 설치

$ sudo apt install git

 

3. gerrit 다운로드

  https://www.gerritcodereview.com/index.html

 

Gerrit Code Review | Gerrit Code Review

Serve Git As an integrated experience within the larger code review flow. Learn More

www.gerritcodereview.com

 

4. gerrit 설치

$ java -jar gerrit-3.7.0.war init -d ~/gerrit

사용자 인증 방법은 http로 설정

나머지는 디폴트

*** User Authentication
*** 

Authentication method          [openid/?]: http

 

5. 아파치를 프록시로 쓰기 위해서 가상호스트 설정

도메인이 있다면 해당 도메인을 사용하고 아니면 새로 하나 생성(/etc/hosts)하고

우분투는 아래 파일이 아파치 설정 파일이며 아래처럼 입력..

$ sudo vim /etc/apache2/apache2.conf

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName 도메인

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    <Location /login/>
        AuthType Basic
        AuthName "Gerrit Code Review"
        Require valid-user
        AuthUserFile /etc/apache2/passwords
    </Location>

    AllowEncodedSlashes On
    
    ProxyPass / http://도메인:8080/ nocanon
    ProxyPassReverse / http://도메인:8080/
</VirtualHost>

설정파일이 문제없는지 아래처럼 확인해보면 실패가 될 수 있다.

$ apachectl configtest

AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/apache2.conf:229
AH00526: Syntax error on line 235 of /etc/apache2/apache2.conf:
Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.

아파치를 앞단의 프록시로 쓰려면 아래 모듈을 로드해야한다고 한다.

로드하고 위 테스트를 하면 통과~

$ sudo a2enmod proxy_http

Considering dependency proxy for proxy_http:
Enabling module proxy.
Enabling module proxy_http.
To activate the new configuration, you need to run:
  systemctl restart apache2
  
$ apachectl configtest
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/apache2.conf:229
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

 

6.아파치 재시작

$ sudo apachectl restart

 

7. gerrit 설정

설정파일 위치는 gerrit설치위치/etc/gerrit.config 

[gerrit]
        basePath = git
        canonicalWebUrl = http://도메인
        
...

[httpd]
        listenUrl = proxy-http://도메인:8080/

여기서 도메인에는 대문자를 쓰지마세요. gerrit 시작이 안됩니다 ㅠ

 

8. gerrit 재시작

$ gerrit설치위치/bin/gerrit.sh restart