Unable to Connect to Jenkins Server (Amazon Linux AMI)
The problem here is pretty simple, if you do curl http://127.0.0.1:8080
on your host machine, you should get a message stating:
Authentication required<!--You are authenticated as: anonymousGroups that you are in:Permission you need to have (but didn't): hudson.model.Hudson.Administer-->
This means that jenkins has anonymous priviledges which is not allowing any connection.
To solve this issue, you will have to do two changes:
Add Jenkins user to root group:
sudo usermod -a -G root jenkins
Make Jenkins listen to all external IPs by editing file
/etc/sysconfig/jenkins
and changing theJENKINS_LISTEN_ADDRESS="0.0.0.0"
Once this is done, restart the jenkins server and then try to install plugins for jenkins.
I'm using this trick https://issues.jenkins-ci.org/browse/JENKINS-45388 and it works. What I did is add passwd:
as prefix of file /var/lib/jenkins/secrets/initialAdminPassword
and click retry
button for several times and finally it works.
Updating java-1.7.0-openjdk to java-1.8.0-openjdk will do the trick and restart the jenkins service or else change the port number and try it.