前言
GitLab 是一个基于 Web 的 Git 仓库管理工具,提供代码托管、版本控制、CI/CD 集成和团队协作功能。本地 GitLab 指在自己的服务器或本地计算机上搭建并运行 GitLab 实例,而非使用 GitLab 提供的云服务(如 gitlab.com)。
安装gitlab
关闭防火墙
安装依赖
yum -y install curl policycoreutils-python openssh-server perl
配置邮件服务器
yum -y install postfix
systemctl enable postfix
systemctl start postfix
yum源
官方
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
国内镜像
vim /etc/yum.repos.d/gitlab-ce.repo
//添加如下内容
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
更行yum缓存
yum makecache fast
安装
yum -y install gitlab-ce
# 指定版本安装
yum -y install gitlab-ce-x.x.x
rpm安装
cd /data/tools
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.0.3-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-14.0.3-ce.0.el7.x86_64.rpm
配置url
vim /etc/gitlab/gitlab.rb
external_ur=http://192.168.56.21:8085
加载配置
gitlab-ctl reconfigure
①初始化默认管理员帐户的用户名为 root ,密码存储在
/etc/gitlab/initial_root_password 文件中,此文件将在 24 小时后的第一次重新配置运行中清除。
cat /etc/gitlab/initial_root_password
②若非必要不建议做第二次初始化,后续若有修改配置文件使用命令 gitlab-ctl restart 重启所有组件服务即可生效新的配置。
③先修改gitlab.rb文件中的“external_url”选项值,再使用“gitlab-ctl reconfigure”命令配置GitLab。就不需要在配置后修改 “
<h2><a id="_0"></a>前言</h2>
<p>GitLab 是一个基于 Web 的 Git 仓库管理工具,提供代码托管、版本控制、CI/CD 集成和团队协作功能。本地 GitLab 指在自己的服务器或本地计算机上搭建并运行 GitLab 实例,而非使用 GitLab 提供的云服务(如 gitlab.com)。</p>
<h2><a id="gitlab_4"></a>安装gitlab</h2>
<p>关闭防火墙</p>
<p>安装依赖</p>
<pre><div class="hljs"><code class="lang-shell">yum -y install curl policycoreutils-python openssh-server perl
</code></div></pre>
<p>配置邮件服务器</p>
<pre><div class="hljs"><code class="lang-shell">yum -y install postfix
systemctl enable postfix
systemctl start postfix
</code></div></pre>
<h2><a id="yum_28"></a>yum源</h2>
<p>官方</p>
<pre><code class="lang-">curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
</code></pre>
<p>国内镜像</p>
<pre><div class="hljs"><code class="lang-shell">vim /etc/yum.repos.d/gitlab-ce.repo
</code></div></pre>
<pre><code class="lang-conf">//添加如下内容
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
</code></pre>
<p>更行yum缓存</p>
<pre><div class="hljs"><code class="lang-shell">yum makecache fast
</code></div></pre>
<p>安装</p>
<pre><code class="lang-">yum -y install gitlab-ce
</code></pre>
<pre><code class="lang-"># 指定版本安装
yum -y install gitlab-ce-x.x.x
</code></pre>
<p>rpm安装</p>
<pre><code class="lang-">cd /data/tools
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.0.3-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-14.0.3-ce.0.el7.x86_64.rpm
</code></pre>
<p>配置url</p>
<pre><code class="lang-">vim /etc/gitlab/gitlab.rb
</code></pre>
<pre><div class="hljs"><code class="lang-shell">external_ur=http://192.168.56.21:8085
</code></div></pre>
<p>加载配置</p>
<pre><div class="hljs"><code class="lang-shell">gitlab-ctl reconfigure
</code></div></pre>
<p>①初始化默认管理员帐户的用户名为 root ,密码存储在</p>
<p>/etc/gitlab/initial_root_password 文件中,此文件将在 24 小时后的第一次重新配置运行中清除。</p>
<pre><div class="hljs"><code class="lang-shell">cat /etc/gitlab/initial_root_password
</code></div></pre>
<p>②若非必要不建议做第二次初始化,后续若有修改配置文件使用命令 gitlab-ctl restart 重启所有组件服务即可生效新的配置。</p>
<p>③先修改gitlab.rb文件中的“external_url”选项值,再使用“gitlab-ctl reconfigure”命令配置GitLab。就不需要在配置后修改 “</p>
留言