gitlabのインストール

4337 ワード

1. CentOS 7


1.1準備


正式にインストールを開始する前に、パッケージを更新し、関連サービスの権限を開きます.
パッケージの更新
yum update -y

sshdのインストール
yum install -y curl policycoreutils-python openssh-server patch git

sshdを有効にして起動するには、次の手順に従います.
systemctl enable sshd
systemctl start sshd

ファイアウォールの設定vi /etc/sysctl.confファイルを開き、ファイルの最後に新しい行を追加します:(実際には最初の行を直接変更する効果も同じです)
net.ipv4.ip_forward = 1

ファイアウォールの有効化と起動:
systemctl enable firewalld
systemctl start firewalld

HTTPを開放する:
firewall-cmd --permanent --add-service=http

ファイアウォールの再起動:
systemctl reload firewalld

実際の使用では、systemctl status firewalldコマンドを使用してファイアウォールのステータスを表示できます.
postfixのインストール(オプション)
GitLabはpostfixを使用してメールを送信する必要があります.もちろん、SMTPサーバも利用できますが、具体的な手順は公式チュートリアルを参照してください.
yum install -y postfix
vi /etc/postfix/main.cfファイルを開き、119行目付近でinet_protocols = allを見つけ、allをipv 4に変更します.
inet_protocols = ipv4

postfixの有効化と起動:
systemctl enable postfix
systemctl start postfix

GitLabはリソースを消費するため、物理メモリの圧力を低減するために、交換パーティションを作成する必要があります.実際の本番環境では、サーバの構成が十分に高い場合は、交換パーティションを構成する必要はありません.
新しい4 GBサイズの交換パーティション:
dd if=/dev/zero of=/root/swapfile bs=1M count=4096

パーティションファイルをスワップするようにフォーマットして有効にします.
mkswap /root/swapfile
swapon /root/swapfile

自己有効化を追加します.vi /etc/fstabファイルを開き、ファイルの最後に新しい行を追加します.
/root/swapfile swap swap defaults 0 0

1.2 GitLabの取り付け


gitlibのダウンロード(11.1.4版)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.8.9-ce.0.el7.x86_64.rpm 
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.4.9-ce.0.el7.x86_64.rpm

https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
GitLabの取り付け
rpm -ivh gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm

GitLabの初期化
GitLabを構成するドメイン名(必須ではない)vi /etc/gitlab/gitlab.rbファイルを開き、13行目付近にexternal_url 'http://gitlab.example.com'を見つけ、引用符の内容を自分のドメイン名に変更します(プロトコルヘッダ付き、末尾にスラッシュなし)
例:
external_url 'http://148.70.1.4'

GitLabを初期化し、次のコマンドを使用してGitLabを初期化します.
sudo gitlab-ctl reconfigure

1.3漢化


gitlabソースをダウンロード:
git clone https://gitlab.com/xhang/gitlab.git

gitlabブランチまたはTagを表示します.
git branch -a 
git tag

インストールされているgitlabのバージョンを表示します.
head -1 /opt/gitlab/version-manifest.txt
cd gitlab/
git diff v11.4.9 v11.4.9-zh >../v11.4.9-zh.diff
gitlab-ctl stop
patch -d /opt/gitlab/embedded/service/gitlab-rails/ -p1 < ./v11.4.9-zh.diff
gitlab-ctl reconfigure
gitlab-ctl start

変更後gitlabにアクセスするには数時間待つ必要があります.の
管理者アカウントはrootで、gitlabに初めてアクセスするとrootアカウントのパスワードをリセットするように要求されます.

2. Ubuntu

sudo apt-get install curl openssh-server ca-certificates postfix

postfixをインストールすると、構成インタフェースが表示され、デフォルトオプションを選択します.
mailutilsをインストールし、postfixが構成に成功したかどうかをテストします.
sudo apt-get install mailutils
echo "test" | mail [email protected]

gitlabのインストール
公式ダウンロード:https://packages.gitlab.com/gitlab/gitlab-ce/
sudo dpkg -i gitlab-ce_8.8.5-ce.1_amd64.deb

gitlabの構成
sudo vi /etc/gitlab/gitlab.rb

external_url 'http://192.168.202.143'

sudo gitlab-ctl reconfigure

sudo gitlab-ctl status

管理者ユーザーrootを使用してパスワードを変更し、ログインします.
GitLab-ce 11.1.4?
漢化
https://gitlab.com/larryli/gitlab.git
https://git.coding.net/larryli/gitlab.git
https://gitlab.com/xhang/gitlab/

> git diff origin/8-8-stable origin/8-8-zh > /tmp/8.8.diff 
> cd /opt/gitlab/embedded/service/gitlab-rails/
> sudo gitlab-ctl stop
> sudo git apply /tmp/8.8.diff
> sudo gitlab-ctl start