Jenkins on Windows
Step 1:
Set up Custom TCP port: 8080 (AWS Security Groups) and connect (RDP) to your Windows machine
Step 2:
Install JDK (Java Development Kit) Java 11.0.14 for Windows
Java SE JDK 11.0.14 Download
Step 3:
Set environment variables for JDK
System Properties > Advanced > Environment Variables > New
JAVA_HOME | C:\Program Files\Java\jdk-11.0.14 |
PATH | %JAVA_HOME%\bin |
Step 4:
Install Jenkins
Step 5:
Run Jenkins localhost:8080 and enter initial admin password from:
C:\Users\mika\AppData\Local\Jenkins\.jenkins\secrets\initialAdminPassword
If the account can’t Logon as service, set in:
Admin Tools > Local Security Policy > Local Policies > User Rights Assignment > Logon as a service
Jenkins on Linux
Ubuntu
Debian based like Linux Mint, Kali Linux –> APT
Amazon Linux 2
Amazon Linux2 (RedHat [RHEL] based like CentOS, Oracle Linux, Fedora) –> YUM
/root/.jenkins
Step 1:
Set up Custom TCP port: 8080 (AWS Security Groups) and connect (SSH) to your Linux machine
Step 2:
Update packages (yum or apt)
sudo yum update
sudo apt update
Step 3:
Check Java is installed.
If not install java
java -version
sudo yum install java-1.8.0
sudo apt install openjdk-8-jdk
Step 4:
Download latest Jenkins code package
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo wget -q -O - https://pkg.jenkins.io/debian-stable/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 update
sudo apt install jenkins
Step 5:
Import a key file from Jenkins-CI to enable installation from the package
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install epel-release
Step 6:
Install Jenkins
sudo yum install jenkins
Step 7:
Start Jenkins
sudo service jenkins start
Step 8:
Access Jenkins server using port 8080. In the initial password from /var/lib/jenkins/secrets/initialAdminPassword
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Considerations
- To start jenkins on a diff port Update port number in /etc/sysconfig/jenkins
To fetch initial admin password
sudo su –
cat /root/.jenkins/secrets/initialAdminPassword
cat /var/lib/jenkins/secrets/initialAdminPassword
To stop Jenkins
sudo service jenkins stop
To uninstall Jenkins
sudo service jenkins stop
sudo yum remove jenkins
sudo rm -r /var/lib/Jenkins
Jenkins service:
sudo service jenkins start
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service sudo systemctl status jenkins