当前位置: 首页 > news >正文

网站优化需要工具专业的制作网站开发公司

网站优化需要工具,专业的制作网站开发公司,wordpress百度云存储,临沂疫情最新情况目录 一、安装配置jenkins 1、环境配置 2、软件要求 3、jdk安装(我是最小化安装,UI自带java要先删除rm -rf /usr/local/java 4、安装jenkins-2.419-1.1 二、Jenkins配置 1、修改jenkins初始密码 2、安装 Jenkins 必要插件 3、安装 Publish Over SS…

目录

一、安装配置jenkins

1、环境配置

2、软件要求

 3、jdk安装(我是最小化安装,UI自带java要先删除rm -rf /usr/local/java

4、安装jenkins-2.419-1.1

二、Jenkins配置

1、修改jenkins初始密码

2、安装 Jenkins 必要插件

 3、安装 Publish Over SSH 、 Maven Integration 插件

三、目前主流网站部署的流程

1、配置git主机

2、配置jenkins主机

3、配置 Maven、JDK、Git 环境

4、新建Maven项目

5、验证 Jenkins 自动打包部署结果


一、安装配置jenkins

1、环境配置

[root@client2 ~]# hostname jenkins
[root@client2 ~]# bash
[root@jenkins ~]# systemctl stop firewalld.service 
[root@jenkins ~]# iptables -F
[root@jenkins ~]# setenforce 0

2、软件要求

可以从国内清华园在下jenkins比较快,jdk推荐用17版本,11也行

 3、jdk安装(我是最小化安装,UI自带java要先删除rm -rf /usr/local/java

[root@jenkins ~]# ll
-rw-r--r--. 1 root root  89346360 8月  21 13:48 jenkins-2.419-1.1.noarch.rpm[root@jenkins ~]# tar xf jdk-17_linux-x64_bin.tar.gz
[root@jenkins ~]# mv jdk-17.0.8/ /usr/local/java
[root@jenkins ~]# vim /etc/profile
export JAVA_HOME=/usr/local/java/
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$PATH
[root@jenkins ~]# source /etc/profile

4、安装jenkins-2.419-1.1

[root@jenkins ~]# rpm -ivh jenkins-2.419-1.1.noarch.rpm 
警告:jenkins-2.419-1.1.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID ef5975ca: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...1:jenkins-2.419-1.1                ################################# [100%][root@jenkins ~]# jenkins start     //不要打断
2023-08-21 06:35:01.243+0000 [id=30]	INFO	jenkins.install.SetupWizard#init: *************************************************************
*************************************************************
*************************************************************Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:465b5873c2e8486591a8c55916752ce8   #这是登录密码This may also be found at: /root/.jenkins/secrets/initialAdminPassword*************************************************************
*************************************************************
*************************************************************

RPM包安装的内容

 

 

二、Jenkins配置

1、修改jenkins初始密码

修改完保存重新登录即可

2、安装 Jenkins 必要插件

在 Jenkins 首页中,点击左侧的Manage Jenkins>>Manage Plugins>>可选插件,在过滤搜索框中输入要安装的 Publish Over SSH 、 Maven Integration 插件,并勾中其左侧的复选框,点击“直接安装”即可开始插件安装操作。

 3、安装 Publish Over SSH 、 Maven Integration 插件

配置jenkins并发执行数量

用于提高提高执行效率

Manage Jenkins >> Configure System >> Maven项目配置

传统代码上线的过程

开发人员发起代码上线的需求(邮件中包含开发做好的WAR包)-->运维人员连接线上负载调度器(Nginx)--> 隔离一组服务器(Tomcat)--> 连接服务器(Tomcat)--> 备份旧代码(tar打包)--> 删除旧代码目录 --> 上传新的WAR包 --> 外网测试 --> 测试不通过则通过备份回滚代码 --> 测试通过则利用rsync的脚本推送代码到其他服务器--> 统一外网测试 -->连接调度器恢复隔离机制  --> 隔离另一组服务器实施上线步骤 --> 上线完成。

三、目前主流网站部署的流程

目前主流网站部署方法:通过 Hudson/Jenkins 工具平台实现全自动部署+测试,是一个可扩展的持续集成引擎,属于开源软件项目,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能。Jenkins 非常易于安装和配置,简单易用。

  1. 开发人员:写好代码,不需要自己进行源码编译、打包等工作,直接将代码分支存放在 SVN、Git 仓库即可。
  2. 运维人员:减轻人工干预的错误率,同时解放运维人员繁杂的上传代码、手动备份、更新等操作。
  3. 测试人员:可以通过 Jenkins 进行简单的代码及网站测试。

实验环境

操作系统

IP地址

主机名

角色

CentOS7.5

192.168.147.137

git

git服务器

CentOS7.5

192.168.147.139

Jenkins git客户端

jenkins服务器

CentOS7.5

192.168.147.140

tomcat

web服务器

 所有主机关闭防火墙和selinux

[root@localhost ~]# systemctl stop firewalld 
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0

1、配置git主机

# rpm安装安装依赖关系:git和jenkins主机都安

[root@gitclient ~]# yum -y install curl-devel expat-devel gettext-devel  openssl-devel zlib-devel

# 编译安装—服务端和客户端,访问https://mirrors.edge.kernel.org/pub/software/scm/git/下载所需要的版本

[root@gitclient ~]# wget https://github.com/git/git/archive/v2.22.0.tar.gz
[root@gitclient ~]# tar xf git-2.22.0.tar.gz -C /usr/src/
[root@gitclient ~]# cd /usr/src/git-2.22.0/
[root@git git-2.22.0]# make configure  #最小化安装要yum下载autoconf命令
#最小化要有gcc、gcc-c++
[root@git git-2.22.0]# ./configure --prefix=/usr/local/git && make && make install
[root@git git-2.22.0]# ln -sf /usr/local/git/bin/git /usr/bin/
[root@git git-2.22.0]# git --version
git version 2.22.0#在git服务端配置用户
[root@git ~]# useradd git
[root@gitclient ~]# echo "123465" | passwd --stdin git
更改用户 git 的密码 。
passwd:所有的身份验证令牌已经成功更新。
[root@git ~]# su - git
上一次登录:一 8月 21 15:48:06 CST 2023pts/0 上

创建本地仓库probe

[git@git ~]$ mkdir probe.git
[git@git ~]$ cd probe.git/
[git@git probe.git]$ git --bare init
已初始化空的 Git 仓库于 /home/git/probe.git/
[git@git probe.git]$ exit
登出

克隆项目代码同步到自己创建的仓库中

[root@git ~]# rz  #上传psi-probe.tar.gz
[root@git ~]# tar xf psi-probe.tar.gz
[root@git ~]# git clone git@192.168.147.137:/home/git/probe.git
正克隆到 'probe'...
git@192.168.147.137's password: 
warning: 您似乎克隆了一个空仓库。
[root@git probe]# git add .
[root@git probe]# git config --global user.email "skl@163.com"
[root@git probe]# git config --global user.name "skl"
[root@git probe]# git commit -m "all probe"
[root@git probe]# git push origin master
git@192.168.147.137's password: 
枚举对象: 1168, 完成.
对象计数中: 100% (1168/1168), 完成.
压缩对象中: 100% (1121/1121), 完成.
写入对象中: 100% (1168/1168), 2.01 MiB | 7.06 MiB/s, 完成.
总共 1168 (差异 398),复用 0 (差异 0)
To 192.168.147.137:/home/git/probe.git* [new branch]      master -> master

2、配置jenkins主机

1)添加验证凭据 :凭证这里添不添加都可以,这个试验不牵扯到凭证

跟着填写

填写以上数据后,点击“确定”就可以查看到新增的远程 web 主机账号。

2)添加 Publish Over SSH 远程主机

#tomcat主机创建目录
root@tomcat ~]# mkdir data

