gitlab 安装_GitLab安装教程

1d1dd6c31731e90992e4da13423e4dd9.png

1. 首先需要一台Linux的服务器,并进行系统预配置工作

1.1 进行服务器防火墙的关闭操作

# 关闭防火墙 systemctl stop firewalld    # 禁止开机启动 systemctl disable firewalld 

7e6eb272ee58246133fb1b380d390b54.png

1.2 关闭SELINUX并重启系统

# 该配置调整为 disabled 

7e6eb272ee58246133fb1b380d390b54.png

2. 安装Omnibus Gitlab-ce package (必要的插件的集合版本)

2.1 安装gitlab依赖的组件

sudo yum -y install curl policycoreutils openssh-server openssh-clients postfix

7e6eb272ee58246133fb1b380d390b54.png

2.2 配置YUM仓库

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

7e6eb272ee58246133fb1b380d390b54.png

2.3 添加启动 postfix邮件服务

systemctl start postfix && systemctl enable postfix

7e6eb272ee58246133fb1b380d390b54.png

2.4 安装Gitlab-ce 社区版本

yum install -y gitlab-ce

7e6eb272ee58246133fb1b380d390b54.png

3. 在安装完毕GitLab-CE 后,进行后续的配置工作

3.1 创建gitlab 证书 (openssl 详细使用介绍)

