Install Java with Apt on Ubuntu
update your server:
sudo apt update && apt upgrade -y
install the JRE:
sudo apt install default-jre -y
Verify the installation:
java -version
install JDK:
sudo apt install default-jdk
Verify the installation:
javac -version
Setting the JAVA_HOME Environment Variable:
sudo update-alternatives --config java
sudo nano /etc/environment (At the end of this file, add the following line, making sure to replace the highlighted path with your own copied path, and to not include the bin/ portion of the path):
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
source /etc/environment
echo $JAVA_HOME
Install Jenkins on Ubuntu
Installing Jenkins:
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key |sudo gpg --dearmor -o /usr/share/keyrings/jenkins.gpg
(watch video carefully for this line of code)
sudo apt update
sudo apt install jenkins
Starting Jenkins:
sudo systemctl start jenkins.service
sudo systemctl status jenkins
Opening the Firewall:
sudo ufw allow 8080
Setting Up Jenkins:
http://your_server_ip_or_domain:8080
display the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.
...
https://www.youtube.com/watch?v=GykBnH00OQU