在 Jenkins 首页中点击“Manage Jenkins”->“Configure System”->“Publish over SSH”->“SSH Servers”->“增加”选项按钮,添加 SSH 远程主机。如图所示,输入 Name、Hostname、Username 等必要信息后,点击“高级”选项按钮->勾选“Use Password authentication,or use a different key”选项->输入“远程主机登录密码”->“Test Configuration”测试远程主机配置。测试远程主机配置成功后点击“保存”按钮即可。

 添加tomcat远程主机和密码

监测,显示成功,保存

 

3、配置 Maven、JDK、Git 环境

在 Jenkins 首页中点击“Manage Jenkins”->“Global Tool Configuration”->“JDK” ->新增“JDK”,设置 JDK 别名为”JDK17”。去掉“Install automatically”选项,设置 “JAVA_HOME”为本案例中 JDK 实际安装路径。

 

 在Jenkins安装maven、为maven更换阿里云镜像站

[root@jenkins ~]# rz -E
rz waiting to receive.
[root@jenkins ~]# tar xf apache-maven-3.5.0-bin.tar.gz 
[root@jenkins ~]# mv apache-maven-3.5.0 /usr/local/maven-3.5.0
[root@jenkins ~]# vim /usr/local/maven-3.5.0/conf/settings.xml 
#把147到158删除
146   <mirrors>
147     <!-- mirror
148      | Specifies a repository mirror site to use instead of a given repository. The repository that
149      | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
150      | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
151      |
152     <mirror>
153       <id>mirrorId</id>
154       <mirrorOf>repositoryId</mirrorOf>
155       <name>Human Readable Name for this Mirror.</name>
156       <url>http://my.repository.com/repo/path</url>
157     </mirror>
158      -->
159   </mirrors>替换成
146   <mirrors>
147       <mirror>
148         <id>nexus-aliyun</id>
149         <mirrorOf>central</mirrorOf>
150         <name>Nexus aliyun</name>
151         <url>http://maven.aliyun.com/nexus/content/groups/public</url>
152       </mirror>
153   </mirrors>

 在“Global Tool Configuration”配置界面中找到 Maven 配置选项,然后点击“新增 Maven”并设置别名为“Maven3.5”。

 Git 配置

