我正在使用EC2服务器实例。使用以下命令安装Jenkins:
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
但是我需要在Jenkins服务器上安装软件,因此在我的EC2实例中
sudo –s –H –u jenkins
进入詹金斯服务器。然后我试着做
sudo cabal install quickcheck
但是它提示我输入詹金斯密码。我已经在互联网上搜索了4个小时,没有任何东西可以帮助我在jenkins服务器中获得管理特权。
所以我在shell中使用以下命令来构建我的项目:
sudo cabal clean sudo cabal configure sudo cabal build sudo cabal install
这是我得到的错误:
Started by timer Building in workspace /var/lib/jenkins/jobs/Finance/workspace Checkout:workspace / /var/lib/jenkins/jobs/Finance/workspace - hudson.remoting.LocalChannel@eea6dc Using strategy: Default Last Built Revision: Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master) Fetching changes from 1 remote Git repository Fetching upstream changes from origin Commencing build of Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master) Checking out Revision b638e2182dece0ef1a40232b1d75fa3ae5c01a5d (origin/master) [workspace] $ /bin/sh -xe /tmp/hudson3500373817395137440.sh + sudo cabal clean sudo: no tty present and no askpass program specified Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: 3 incorrect password attempts Build step 'Execute shell' marked build as failure Sending e-mails to: ***@gmail.com ERROR: Could not connect to SMTP host: localhost, port: 25 javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638) at javax.mail.Service.connect(Service.java:295) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at hudson.tasks.MailSender.execute(MailSender.java:116) at hudson.tasks.Mailer.perform(Mailer.java:117) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733) at hudson.model.Run.execute(Run.java:1592) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) at java.net.Socket.connect(Socket.java:579) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900) ... 17 more Finished: FAILURE
解决方法如下:
/var/lib/jenkins/config.xml
<useSecurity>true</useSecurity>
sudo service jenkins restart
allow anyone to do anything
www.yoursite.com/securityRealm/addUser
allow logged in users to do anything