# 创建目录 sudo mkdir -p /etc/gitlab/ssl 
# 创建秘钥 
sudo openssl genrsa -out "/etc/gitlab/ssl/gitlab.examle.com.cn.key"  2048  
sudo openssl req -new -key "/etc/gitlab/ssl/gitlab.examle.com.cn.key" -out  
"/etc/gitlab/ssl/gitlab.examle.com.cn.csr"  
# 根据指示填写秘钥生成内容 
You are about to be asked to enter information that will be incorporated into your certificate request. 
What you are about to enter is what is called a Distinguished Name or a DN. 
There are quite a few fields but you can leave some blank For some fields 
there will be a default value, If you enter '.', the field will be left blank. 
----- Country Name (2 letter code) [XX]:cn State or Province Name (full name) []:biejing 
Locality Name (eg, city) [Default City]:beijing 
Organization Name (eg, company) [Default Company Ltd]: 
Organizational Unit Name (eg, section) []: 
Common Name (eg, your name or your server's hostname) []:gitlab.******.com 
Email Address []:*********@qq.com  Please enter the following 'extra' 
attributes to be sent with your certificate request A challenge password []:123456789 
An optional company name []:admin  sudo openssl x509 -req -days 365 -in "/etc/gitlab/ssl/gitlab.examle.com.cn.csr" - signkey "/etc/gitlab/ssl/gitlab.examle.com.cn.key" -out "/etc/gitlab/ssl/gitlab.examle.com.cn.crt" Signature ok subject=/C=cn/ST=biejing/L=beijing/O=Default Company Ltd/CN=gitlab.example.com.cn/emailAddress=********@qq.com Getting Private key  sudo openssl dhparam -out /etc/gitlab/ssl/dhparams.pem

7e6eb272ee58246133fb1b380d390b54.png

3.2 把创建的证书 配置到gitlab

sudo vi /etc/gitlab/gitlab.rb  
## GitLab URL ##! URL on which GitLab will be reachable. 
##! For more details on configuring external_url see: 
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab 
##! 
##! Note: During installation/upgrades, the value of the environment variable 
##! EXTERNAL_URL will be used to populate/replace this value. 
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP 
##! address from AWS. For more details, see: 
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html 
# 调整前  external_url 'http://gitlab.example.com' external_url 'https://gitlab.example.com'   
# 然后搜索包含 /redirect_http_to_https 内容的配置  
# nginx['enable'] = true # nginx['client_max_body_size'] = '250m' 
# nginx['redirect_http_to_https'] = false 
# 放开该行注释并调整属性 
nginx['redirect_http_to_https'] = true 
# nginx['redirect_http_to_https_port'] = 80  

# 继续更改 key 的地址(也就是前面生成的key)  
# nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.examle.com.cn.crt" 
# nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.examle.com.cn.key"  
# nginx['ssl_dhparam'] = nil # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem 
# 调整为之前生成的key # nginx['ssl_dhparam'] = /etc/gitlab/ssl/dhparams.pem 
# Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem # nginx['listen_addresses'] = ['*', '[::]']  
# 修改调整完进行保存退出

7e6eb272ee58246133fb1b380d390b54.png

3.3 初始化gitlab的相关配置

# 进行 gitlab 相关的应用进行初始化 

7e6eb272ee58246133fb1b380d390b54.png

4. web页面的访问

4.1 在所使用的系统中添加 host DNS 配置
4.2 在浏览器访问你所配置的域名 会出现下列页面,

15631e1894ebe4013661113232e0807e.png

7e6eb272ee58246133fb1b380d390b54.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 以下是在Windows 10上安装GitLab的详细步骤: 1. 安装必要的软件 在安装GitLab之前,需要先安装以下软件: - Ruby:GitLab是用Ruby编写的,因此需要安装Ruby环境。可以从Ruby官网下载安装包并安装。 - Git:GitLab是基于Git的,因此需要安装Git。可以从Git官网下载安装包并安装。 - PostgreSQL:GitLab使用PostgreSQL作为数据库,因此需要安装PostgreSQL。可以从PostgreSQL官网下载安装包并安装。 2. 下载GitLab安装包 可以从GitLab官网下载GitLab安装包。选择适合Windows的版本并下载。 3. 安装GitLab 双击下载的GitLab安装包,按照提示进行安装安装过程中需要设置GitLab的管理员账户和密码,以及PostgreSQL的密码等信息。 4. 启动GitLab 安装完成后,可以在Windows服务中找到GitLab服务并启动它。也可以在命令行中使用以下命令启动GitLab: ``` gitlab-ctl start ``` 5. 访问GitLab 在浏览器中输入http://localhost:808,即可访问GitLab。第一次访问时需要设置管理员账户和密码。 以上就是在Windows 10上安装GitLab的详细步骤。希望对你有帮助! ### 回答2: 在Windows 10上安装GitLab可以为开发者提供方便的版本控制和协作工具。下文将详细介绍GitLab在Windows 10上的安装过程。 1. 安装依赖项:安装GitLab需要先安装两个依赖项:OpenSSL和PostgreSQL。从官网下载安装程序并按照提示进行安装,稍等片刻即可安装完成。 2. 安装GitLab:从GitLab官网下载GitLab安装包,选择Windows版本即可。解压下载的文件,在解压后的目录中找到 “gitlab-ctl.bat” 文件,右击它并选择以管理员身份运行。 3. 修改配置文件:打开“gitlab.rb”文件并编辑其中的各项配置。例如:修改外部访问端口、更改仓库路径、设置管理员账户等等。修改后,保存文件。 4. 启动GitLab:回到cmd窗口,输入 “gitlab-ctl reconfigure” 以初始化一些必要的配置。接下来输入 “gitlab-ctl start” 以启动GitLab,稍等片刻即可。 5. 验证GitLab:在浏览器中打开 http://localhost:80 或 http://localhost:8080,看到GitLab的欢迎页面代表安装成功。 6. 进行注册:GitLab的默认管理员账户名为“root”,初始密码为“5iveL!fe”。第一次登录之后就需要修改默认密码,之后可以进行GitLab的基本设置,如安装插件和添加用户等。 通过以上步骤,就可以在Windows 10上安装并配置GitLab了。GitLab是一个功能强大,易于使用的版本控制和协作工具,能够在团队协作中大大提高开发效率。 ### 回答3: GitLab是一个开源的代码托管平台,它可以让团队协作开发、版本控制和持续集成变得更加简单和高效。在Windows 10上安装GitLab也非常容易,只需要几个简单的步骤即可完成。 1. 安装Git 首先,我们需要在Windows 10上安装Git。可以从Git官方网站(https://git-scm.com/download/win)下载安装包并进行安装。在安装过程中,我们可以选择自己喜欢的安装路径和配置选项。 2. 安装Ruby 接着,我们需要安装Ruby。可以从Ruby官方网站(https://rubyinstaller.org/downloads/)下载RubyInstaller并进行安装。在安装过程中,请务必选中“Add Ruby executables to your PATH”选项,这样可以将Ruby的可执行文件路径自动添加到系统环境变量中。 3. 安装GitLab安装Ruby后,我们可以开始安装GitLab了。可以从GitLab官方网站(https://about.gitlab.com/installation/#windows)找到对应的安装包,并下载安装。在安装过程中,需要注意以下几点: a. 安装路径:建议选择一个空闲的磁盘作为GitLab安装路径,避免因为磁盘空间不足导致问题。 b. 安装选项:在安装GitLab时,可以根据自己的需求选择安装选项,例如要不要安装PostgreSQL和Redis等组件。 c. 数据库设置:安装GitLab时需要设置数据库,可以选择使用内置的SQLite数据库,或者手动配置外部数据库,例如MySQL、PostgreSQL等。 d. 管理用户:在安装GitLab时需要设置GitLab的管理用户,这个用户可以用来登录GitLab并进行管理操作。 4. 配置GitLab 安装完成后,还需要进行一些配置操作才能让GitLab正常使用。具体配置可以参考GitLab官方网站(https://docs.gitlab.com/ee/install/configuring.html)提供的文档。需要注意的是,不同的配置选项会影响GitLab的性能、安全性和稳定性,因此需要仔细阅读并进行适当的设置。 5. 使用GitLab 完成GitLab安装和配置后,就可以开始使用它了。可以通过浏览器访问GitLab的网址,登录后就可以创建项目、管理版本、进行协作开发等操作。GitLab还提供了很多其他功能,例如持续集成、监控、安全扫描等,可以根据需要进行设置和使用。 总体来说,安装GitLab并不是一件非常复杂的事情,只需要按照上述步骤进行操作就可以了。由于GitLab是一款功能非常丰富的软件,因此需要花费一些时间和精力进行适当的配置和调试,才能发挥它的最大价值。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值