[root@jenkins ~]# which git
/usr/bin/git

3、配置web主机 

[root@tomcat ~]#  tar xf apache-tomcat-8.5.40.tar.gz 
[root@tomcat ~]#  mv apache-tomcat-8.5.40 /usr/local/tomcat
[root@tomcat ~]#  yum -y install java

 发布公钥给jenkins主机

[root@tomcat ~]# ssh-keygen
[root@tomcat ~]# ssh-copy-id 192.168.147.139

主机Jenkins默认用jenkins用户去连接git,所以用jenkins用户生成密钥对,并发送给git。

[root@jenkins ~]# which git
/usr/bin/git
[root@jenkins ~]# id jenkins
uid=997(jenkins) gid=995(jenkins) 组=995(jenkins)
[root@jenkins ~]# su -s /bin/bash jenkinsbash-4.2$ ssh-keygen
bash-4.2$ ssh-copy-id git@192.168.147.137bash-4.2$ ssh git@192.168.147.137
Last failed login: Tue Aug 22 14:13:44 CST 2023 from 192.168.147.139 on ssh:notty
There were 3 failed login attempts since the last successful login.
Last login: Mon Aug 21 16:30:48 2023
[git@git ~]$ exit
登出
Connection to 192.168.147.137 closed.
bash-4.2$ exit[root@jenkins ~]# ssh-keygen
[root@jenkins ~]# ssh-copy-id git@192.168.147.137
[root@jenkins ~]# ssh git@192.168.147.137             #登录测试

4、新建Maven项目

