ubuntu18.04安装Jenkins
程序员文章站
2022-05-14 20:43:04
...
jenkins需要java支持
首先到java官网下载最新的压缩包
tar -zxvf jdk-8u191-linux-x64.tar.gz
sudo mv jdk1.8.0_191 /usr/local/jdk1.8
设置java环境变量
- 方案一:修改全局配置文件,作用于所有用户:
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=.:${JAVA_HOME}/bin:$PATH
- 方案二:修改当前用户配置文件,只作用于当前用户:
vim ~/.bashrc
设置与上一样 - 使修改的配置立刻生效
##对应方法一:
source /etc/profile
##对应方法二:
source ~/.bashrc
- 检查是否安装成功
java -version
安装jenkins
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.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
jenkins默认端口8080,可到/etc/init.d/jenkins
中修改
sudo service jenkins start
启动报错
ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' returns the java executable path
建立软连接再次启动
sudo ln -s /usr/local/jdk1.8/bin/java /usr/bin/java