단위 jenkins.service를 찾을 수 없습니다.

단위 jenkins.service를 찾을 수 없습니다.

Centos 7 시스템에서 Jenkins를 시작하려고 합니다. Jenkins 폴더를 다른 컴퓨터에서 이 컴퓨터로 복사하고 다운로드하는 대신 여기에서 실행하려고 합니다. 전체 Jenkins 파일을 var/lib/jenkins새 컴퓨터의 / 폴더에 복사했습니다. 다음 명령을 실행합니다.

java -jar jenkins.war

다음 로그를 얻습니다.

Running from: /var/lib/jenkins/jenkins.war
webroot: $user.home/.jenkins
2019-12-23 19:50:24.875+0000 [id=1]     INFO    org.eclipse.jetty.util.log.Log#initialized: Logging initialized @510ms to org.eclipse.jetty.util.log.JavaUtilLog
2019-12-23 19:50:25.019+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
2019-12-23 19:50:26.607+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2019-12-23 19:50:26.676+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-9.4.z-SNAPSHOT; built: 2019-05-02T00:04:53.875Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_232-b09
2019-12-23 19:50:27.038+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2019-12-23 19:50:27.111+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2019-12-23 19:50:27.111+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2019-12-23 19:50:27.116+0000 [id=1]     INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
2019-12-23 19:50:27.795+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@782a4fff{Jenkins v2.190.1,/,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
2019-12-23 19:50:27.818+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@1040be71{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2019-12-23 19:50:27.818+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started @3454ms
2019-12-23 19:50:27.819+0000 [id=21]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine v4.0 running: controlPort=disabled
2019-12-23 19:50:29.635+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2019-12-23 19:50:29.674+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2019-12-23 19:50:31.654+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2019-12-23 19:50:31.666+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2019-12-23 19:50:31.684+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2019-12-23 19:50:32.651+0000 [id=31]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2019-12-23 19:50:32.691+0000 [id=46]    INFO    hudson.model.AsyncPeriodicWork$1#run: Started Download metadata
2019-12-23 19:50:32.708+0000 [id=46]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2019-12-23 19:50:33.763+0000 [id=32]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@3a900fc3: display name [Root WebApplicationContext]; startup date [Mon Dec 23 14:50:33 EST 2019]; root of context hierarchy
2019-12-23 19:50:33.764+0000 [id=32]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@3a900fc3]: org.springframework.beans.factory.support.DefaultListableBeanFactory@44b26de3
2019-12-23 19:50:33.777+0000 [id=32]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@44b26de3: defining beans [authenticationManager]; root of factory hierarchy
2019-12-23 19:50:33.986+0000 [id=32]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@16d60366: display name [Root WebApplicationContext]; startup date [Mon Dec 23 14:50:33 EST 2019]; root of context hierarchy
2019-12-23 19:50:33.987+0000 [id=32]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@16d60366]: org.springframework.beans.factory.support.DefaultListableBeanFactory@53d5b029
2019-12-23 19:50:33.987+0000 [id=32]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@53d5b029: defining beans [filter,legacy]; root of factory hierarchy
2019-12-23 19:50:34.237+0000 [id=32]    INFO    jenkins.install.SetupWizard#init:

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:



This may also be found at: /root/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

2019-12-23 19:50:53.162+0000 [id=46]    INFO    hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
        at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
        at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:189)
        at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1762)
        at hudson.util.Retrier.start(Retrier.java:62)
        at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1733)
        at jenkins.model.DownloadSettings$DailyCheck.execute(DownloadSettings.java:130)
        at hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:101)
        at java.lang.Thread.run(Thread.java:748)