在以上配置完成后,回到 Jenkins 首页,选择“新建任务”,然后输入一个任务名称 “probe”,并选中“Maven project”点击当前页面下方的“确定”按钮。

在点击“确定”按钮后,选择“源码管理”选中“Git”,配置“RepositoriesURL”为

git@192.168.147.137:/home/git/probe.git

 选择“Build

clean package -Dmaven.test.skip=true

选择“构建后操作“中的“send build artfacts over SSH “Exec command”中执行命令的含义是:在自动部署前先杀掉 Tomcat 进程,然后删除 war 包,用 scp 远程拷贝命令将 Jenkins 自动打包好的项目 war 包拷贝到当前 Tomcat 应用目录。 然后重启 Tomcat 。

scp 192.168.147.139:/root/.jenkins/workspace/probe/psi-probe-web/target/probe.war /usr/local/tomcat/webapps/
/usr/local/tomcat/bin/startup.sh

5、验证 Jenkins 自动打包部署结果

在web主机上查看 probe 目录是否被拷贝到/usr/local/tomcat/webapps 目录下

[root@tomcat ~]# ls /usr/local/tomcat/webapps/
docs  examples  host-manager  manager  probe  probe.war  ROOT
[root@tomcat ~]# ls /usr/local/tomcat/webapps/ -l
总用量 26624
drwxr-x---. 14 root root     4096 8月  23 20:00 docs
drwxr-x---.  6 root root       83 8月  23 20:00 examples
drwxr-x---.  5 root root       87 8月  23 20:00 host-manager
drwxr-x---.  5 root root      103 8月  23 20:00 manager
drwxr-x---.  7 root root       88 8月  23 21:16 probe
-rw-r--r--.  1 root root 27253197 8月  23 21:16 probe.war
drwxr-x---.  3 root root     4096 8月  23 20:00 ROOT

从以上结果来看,Jenkins 已把打好的 probe war 包拷贝过来了。

192.168.147.143就是192.168.147.139太卡了 ,我换了一台

[root@tomcat ~]# vim /usr/local/tomcat/conf/tomcat-users.xml<role rolename="manager-gui"/><role rolename="admin-gui"/><user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
</tomcat-users>	# 最下面此行前加入上面三行[root@tomcat ~]# vim /usr/local/tomcat/webapps/manager/META-INF/context.xml
<!--  <Valve className="org.apache.catalina.valves.RemoteAddrValve"allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->[root@tomcat ~]# /usr/local/tomcat/bin/shutdown.sh 
[root@tomcat ~]# /usr/local/tomcat/bin/startup.sh

 

 至此,Jenkins 自动打包部署完毕。


