centos7、jdk、tomcat8、jenkins
[root@51cto ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@51cto ~]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
1
[root@51cto ~]# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 2
[root@51cto ~]# free -m
total used free shared buff/cache available
Swap: 8063 0 8063
[root@51cto ~]#
[root@51cto ~]# cd /etc/sysconfig/network-scripts/
[root@51cto network-scripts]# cat ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
UUID=9b451e45-79a3-4e60-b81e-f1d34978943a
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.8.201
GATEWAY=192.168.8.254
NETMASK=255.255.255.0
DNS1=202.99.160.68
DNS2=202.99.166.4
[root@51cto /]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.125) 56(84) bytes of data.
64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=1 ttl=54 time=8.95 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 8.952/9.192/9.432/0.240 ms
[root@51cto /]#
[root@51cto /]# systemctl stop firewalld 關閉防火墻
[root@51cto /]# systemctl disable firewalld 禁止防火墻開機啟動
[root@51cto /]# vi /etc/selinux/config 禁止selinux開機啟動
#This file controls the state of SELinux on the system.
#SELINUX= can take one of these three values:
#enforcing - SELinux security policy is enforced.
#permissive - SELinux prints warnings instead of enforcing.
#disabled - No SELinux policy is loaded.
SELINUX=disabled #修改為disabled
:wq
yum install lrzsz net-tools wget vim 安裝常用工具
2、部署JDK
https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
[root@51cto /]# cd tools/
[root@51cto tools]# pwd
/tools
[root@51cto tools]#
[root@51cto tools]# wget https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
[root@51cto tools]# rpm -aq | grep java
[root@51cto tools]#
[root@51cto tools]# ls
jdk-8u201-linux-x64.tar.gz
[root@51cto tools]# tar xvf jdk-8u201-linux-x64.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[root@51cto tools]#
換種方式下載
[root@bogon tools]# tar xvf jdk-8u201-linux-x64.tar.gz -C /usr/local/#可以解壓了
[root@bogon tools]# cd /usr/local/
[root@bogon local]# ls
bin etc games include jdk1.8.0_201 lib lib64 libexec sbin share src
[root@bogon local]#
[root@bogon local]# mv jdk1.8.0_201/ jdk
[root@bogon local]# ls
bin etc games include jdk lib lib64 libexec sbin share src
[root@bogon local]#
[root@bogon local]# vim /etc/profile#添加環境變量
#jdk配置
export JAVA_HOME=/usr/local/jdk/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@bogon local]# source /etc/profile#立即生效
[root@bogon local]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
[root@bogon local]#
3、部署Tomcat、jenkins.war包
https://tomcat.apache.org/download-80.cgi
https://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.146/
[root@bogon tools]# ls
jdk-8u201-linux-x64.tar.gz
[root@bogon tools]#
[root@bogon tools]# ls
apache-tomcat-8.5.37.tar.gz jdk-8u201-linux-x64.tar.gz
[root@bogon tools]#
[root@bogon tools]# tar xvf apache-tomcat-8.5.37.tar.gz -C /usr/local/
[root@bogon tools]# cd /usr/local/
[root@bogon local]# ls
apache-tomcat-8.5.37 bin etc games include jdk lib lib64 libexec sbin share src
[root@bogon local]# mv apache-tomcat-8.5.37/ tomcat
[root@bogon local]# ls
bin etc games include jdk lib lib64 libexec sbin share src tomcat
[root@bogon local]#
[root@bogon local]# cd /usr/local/tomcat/
[root@bogon tomcat]# ls
bin BUILDING.txt conf CONTRIBUTING.md lib LICENSE logs NOTICE README.md RELEASE-NOTES RUNNING.txt temp webapps work
[root@bogon tomcat]# cd conf
[root@bogon conf]# ls
catalina.policy catalina.properties context.xml jaspic-providers.xml jaspic-providers.xsd logging.properties server.xml tomcat-users.xml tomcat-users.xsd web.xml
[root@bogon conf]#
[root@bogon conf]# vim server.xml #把默認的8080改為20030
<Connector port="20030" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
[root@bogon bin]# cd /usr/local/tomcat/bin/
[root@bogon bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk/
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@bogon bin]#
[root@bogon bin]# netstat -nltp | grep 20030
tcp6 0 0 :::20030 :::* LISTEN 1924/java
[root@bogon bin]#
[root@bogon tomcat]# cp -r webapps/ webapps_backup
[root@bogon tomcat]# ls
bin BUILDING.txt conf CONTRIBUTING.md lib LICENSE logs NOTICE README.md RELEASE-NOTES RUNNING.txt temp webapps webapps_backup work
[root@bogon tomcat]# cd webapps
[root@bogon webapps]# ls
docs examples host-manager manager ROOT
[root@bogon webapps]# rm -rf ./*
[root@bogon webapps]# ls
[root@bogon webapps]# ls
[root@bogon webapps]# mkdir jenkins
[root@bogon webapps]#
[root@bogon webapps]# ls
jenkins ROOT#把ROOT拿回來吧
[root@bogon webapps]#
[root@bogon webapps]# cd jenkins/
[root@bogon jenkins]# ls
[root@bogon jenkins]# ls
[root@bogon jenkins]# ls
jenkins.war
[root@bogon jenkins]#
[root@bogon jenkins]# jar -xvf jenkins.war
[root@bogon jenkins]# ls
bootstrap css executable help jenkins.war jsbundles LogFileOutputStream$2.class Main.class MainDialog$1.class Main$FileAndDescription.class robots.txt WEB-INF
ColorFormatter.class dc-license.txt favicon.ico images JNLPMain.class LogFileOutputStream$1.class LogFileOutputStream.class MainDialog$1$1.class MainDialog.class META-INF scripts winstone.jar
[root@bogon jenkins]#
[root@bogon jenkins]# vim /etc/profile
#jenkins配置
export JENKINS_HOME=/usr/local/tomcat/webapps/jenkins
[root@bogon jenkins]# source /etc/profile
[root@bogon bin]# pwd
/usr/local/tomcat/bin
[root@bogon bin]# ./shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk/
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@bogon bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk/
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@bogon bin]#
根據路徑去找口令,拿過來繼續
[root@bogon bin]# more /usr/local/tomcat/webapps/jenkins/secrets/initialAdminPassword
438536dcae7f4d2fb908f6dd13d0927d
[root@bogon bin]#
好了根據提示一路走下去就可以
備註:默認安裝包含的插件,同樣也可以根據需求選擇性的安裝
說明:請忽略主機名字,寫作過程中,重啟服務器導致
centos7、jdk、tomcat8、jenkins