How to Install Java and Jenkins on Amazon Linux 2023

Update the System: Before installing any new software, it’s essential to update the system’s package repositories

sudo dnf update -y

nstall Java: Amazon Linux often comes with OpenJDK pre-installed, but if it’s not present or you need a specific version, you can install it using the following commands:

sudo dnf install java-17-amazon-corretto-devel

Install Jenkins:

sudo yum install jenkins

Start Jenkins

You can enable the Jenkins service to start at boot with the command:

sudo systemctl enable jenkins

You can start the Jenkins service with the command:

sudo systemctl start jenkins

You can check the status of the Jenkins service using the command:

sudo systemctl status jenkins

Open Firewall: Jenkins runs on port 8080 by default. If your Amazon Linux server has a firewall (e.g., iptables) enabled, you need to open the port to allow Jenkins traffic:

bashCopy codesudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload

Initial Jenkins Setup: Now, Jenkins should be up and running. You can access the Jenkins web interface by navigating to http://your_server_ip_or_domain:8080 in your web browser. Follow the on-screen instructions to complete the initial setup. You will be asked to unlock Jenkins, set up an admin user, and install recommended plugins.

Jenkins Configuration: Once Jenkins is installed, you can configure it further based on your requirements.

Remember that these instructions are based on the state of Amazon Linux and Jenkins as of September 2021, and there may be changes or newer versions by the time Amazon Linux 2023 is released. Always refer to the official documentation and repositories for the latest instructions and packages.

Regenerate response