- Power Up: Connect your Raspberry Pi to a power source, monitor, keyboard, and mouse.
- Boot Up: Boot the Raspberry Pi with Raspbian (or any Debian-based OS) installed.
- Connect to the Internet: Ensure your Raspberry Pi is connected to the internet via Wi-Fi or Ethernet.
Open the terminal and run the following commands to update your system:
sudo apt update
sudo apt upgrade -y
In the terminal, create a new shell script file using nano or any text editor:
nano install_jenkins.sh
Copy and paste the following script into the editor:
#!/bin/bash
sudo apt update
sudo apt upgrade -y
sudo apt install openjdk-8-jdk -y
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins -y
Save the file by pressing Ctrl + X, then Y, and hit Enter.
Before running the script, make it executable:
chmod +x install_jenkins.sh
Execute the script by running the following command:
./install_jenkins.sh
The script will update the package lists, upgrade installed packages, install OpenJDK 8, add the Jenkins repository key, and finally install Jenkins.
After installation, start Jenkins:
sudo systemctl start jenkins
Enable Jenkins to start on boot:
sudo systemctl enable jenkins
By default, Jenkins runs on port 8080. Open a web browser on your Raspberry Pi or another device on the same network and navigate to:
http://<your_raspberry_pi_ip>:8080
You can find your Raspberry Pi’s IP address by running:
hostname -I
Follow the on-screen instructions to unlock Jenkins using the password found in the
file /var/lib/jenkins/secrets/initialAdminPassword
.
After setting up Jenkins, it is advisable to secure it by creating an admin user and setting up security options within the Jenkins interface.