Linux搭建GitLab服务器(Centos)

工具 · 2023-11-01 · 3046 人浏览
Linux搭建GitLab服务器(Centos)

gitlab.png][1]

一、安装并配置必要的依赖关系

1、安装SSH协议

安装命令:sudo yum install -y curl policycoreutils-python openssh-server
输入安装命令
安装成功会出现如下图所示:
安装成功后

2、设置SSH服务开机自启动

配置命令:sudo systemctl enable sshd
设置SSH服务开机自启动

3、启动SSH服务

配置命令:sudo systemctl start sshd
启动SSH服务

4、安装防火墙

配置命令:sudo yum install firwalld systemd -y
安装防火墙

5、启动防火墙

配置命令:service firewalld start![image.png]
启动防火墙

6、添加HTTP服务到firewalld

配置命令:sudo firewall-cmd --permanent --add-service=http
其中pemmanent表示永久生效,若不加--permanent则系统下次启动后就会失效!
添加HTTP服务到firewalld

7、重启防火墙

配置命令:sudo systemctl reload firewalld
重启防火墙

8、安装Postfix以发送邮件

配置命令:sudo yum install postfix
安装Postfix

9、配置Postfix服务开机自启动

配置命令:sudo systemctl enable postfix
配置Postfix服务

10、安装vim编辑器和wget下载器

安装命令:sudo yum install -y vim
安装命令:sudo yum install -y wget

二、添加GitLab镜像源并安装gitlab服务

1、添加gitlab镜像

配置命令:wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.3.2-ce.0.el7.x86_64.rpm
出现如下图所示表示下载完成,接下来就可以安装Gitlab了:
添加gitlab镜像

2、安装Gitlab

安装命令:rpm -i gitlab-ce-14.3.2-ce.0.el7.x86_64.rpm
安装过程需要一些时间,等待安装后,安装成功界面如下图所示:
安装gitlab

3、修改gitlab配置文件指定服务器IP和自定义端口:

配置命令:vim /etc/gitlab/gitlab.rb
使用vim修改配置文件
进入gitlab.rb文件后,查找内容(此内容通常在文件31行)external_url 'http://IP:Port',保存并退出
修改external_url

4、将端口添加到防火墙中

配置命令:firewall-cmd --zone=public --add-port=1000/tcp --permanent
放行端口

5、重启防火墙

配置命令:sudo systemctl reload firewalld
重启防火墙

6、重置gitlab

配置命令:gitlab-ctl reconfigure
重置过程需要一些时间等待,重置成功后,最后几行的信息如下图所示:
重置gitlab

7、启动gitlab

启动命令:gitlab-ctl restart
出现如下图所示则表示启动成功:
启动gitlab

8、访问GitLab页面

访问方式:IP地址+端口号
访问gitlab页面

8.1 出现502页面,修复方法

方法:清理系统防火墙,重启系统防火墙;将内存扩大(因为gitlab非常吃内存)

8.2 出现422页面,修复方法

方法:先怀疑是邮箱配置里 stmp_domain的配置问题(/etc/gitlab/gitlab.rb文件),注释掉并刷新gitlab配置再重启(gitlab-ctl reconfigure gitlab-ctl restart)后,问题并没有解决

8.3 设置私用Gitlab密码

配置命令:gitlab-rails console -e production(根据版本的需要判断是否要加参数 -e)
查找root用户:user=User.where(id:1).first
修改root密码:user.password='密码'
保存root数据:user.save!
退出设置界面:quit
设置私用Gitlab密码
重启Gitlab:gitlab-ctl restart
重启gitlab
再使用gitlab reconfigure命令重置即可登录。
重启gitlav
itlab reconfigure命令重置即可登录

Linux 工具配置 Gitlab
取消回复
  1. Taylor_95 今天

    Purchase the https://altavillaspa.com/lady-era/ to preserve ideal feminine health easily and economically.

  2. Visit our website to order your https://ucnewark.com/product/asthalin-hfa-inhaler/ easily and swiftly.

  3. Would you suggest trying https://mnsmiles.com/vidalista/ for increasing sexual health naturally?

  4. Ordering your prescription drugs has never been easier, go to https://homegrownscholars.com/cephadex/ and discover how you can obtain your medication promptly.

  5. Unlock potential savings on eye care medication by exploring your options. Find an affordable solution at https://recipiy.com/retin-a/ . Purchase your prescription online, ensuring affordability and safety.

  6. MarkA_23 今天

    You might experience significant changes with https://midsouthprc.org/sildalis/ in several days if used consistently.

  7. Danieltoumb 今天

    Join us to explore every browse alco https://hollbarsankt.online

  8. БАНК-НЕВА - сервис для сравнения предложений по займам, который позволяет сравнивать предложения различных МФО. Мы собираем информация о займах на банковскую карту, размерах доступных займов, сроках кредитования, условиях начисления процентов и основных требованиях к заемщикам. В разделах можно найти займы под 0% для новых клиентов, предложения новых микрофинансовых организаций, варианты с лояльными требованиями, микрозаймы без платных подписок и варианты с оформлением в любое время суток. Также мы публикуем рекомендации по оформлению анкеты, разбираем распространенные причины отказа и объясняем, на что обратить внимание перед заключением договора.

    Актуальные подборки, рекомендации и материалы о микрозаймах мы также размещаем в официальном сообществе: https://vk.ru/bankneyva. Мы стремимся - упростить сравнение предложений различных МФО с учетом срока, процентной ставки и итоговой суммы возврата. При этом мы сами не выдаем займы, не являемся микрофинансовой организацией или кредитором и не принимаем решение об одобрении заявки. Оформление происходит непосредственно на сайте выбранной МФО, которая проводит проверку клиента и самостоятельно решает вопрос о выдаче средств.

  9. https://pastelink.net/aub1ewrj

  10. https://kitehurghada.ru/

  11. https://anotepad.com/note/read/xmn4s3k4

  12. Safe495 昨天

    Considering the fluctuating https://am-review.com/drug/orlijohn/ , it's worth checking out other platforms to acquire your pharmaceutical needs through the web.

  13. Having trouble with hair loss? Find solace in https://gabitzasgreenkitchen.com/item/sildenafil-lingual-strips-hiforce/ , the ultimate answer for regrowing your hair.

  14. To control hypertension, consider https://ampersandflowers.com/product/baclosign/ , a method utilized by many for better health.

  15. ASmith1 昨天

    Secure your https://chitwantigercamp.com/item/kenadion-injection/ purchase via the web for fast delivery.

  16. DMiller95 昨天

    X-plore solutions to fight against addiction; order https://homegrownscholars.com/item/mysimba/ .

  17. Purchase brand-name alternative Bentyl for gastrointestinal relief; discover at https://sadlerland.com/product/bentyl/ .

  18. RxInfo21 昨天

    Maximize your health and well-being by opting to acquire top-quality scabies treatment for effective parasite control. Secure yours today at https://ampersandflowers.com/product/fertigyn-hp/ .

  19. For individuals seeking to acquire hydroxychloroquine without a prescription, numerous websites offer it. However, it's crucial to approach these sources with caution to ensure safety and authenticity. https://livinlifepc.com/drugs/hydroxychloroquine/ offers a comprehensive guide on the way to safely buy this medication, alongside vital information on its utilization.

  20. Ever wondered how effective https://617area.com/product/tadarise-oral-jelly/ is for fluid retention