windows系统崩坏,重装测试类工具,心情崩了
windows硬盘损坏前,运行应用具慢。。。。。。慢着慢着就走了
从前部署在本地的jenkins,python,gitblit等相关脚本都凉透了,所以这次把服务部署到Centos7上面;
一、安装VirtualBox、Centos,手动装一下,前提必需配置好网络【不然装好后无上上网,无法安装。。。】
网络配置【桥接网卡->选择本本网卡】,这样就OK了
二、【Xshell访问CentOs】
如安装Centos已配置后网络并启动ssh端口,可以忽略下面配置;
配置ip
ifcfg-enp0s3文件
# ifcfg-enp0s3文件
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp" # 注意重点【启用地址协议:static静态协议,bootp协议,dhcp协议】
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s3"
UUID="b6408bbf-3dc6-44fd-8446-a92690c7774c"
DEVICE="enp0s3"
ONBOOT="yes" # 注意重点【系统启动时是否自动加载】
# ifcfg-lo文件
DEVICE=lo
IPADDR=127.0.0.1 #【因为使用DHCP,所以这里可以不需要修改】
NETMASK=255.0.0.0 #【因为使用DHCP,所以这里可以不需要修改】
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes #注意重点
NAME=loopback
修改端口号【如Xshell无法连接,即需要修改端口号】
vi /etc/ssh/sshd_config
Port 22 #去掉注释符
PasswordAuthentication yes #去掉注释符
修改完成后重启系统【reboot】
进入系统后【ip addr】看到ip
这样就可以愉快使用Xshell了
三、安装Java、Jenkins
# 安装Java & jenkins使用java11 或 17版本
yum install fontconfig java-11-openjdk
#配置环境变量
[root@localhost ssh]# vi /etc/profile
#修改内容:文本最后,添加以下三行变量,保存退出;
export JAVA_HOME=
export CLASSPATH=.;${JAVA_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
# 运行java
[root@localhost ssh]# java -version
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.18.0.10-1.el7_9) (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-1.el7_9) (build 11.0.18+10-LTS, mixed mode, sharing)
# 下载&安装Jenkins
wget http://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.346.1-1.1.noarch.rpm
rpm -ivh jenkins-2.346.1-1.1.noarch.rpm
# 修改jenkins配置
vim /etc/sysconfig/jenkins
修改内容:
JENKINS_USER="root"
JENKINS_PORT="8080" #根据端口实际使用情况修改
# 启动jenkins并加入开机启动
[root@localhost ssh]# systemctl start jenkins && systemctl enable jenkins
# 查看jenkins运行情况
[root@localhost ssh]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2023-02-22 11:01:05 CST; 40min ago
Main PID: 988 (java)
CGroup: /system.slice/jenkins.service
└─988 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.082+0000 [id=147] INFO jenkins.InitReact...lugins
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.082+0000 [id=147] INFO jenkins.InitReact...lugins
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.082+0000 [id=147] INFO jenkins.InitReact...lugins
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.082+0000 [id=147] INFO jenkins.InitReact...nsions
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.082+0000 [id=147] INFO jenkins.InitReact...loaded
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.082+0000 [id=147] INFO jenkins.InitReact...dapted
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.083+0000 [id=147] INFO jenkins.InitReact...l jobs
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.083+0000 [id=146] INFO jenkins.InitReact...pdated
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.085+0000 [id=147] INFO jenkins.InitReact...zation
2月 22 11:07:16 localhost.localdomain jenkins[988]: 2023-02-22 03:07:16.085+0000 [id=64] INFO h.m.UpdateCenter$C...10 sec
Hint: Some lines were ellipsized, use -l to show in full.
#补充:jenkins完全卸载
# rpm -e jenkins ## 卸载jenkins服务
# rpm -ql jenkins ## 检查是否卸载成功
# find / -name jenkins | xargs rm -rf ## 彻底删除残留文件
jenkins运行后,还需要放开8080端口访问限制
浏览器访问,浏览器访问时仍然找不到网址
查看防火墙状态 systemctl status firewalld
在防火墙启动的状态下开放端口
firewall-cmd --zone=public --add-port=8087/tcp --permanent
然后刷新防火墙
systemctl reload firewalld
浏览器正常访问jenkins了,可继续界面安装Jenkins了