Jenkins Tutorials - 2

Jenkins Tutorials - 2

TOPIC: Procedure to Change Jenkins Port to 8081

1. Connect to Your EC2 Instance:

???- Use SSH to connect to your EC2 instance.

???ssh -i <your-key-pair.pem> ec2-user@<your-ec2-public-ip>


2. Open the Jenkins Service Configuration File:

???- The configuration file for Jenkins is located at /lib/systemd/system/jenkins.service.

?sudo systemctl stop jenkins

???sudo systemctl status jenkins

???sudo vim /lib/systemd/system/jenkins.service


3. Find the Port Configuration:

???- Look for the line that starts with Environment="JENKINS_PORT=8080". If it doesn't exist, you can add it.


4. Change the Port Number:

???- Modify or add the line to use port 8081 instead of 8080:

plaintext

???Environment="JENKINS_PORT=8081"


5. Save and Exit the Editor:

???- Save the changes and exit the text editor. If you're using nano, you can do this by pressing Ctrl+X, then Y, and Enter.


6. Reload the Systemd Configuration:

???- After making changes to the service file, reload the systemd configuration to apply the changes:

???sudo systemctl daemon-reload


7. Start Jenkins:

???- start the Jenkins service to apply the changes:

???sudo systemctl start jenkins


8. Update the Security Group:

???- Go to the AWS Management Console.

???- Navigate to EC2 Dashboard > Instances.

???- Select your instance and note the security group.

???- Navigate to Security Groups under Network & Security.

???- Select your security group and edit inbound rules.

???- Add a custom TCP rule for port 8081:

?????- Type: Custom TCP

?????- Port Range: 8081

?????- Source: 0.0.0.0/0 (or restrict to your IP range)


9. Verify the Port Change:

???- Open a web browser and navigate to:

???????https://<your-ec2-public-ip>:8081

?????- Ensure that Jenkins is now accessible on port 8081.


### Summary

1. Connect to your EC2 instance.

2. Open and edit /lib/systemd/system/jenkins.service.

3. Add or modify Environment="JENKINS_PORT=8081".

4. Reload the systemd configuration with sudo systemctl daemon-reload.

5. Restart Jenkins with sudo systemctl restart jenkins.

6. Update your security group to allow inbound traffic on port 8081.

7. Verify Jenkins is accessible on port 8081.

By following these steps, you will successfully change the default port of Jenkins to 8081.

要查看或添加评论,请登录

Preethi Dovala的更多文章

  • What is Git Cherry-pick?

    What is Git Cherry-pick?

    Watch the below Video about Git Cherry-pick Commit GIT VIDEO In Git, cherry-pick is a command that allows you to apply…

    1 条评论
  • Jenkins Tutorials -1

    Jenkins Tutorials -1

    JENKINS VIDEO step-by-step guide for setting up Jenkins on an EC2 instance running Amazon Linux 2 and performing…

  • Kubernetes Commands (30 - 50)

    Kubernetes Commands (30 - 50)

    30. kubectl create serviceaccount my-serviceaccount - Output: The ServiceAccount is created.

  • Kubernetes Commands (13-29 )

    Kubernetes Commands (13-29 )

    13. kubectl expose deployment my-deployment --port=8080 --target-port=80 --type=LoadBalancer - Output: The deployment…

  • Kubernetes Commands - (1 - 12)

    Kubernetes Commands - (1 - 12)

    1. kubectl apply -f deployment.

    1 条评论
  • Kubernetes interview question and answers SCENARIO BASED

    Kubernetes interview question and answers SCENARIO BASED

    Scenario: You have a Kubernetes cluster with multiple worker nodes. One of the nodes becomes unresponsive and needs to…

  • Kubernetes interview question and answers for ADVANCED LEVEL

    Kubernetes interview question and answers for ADVANCED LEVEL

    1. Q: What are StatefulSets in Kubernetes, and when would you use them? A: StatefulSets are a Kubernetes controller…

社区洞察