文章转载自:
http://kilojoule.spbp.cn
http://hypophyseal.spbp.cn
http://paltrily.spbp.cn
http://ureterostomy.spbp.cn
http://continue.spbp.cn
http://woofy.spbp.cn
http://blight.spbp.cn
http://sensoria.spbp.cn
http://placatory.spbp.cn
http://clubber.spbp.cn
http://tandemly.spbp.cn
http://neighbour.spbp.cn
http://penster.spbp.cn
http://electricize.spbp.cn
http://fagot.spbp.cn
http://liquescence.spbp.cn
http://gallows.spbp.cn
http://pound.spbp.cn
http://wfsw.spbp.cn
http://vestryman.spbp.cn
http://unabbreviated.spbp.cn
http://install.spbp.cn
http://res.spbp.cn
http://dauntless.spbp.cn
http://swoon.spbp.cn
http://ceiled.spbp.cn
http://vegetable.spbp.cn
http://tickey.spbp.cn
http://monotechnic.spbp.cn
http://diabetes.spbp.cn
http://waco.spbp.cn
http://scorpio.spbp.cn
http://baffy.spbp.cn
http://subvisible.spbp.cn
http://carpal.spbp.cn
http://subcommunity.spbp.cn
http://proprietory.spbp.cn
http://ecesis.spbp.cn
http://perry.spbp.cn
http://dwale.spbp.cn
http://knapper.spbp.cn
http://mandarin.spbp.cn
http://sully.spbp.cn
http://claque.spbp.cn
http://invertin.spbp.cn
http://preludio.spbp.cn
http://laical.spbp.cn
http://maharashtrian.spbp.cn
http://waitress.spbp.cn
http://verrucose.spbp.cn
http://deferral.spbp.cn
http://underskirt.spbp.cn
http://uranide.spbp.cn
http://whistleable.spbp.cn
http://sociogenous.spbp.cn
http://quinquefoil.spbp.cn
http://cephalothin.spbp.cn
http://incapability.spbp.cn
http://aegeus.spbp.cn
http://flasher.spbp.cn
http://prophylaxis.spbp.cn
http://embarrassingly.spbp.cn
http://sportscaster.spbp.cn
http://incompliant.spbp.cn
http://carthage.spbp.cn
http://chatoyant.spbp.cn
http://nilpotent.spbp.cn
http://freckle.spbp.cn
http://electrization.spbp.cn
http://mobbist.spbp.cn
http://subtly.spbp.cn
http://impropriator.spbp.cn
http://newbuilding.spbp.cn
http://hundreds.spbp.cn
http://neolith.spbp.cn
http://genre.spbp.cn
http://undertow.spbp.cn
http://commissural.spbp.cn
http://correligionist.spbp.cn
http://laryngotracheal.spbp.cn
http://roughhewn.spbp.cn
http://chimerical.spbp.cn
http://ottawa.spbp.cn
http://housefather.spbp.cn
http://female.spbp.cn
http://kawasaki.spbp.cn
http://prosperously.spbp.cn
http://hadith.spbp.cn
http://choleraic.spbp.cn
http://delaminate.spbp.cn
http://sycamore.spbp.cn
http://barrier.spbp.cn
http://mamluk.spbp.cn
http://interrupter.spbp.cn
http://cyberneticist.spbp.cn
http://smiley.spbp.cn
http://prisere.spbp.cn
http://thermostable.spbp.cn
http://radcm.spbp.cn
http://astylar.spbp.cn
http://www.hrbkazy.com/news/65365.html

相关文章:

  • jsp网站建设项目实践seo自学网官方
  • 各大门户网站有哪些谷歌ads
  • 临海网站开发公司关键词优化设计
  • 做的网站一定要收录么搜索引擎优化的办法有哪些
  • 网站的效果图百度人工客服电话
  • 湖南涟钢建设有限公司网站企业文化
  • 做seo网站要多少钱泽成seo网站排名
  • 做编程的 网站seo推广什么意思
  • 做网站赤峰88个seo网站优化基础知识点
  • wordpress不带www寄生虫seo教程
  • 网站试运营上海发布最新情况
  • 比较好的网站建设公司电话百度官网首页入口
  • 成都网站推广公司有趣的软文
  • 灰色行业老域名做网站不收录百度小程序入口
  • 做网站为什么差价很大百度推广后台登录首页
  • 微网站 免费模板行业数据统计网站
  • 墙蛙网站谁家做的怎样建立一个自己的网站
  • 婚纱摄影网站模板下载推广之家app下载
  • 手机网站注册网络营销代运营外包公司
  • 承德专业做网站的公司网站建设的重要性
  • 计算机培训班学什么青岛seo外包公司
  • 哈尔滨网站建设网络优化免费精准客源
  • wordpress网站如何专业网店推广
  • 电商网站成功的营销策略沧州seo公司
  • 52麻将官方网站做代理合肥搜索引擎优化
  • 西安网站建设bieleng个人建站
  • wordpress安装百度站长资源平台榆林市网站seo
  • 网站建设的公司哪家是上市公司重庆seo的薪酬水平
  • 深圳企业网站定制seo整站优化多少钱
  • 制作精美网站建设独立免费b站推广网站不