Ubuntu18安装Jenkins
一、安装JDK
cd /opt/soft
tar -zxvf jdk-8u333-linux-x64.tar.gz
#设置环境变量
vim /etc/profile
#Set JDK
export JAVA_HOME=/opt/soft/jdk1.8.0_333
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
#使环境变量生效
source /etc/profile
#查看是否安装成功
root@pc:~# java -version
java version "1.8.0_333"
Java(TM) SE Runtime Environment (build 1.8.0_333-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.333-b02, mixed mode)
二、安装maven
cd /opt/soft
#安装maven
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
tar -zxvf apache-maven-3.8.6-bin.tar.gz
#设置环境变量
vim /etc/profile
#Set maven
export M2_HOME=/opt/soft/apache-maven-3.8.6
export PATH=${M2_HOME}/bin:$PATH
#使环境变量生效
source /etc/profile
#查看是否安装成功
root@pc:/opt/soft# mvn -version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/soft/apache-maven-3.8.6
Java version: 1.8.0_333, vendor: Oracle Corporation, runtime: /opt/soft/jdk1.8.0_333/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-167-generic", arch: "amd64", family: "unix"
#注意设置内网的仓库
三、安装Tomcat
cd /opt/soft
#下载软件
wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.81/bin/apache-tomcat-8.5.81.tar.gz
#解压
tar -zxvf apache-tomcat-8.5.81.tar.gz
#重命名
mv apache-tomcat-8.5.81 tomcat8.5
#设置Java环境
vim tomcat8.5/bin/setclasspath.sh
export JAVA_HOME=/opt/soft/jdk1.8.0_333
export JRE_HOME=/opt/soft/jdk1.8.0_333/jre
#命令
./tomcat8.5/bin/startup.sh
./tomcat8.5/bin/shutdown.sh
四、安装nodejs
cd /opt/soft
wget https://cdn.npmmirror.com/binaries/node/v16.15.1/node-v16.15.1-linux-x64.tar.xz
tar -xvf node-v16.15.1-linux-x64.tar.xz
mv node-v16.15.1-linux-x64 nodejs-v16.15
#建立软连接
ln -s /opt/soft/nodejs-v16.15/bin/node /usr/bin/node
ln -s /opt/soft/nodejs-v16.15/bin/npm /usr/bin/npm
#查看是否安装成功
root@pc:/opt/soft# node -v
v16.15.1
#设置淘宝源
npm config set registry https://registry.npm.taobao.org
#查看是否修改成功
npm config get registry
#==================== 安装pnpm ===================
#1.获取脚本执行脚本
wget -qO- https://get.pnpm.io/install.sh | sh -
#2.使变量生效
source /root/.bashrc
//查看源
pnpm config get registry
//切换淘宝源
pnpm config set registry https://registry.npmmirror.com/
五、安装nginx
#安装ngixn
apt install nginx
#开启/关闭
systemctl start/stop nginx
#重新加载配置
systemctl reload nginx
六、安装Jenkins
官方安装:www.jenkins.io/zh/doc/book/installing/#debianubuntu
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
#建立 jdk 软连接
ln -s /opt/soft/jdk1.8.0_333/bin/java /usr/bin/java
#修改启动的端口
vim /lib/systemd/system/jenkins.service
#指定自己想要的端口
Environment="JENKINS_PORT=18080"
systemctl daemon-reload
systemctl start jenkins
#启动
./etc/init.d/jenkins start
./etc/init.d/jenkins stop
./etc/init.d/jenkins restart
systemctl start jenkins
systemctl stop jenkins
#问题2:该Jenkins实例似乎已离线
https://www.cnblogs.com/forever521Lee/p/9356212.html
#centos
#查看可用版本
yum list --showduplicates jenkins
#安装
yum install jenkins-2.346.1-1.1
#加载配置,启动
systemctl daemon-reload
systemctl start jenkins
问题:
#问题1:如果访问不了请检查防火墙,开放端口
#新增规则
firewall-cmd --permanent --add-port=18080/tcp
#删除规则
firewall-cmd --permanent --remove-port=18080/tcp
#重新加载规则
firewall-cmd --reload
标签:opt,bin,HOME,tar,soft,Ubuntu18,jenkins,Jenkins,安装
From: https://www.cnblogs.com/coolyang/p/17182668.html