1.创建credentials
2.创建node
3.在jenkins服务器还需要进行的操作(jenkins服务器中)
mkdir /var/lib/jenkins/.ssh
ssh-keyscan -H 192.168.110.204 >> /var/lib/jenkins/.ssh/known_hosts
chown -R jenkins:jenkins /var/lib/jenkins/.ssh/
4.远程目录/opt需要授权(节点ubuntu中)
chown -R yinjiaxing:yinjiaxing /opt
5.安装java环境(节点ubuntu中)
sudo apt install openjdk-11-jdk -y
否则会出现的错误:
/var/lib/jenkins/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/lib/jenkins/.ssh/known_hosts.
以及:
java.io.IOException: Could not copy remoting.jar into '/opt' on agent
Caused by: com.trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The user does not have sufficient permissions to perform the operation.)