2019-12-23 19:50:53.163+0000 [id=46]    INFO    hudson.util.Retrier#start: Calling the listener of the allowed exception 'connect timed out' at the attempt #1 to do the action check updates server
2019-12-23 19:50:53.165+0000 [id=46]    INFO    hudson.util.Retrier#start: Attempted the action check updates server for 1 time(s) with no success
2019-12-23 19:50:53.166+0000 [id=46]    SEVERE  hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: SocketTimeoutException: connect timed out
2019-12-23 19:50:53.170+0000 [id=46]    INFO    hudson.model.AsyncPeriodicWork$1#run: Finished Download metadata. 20,477 ms
2019-12-23 19:50:54.258+0000 [id=32]    WARNING hudson.model.UpdateCenter#updateDefaultSite: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
        at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
        at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:189)
        at hudson.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2456)
        at jenkins.install.SetupWizard.init(SetupWizard.java:168)
        at jenkins.install.InstallState$InitialSecuritySetup.initializeState(InstallState.java:166)
        at jenkins.model.Jenkins.setInstallState(Jenkins.java:1089)
        at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:96)
        at jenkins.install.InstallState$Unknown.initializeState(InstallState.java:84)
        at jenkins.model.Jenkins$16.run(Jenkins.java:3277)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1118)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
2019-12-23 19:50:54.273+0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2019-12-23 19:50:54.302+0000 [id=20]    INFO    hudson.WebAppMain$3#run: Jenkins is fully up and running

로그에는 Jenkins가 실행 중임을 명확하게 보여줍니다. 하지만 상태를 확인하려고 하면 sudo service jenkins status다음 오류가 발생합니다.

Unit jenkins.service could not be found.

내가 무엇을 놓치고 있는지 잘 모르겠습니다.

답변1

Jenkins 패키지가 올바르게 설정되지 않아 장치를 찾을 수 없다고 나옵니다. 다음 명령은 문제를 해결합니다.

$ sudo yum update –y
$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat/jenkins.repo
$ sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
$ sudo yum install jenkins -y

답변2

AWS ec2 인스턴스에 Jenkins를 설치하는 동안 동일한 문제에 직면했습니다. 다음 명령이 나에게 효과적이었습니다.

  1. sudo amazon-linux-extras install epel -y
  2. sudo yum update -y
  3. sudo yum install jenkins java-1.8.0-openjdk-devel

답변3

이 답변에서 도움이 될 수 있는 몇 가지 사항을 언급하고 싶습니다.

1) 질문

당신이 언급한 질문:

Unit jenkins.service could not be found.

이는 war 파일을 실행할 때 유닛 파일이 생성되지 않기 때문에 발생합니다.

기본 설치를 사용하는 경우(여기에 정의됨:https://pkg.jenkins.io/redhat-stable/) 이전 컴퓨터에서는 에서 단위 파일을 찾을 수 있습니다 /etc/init.d/jenkins. 파일을 새 컴퓨터에 복사하는 것만으로는 모든 문제가 해결될지 잘 모르겠습니다.

2) CentOS 7 및 Systemd

CentOS 7은 다음을 사용합니다.시스템 D대신 유닛 파일SysV 초기화 스크립트, 살펴보면 /etc/init.d/READMECentOS가 해당 디렉토리에 있는 init 파일을 관리하는 방법에 대한 자세한 내용을 얻을 수 있습니다.

...기존 초기화 스크립트는 systemd 시스템에서 계속 실행됩니다. 초기화 스크립트 /etc/rc.d/init.d/foobar는 시스템 초기화 중에 서비스 단위 foobar.service에 암시적으로 매핑됩니다.

앞으로는 init 파일을 기본 systemd 단위 파일로 변환하여 디렉토리에 배치할 수 있습니다 /etc/systemd/system.

3) 나의 추천

RPM 패키지를 설치하거나 도커 이미지를 사용하는 것이 좋습니다(기본 설정). 모든 세부 사항은 공식 문서에 있습니다:

https://jenkins.io/doc/book/installing/

이것이 도움이 되는지 알려주십시오.

답변4

Docker에서 Jenkins를 설치했습니다.

  • 도커에서 직접 젠킨스 이미지 가져오기 - 어떤 이유로든 작동하지 않습니다.

작동시키기 위해 취한 단계는 다음과 같습니다.

  • 도커 이미지-a
  • 젠킨스 이미지 삭제:: docker rmi -f image_id

이제 운영 체제(여기서는 Linux)에 Jenkins를 설치해야 합니다.

효율적인! 건배!

관련 정보