<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>版本管理 &#8211; Simon</title>
	<atom:link href="https://www.luisimon.com/tag/%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.luisimon.com</link>
	<description>blog</description>
	<lastBuildDate>Tue, 28 May 2024 07:19:46 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>

<image>
	<url>https://www.luisimon.com/wp-content/uploads/2019/09/cbrks-x5t4i-001.ico</url>
	<title>版本管理 &#8211; Simon</title>
	<link>https://www.luisimon.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>CentOS 7 簡單安裝GitLab（教程）</title>
		<link>https://www.luisimon.com/2020/09/19/347/</link>
		
		<dc:creator><![CDATA[Simon]]></dc:creator>
		<pubDate>Sat, 19 Sep 2020 02:46:01 +0000</pubDate>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[版本管理]]></category>
		<guid isPermaLink="false">https://www.luisimon.xyz/?p=347</guid>

					<description><![CDATA[安裝GitLab 1.安装并配置必要的依赖关系 在CentOS 7（和RedHat / Oracle / Sc ... <a title="CentOS 7 簡單安裝GitLab（教程）" class="read-more" href="https://www.luisimon.com/2020/09/19/347/" aria-label="继续阅读CentOS 7 簡單安裝GitLab（教程）">阅读更多</a>]]></description>
										<content:encoded><![CDATA[
<p><strong><em>安裝GitLab</em></strong></p>



<p><strong>1.安装并配置必要的依赖关系</strong></p>



<p>在CentOS 7（和RedHat / Oracle / Scientific Linux 7）上，以下命令还将在系统防火墙中打开HTTP和SSH访问。</p>



<pre class="wp-block-preformatted">sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd

sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
</pre>



<p> 接下来，安装Postfix发送通知邮件。如果您想使用其他解决方案发送电子邮件，请跳过此步骤并在安装GitLab后<a href="https://www.luisimon.com/goto/0s0j" rel="nofollow">配置外部SMTP服务器</a>。（不发邮件的话这步可以跳过） </p>



<p><strong> 2.添加GitLab软件包存储库并安装软件包 </strong></p>



<p>如果想手动安装的可以到以下地址下载，国内比较快奥</p>



<p><a href="https://www.luisimon.com/goto/6fhl" rel="nofollow">https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/</a></p>



<p><strong> gitlab 分为gitlab-ce和gitlab-ee，我们要安装ce社区版<br>gitlab-ce是社区版，免费的<br>gitlab-ee是企业版，收费的 </strong></p>



<p>添加GitLab软件包存储库。</p>



<p>curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash</p>



<p><strong>如果要使用国内源</strong></p>



<pre class="wp-block-code"><code>vim /etc/yum.repos.d/gitlab_gitlab-ce.repo</code></pre>



<pre class="wp-block-code"><code>&#91;gitlab-ce]
name=gitlab-ce
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key</code></pre>



<pre class="wp-block-code"><code>vim /etc/yum.repos.d/gitlab_gitlab-ee.repo</code></pre>



<pre class="wp-block-code"><code>&#91;gitlab-ee]
name=gitlab-ee
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el$releasever/
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key</code></pre>



<p>接下来，安装GitLab软件包。将`http://gitlab.example.com`更改为您想要访问您的GitLab实例的URL。安装将自动在该URL处配置并启动GitLab。安装后HTTPS需要<a href="https://www.luisimon.com/goto/fix2" rel="nofollow">额外的配置</a>。</p>



<p>sudo EXTERNAL_URL=&#8221;http://gitlab.example.com&#8221; yum install -y gitlab-ce</p>



<p>第一次访问时，您将被重定向到密码重置屏幕。提供初始管理员帐户的密码，您将被重定向回登录屏幕。使用默认帐户的用户名root登录。 </p>



<p><strong>4.安装过程中问题处理</strong></p>



<p>执行到&nbsp;sudo EXTERNAL_URL=&#8221;http://gitlab.example.com&#8221; yum install -y gitlab-ce 这个步骤的时候，很大可能被卡死。</p>



<p><em>解决方案：</em></p>



<p><em>1、没关系上趟厕所多等一会（10分钟）<br>2、按住CTRL+C强制结束<br>3、运行：sudo systemctl restart gitlab-runsvdir<br>4、再次执行：sudo gitlab-ctl reconfigure</em></p>



<h4 class="wp-block-heading"><strong>如果访问时报，502 错误</strong></h4>



<p>解决方案：<br></p>



<p>可能性一<br>是unicorn服务与tomcat端口冲突，配置下unicorn使用端口应该就可以了<br>vi /etc/gitlab/gitlab.rb<br>unicorn[&#8216;port&#8217;] = 9090<br></p>



<p>再gitlab-ctl reconfigure 重启配置，然后稍等一会，在访问，这样GitLab服务器就可以正常运行了。</p>



<p><strong>安装/启动postfix的时候报错：</strong></p>



<pre class="wp-block-preformatted"> [root@&nbsp;~]#&nbsp;systemctl&nbsp;start&nbsp;postfix&nbsp;&nbsp;
Job&nbsp;for&nbsp;postfix.service&nbsp;failed&nbsp;because&nbsp;the&nbsp;control&nbsp;process&nbsp;exited&nbsp;with&nbsp;error&nbsp;code.&nbsp;See&nbsp;"systemctl&nbsp;status&nbsp;postfix.service"&nbsp;and&nbsp;"journalctl&nbsp;-xe"&nbsp;for&nbsp;details.&nbsp; </pre>



<p>解决方法：</p>



<pre class="wp-block-preformatted">#修改&nbsp;/etc/postfix/main.cf的设置&nbsp;
inet_protocols&nbsp;=&nbsp;ipv4
inet_interfaces&nbsp;=&nbsp;all</pre>



<p><strong>5.GitLab常用命令</strong></p>



<pre class="wp-block-preformatted">sudo gitlab-ctl start                  # 启动所有 gitlab 组件；
sudo gitlab-ctl stop &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# 停止所有 gitlab 组件；
sudo gitlab-ctl restart&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 重启所有 gitlab 组件；
sudo gitlab-ctl status &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;# 查看服务状态；
sudo gitlab-ctl reconfigure &nbsp; &nbsp; &nbsp; &nbsp; # 启动服务；
sudo vim /etc/gitlab/gitlab.rb &nbsp; &nbsp; &nbsp;# 修改默认的配置文件；
gitlab-rake gitlab:check SANITIZE=true --trace &nbsp; &nbsp;# 检查gitlab；
sudo gitlab-ctl tail &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# 查看日志；</pre>



<h4 class="wp-block-heading">完全卸载GitLab</h4>



<p>一、停止gitlab<br> sudo gitlab-ctl stop<br>二、卸载gitlab（这块注意了，看看是gitlab-ce版本还是gitlab-ee版本，别写错误了）<br> sudo rpm -e gitlab-ce<br></p>



<p>三、查看gitlab进程</p>



<p> ps -ef|grep gitlab<br>　 &nbsp; &nbsp;杀掉第一个守护进程(runsvdir -P /opt/gitlab/service log)<br>　 &nbsp; &nbsp;kill -9 4473<br>　 &nbsp; &nbsp;再次查看gitlab进程是否存在<br></p>



<p>四、删除gitlab文件</p>



<p>       <strong> find / -name *gitlab*|xargs rm -rf      # 删除所有包含gitlab的文件及目录</strong></p>



<p>      <strong>  find / -name gitlab |xargs rm -rf </strong><br></p>



<p>删除gitlab-ctl uninstall时自动在root下备份的配置文件（ls /root/gitlab* 看看有没有，有也删除）通过以上几步就可以彻底卸载gitlab </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
