可以按官网的安装或者以下步骤:
rpm 包下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
安装依赖:
[root@larwas ~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python//10.x以后开始依赖policycoreutils-python
安装 gitlab:
rpm -ivh gitlab-ce-XXXX.x86_64.rpm
安装成功显示:
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab 配置(/etc/gitlab/gitlab.rb) 监听域名或端口:
...
external_url 'http://gitlab.larwas.com'
...
nginx['listen_port'] = 82
...
使用gitlab-ctl reconfigure 自动配置:
[root@larwas ~]# gitlab-ctl reconfigure
启动 gitlab 服务:
[root@larwas ~]# gitlab-ctl start
浏览器输入配置的监听域名即可使用,首次访问需要修改密码,直接输入2次新密码即可使用 root 用户登录。
要使用 jenkins 自动化部署 PHP 代码,需要服务器安装 git 。
这里可借鉴:https://blog.csdn.net/wxy540843763/article/details/80197301
jenkins 必须有 jdk 8 以上版本才能使用,下载:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
我这里直接下载 jdk-8u201-linux-x64.rpm ,后通过rpm -ivh jdk-8u201-linux-x64.rpm
安装。
下载 rpm 包:https://pkg.jenkins.io/redhat-stable/
执行rpm -ivh 包名
安装。
启动/停止/重启服务:service jenkins start/stop/restart
/usr/lib/jenkins/jenkins.war WAR包
/etc/sysconfig/jenkins 配置文件
/var/lib/jenkins/ 默认的JENKINS_HOME目录
/var/log/jenkins/jenkins.log Jenkins日志文件
[root@larwas ~]# vim /etc/sysconfig/jenkins
JENKINS_PORT="8910"
安装完成访问:http://ip:端口号即可
出现此异常说明没有找到 java 目录下的 bin 目录,解压不了jenkins.war
解决如下:
[root@larwas ~]# vim /etc/init.d/jenkins
# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java >= 1.6
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.6.0/bin/java
/usr/lib/jvm/jre-1.6.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/bin/java
# 这里添加:JDK8安装目录/bin/java
在服务器DOS界面,ssh IP 连接一下,出现:
RSA key fingerprint is 83:f1:fc:f6:04:2e:cf:8a:83:bb:64:df:d6:72:08:98.
Are you sure you want to continue connecting (yes/no)? yes
时,输入yes就可以了。
gitlab 插件:系统管理--插件管理 里面搜索 gitlab 插件,安装。
Jenkins 主页--凭据--系统--全局凭据 (unrestricted)--添加凭据
类型:SSH Username with private key
描述:gitlab(方便后面辨认账户)
用户名:root
Private Key:选中 单选框。
key:你的服务器私钥
Passphrase:为空
配置git工具:系统管理--全局工具配置--git
系统管理--系统设置--gitlab:
新建任务--输入任务名(项目名称)-- 构建一个自由风格的软件项目(第一个)-- 确定
本文为Larwas原创文章,转载无需和我联系,但请注明来自larwas博客 https://larwas.com
最新评论