确保安装了java
安装 jenkins
- 将存储库密钥添加到系统
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
- Debian包存储库地址附加到服务器的sources.list
echo deb http://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
- 运行update ,以便apt-get将使用新的存储库
sudo apt-get update
- 安装Jenkins及其依赖项
sudo apt-get install jenkins
启动 jenkins
sudo service jenkins start
若出现这样的错误提示,而且你已经安装了java
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
- 查看环境变量是否存在java
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:
/home/zhanhao/software/jdk1.8.0_211/bin:/home/zhanhao/software/jdk1.8.0_211/jre/bin
建立软连接
ln -s /home/zhanhao/software/jdk1.8.0_211/bin/java /usr/bin/java
再次启动
sudo service jenkins start
默认端口号8080
想修改端口号,更改这个文件/etc/default/jenkins