基本准备
安装常用的工具包
linux根据操作系统的不同,有不同的安装工具,如,
操作系统 | 格式 | 工具 |
Debian | .deb | apt, apt-cache, apt-get, dpkg |
Ubuntu | .deb | apt, apt-cache, apt-get, dpkg |
CentOS | .rpm | yum |
Fedora | .rpm | dnf |
FreeBSD | Ports, .txz | make, pkg |
所以在Centos操作系统中,需要使用到的安装命令是yum。
Gitlab版本
一般我们使用CE版:gitlab community edition
版本参考:
Choose your GitLab distributionFind out the differences between the GitLab Enterprise and GitLab Community distributions so you can decide which may suit you best. Learn more!https://about.gitlab.com/install/ce-or-ee/
选择“Install Gitlab Community Edition”,然后,选择你的操作系统,这里,我用的Centos8,所以只能选择centos操作系统,官方的测试版本是Centos7,如下,
GitLab下载安装_GitLab最新中文免费版下载安装-极狐GitLab极狐GitLab中文官方网站提供GitLab最新中文版官方下载渠道,下载安装即可免费试用30天。Linux安装包已捆绑了运行极狐GitLab所需的所有服务与工具。https://about.gitlab.com/install/#centos-7
官方的安装说明有一大堆,实际上,只要做完第1,2,3点,就可以跑起来了,如下,
1. Install and configure the necessary dependencies
On CentOS 7 (and RedHat/Oracle/Scientific Linux 7), the commands below will also open HTTP, HTTPS and SSH access in the system firewall. This is an optional step, and you can skip it if you intend to access GitLab only from your local network.
sudo yum install -y curl policycoreutils-python openssh-server perl
# Enable OpenSSH server daemon if not enabled: sudo systemctl status sshd
sudo systemctl enable sshd
sudo systemctl start sshd
# Check if opening the firewall is needed with: sudo systemctl status firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
Next, install Postfix (or Sendmail) to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
During Postfix installation a configuration screen may appear. Select 'Internet Site' and press enter. Use your server's external DNS for 'mail name' and press enter. If additional screens appear, continue to press enter to accept the defaults.
————————————————
碰到的问题(1):
原文链接:CentOS8 yum安装,出现:为仓库 ‘appstream‘ 下载元数据失败_Devinfo_CN的博客-CSDN博客
错误:为仓库'appstream'下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
原因为:21年12月停止服务后,CentOS 官方已从镜像中移除CentOS8的所有包。被转移到 https://vault.centos.org。可以在 /etc/yum.repos.d 中更新一下源。
可使用 vault.centos.org 代替 mirror.centos.org。
更新命令如下(2行命令,分别执行):
# sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
# sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
然后再用yum安装包时,就能正常下载了
————————————————
碰到的问题(2):
未找到匹配的参数: policycoreutils-python
安装的时候只找到了policycoreutils,貌似也没什么影响。
2. Add the GitLab package repository and install the package
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
==>
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
Next, install the GitLab package. Make sure you have correctly set up your DNS, and change
https://gitlab.example.com
to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.
For
https://
URLs, GitLab will automatically request a certificate with Let's Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use
http://
(without the
s
).
If you would like to specify a custom password for the initial administrator user (
root
), check the documentation. If a password is not specified, a random password will be automatically generated.
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ce
EXTERNAL_URL="http://gitlab.mysite.com" yum install -y gitlab-ce
3. Browse to the hostname and login
Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in
/etc/gitlab/initial_root_password
. Use this password with username
root
to login.
See our documentation for detailed instructions on installing and configuration.
这里,我通过cat指令直接看密码,然后拷贝出来用,
cat /etc/gitlab/initial_root_password
就可以看到密码,并进行初始登陆
通常,你只需要使用你的IP地址就可以了,至于那个EXTERN_URL域名,还没弄明白怎么用;因为我也不使用域名,所以也懒得去搭理了;如果想了解的话,到网上搜索一下,例如,
端口映射访问gitlab外部URL配置经验_gitlab external_url_atlasun的博客-CSDN博客
4. Set up your communication preferences
Visit our email subscription preference center to let us know when to communicate with you. We have an explicit email opt-in policy so you have complete control over what and how often we send you emails.
Twice a month, we send out the GitLab news you need to know, including new features, integrations, docs, and behind the scenes stories from our dev teams. For critical security updates related to bugs and system performance, sign up for our dedicated security newsletter.
Important note: If you do not opt-in to the security newsletter, you will not receive security alerts.
5. Recommended next steps
After completing your installation, consider the recommended next steps, including authentication options and sign-up restrictions.
TroubleshootingManual InstallationCE or EE
本文结束。