±âŸ(framework)
2020.12.05 / 20:17

[Jenkins] CentOS 7¿¡ Á¨Å²½º ¼³Ä¡Çϱâ

Ŭ·Î´Ï
Ãßõ ¼ö 321

Jenkins¶õ

Á¨Å²½º´Â ¼ÒÇÁ¿þ¾î °³¹ß ½Ã Áö¼ÓÀûÅëÇÕ(CI-Continuous Ingtegration)À» ¼­ºñ½º ÇØÁÖ´Â µµ±¸ÀÔ´Ï´Ù. Áö¼ÓÀûÅëÇÕÀ̶õ °³¹ß ÆÀ¿øµéÀÌ ÀÛ¼ºÇÑ Äڵ带 ÀÚµ¿È­ µÈ ºôµå, Å×½ºÆ®, ¸®Æ÷ÆÃÀ» ÅëÇØ ÃÖ´ëÇÑ »¡¸® ¿À·ù¸¦ ¹ß°ßÇÏ°í ó¸®ÇÏ´Â °³¹ß¹æ¹ý·Ð Áß ÇϳªÀÔ´Ï´Ù.

Á¨Å²½º´Â ÀÌ·¯ÇÑ CI °³¹ß ¹æ¹ý·ÐÀ» È¿À²ÀûÀ¸·Î Áö¿øÇϱâ À§ÇØ ÁøÇàµÇ°íÀÖ´Â ¿ÀǼҽº ÇÁ·ÎÁ§Æ®ÀÔ´Ï´Ù.

¸¹Àº °³¹ß»çµé ±×¸®°í ÇÊÀÚ ¿ª½Ã ÇöÀå¿¡¼­ Á¨Å²½º¸¦ È°¿ëÇÏ¿© SVNÀ» ÅëÇØ ÇÁ·Î±×·¥À» ³»·Á¹Þ°í, ¸ÞÀ̺ìÀ» ÅëÇØ ºôµåÇÏ°í, ¼­¹ö·Î Àü¼ÛÇÏ°í, WAS¸¦ Àç±âµ¿ÇÏ´Â ÀÏ·ÃÀÇ ÀÛ¾÷À» ¹öÆ° Ŭ¸¯ ÇѹøÀ¸·Î ÁøÇàÇÏ°í ÀÖ½À´Ï´Ù. ³Ê¹«³ª À¯¿ëÇÏ°í Æí¸®ÇÑ µµ±¸·Î½á Áö¼ÓÀû ÅëÇÕÀ» ÀÌ·ç´Âµ¥ ²À ÇÊ¿äÇÑ µµ±¸¶óÇÒ ¼ö ÀÖ½À´Ï´Ù.

±×·³ ÀÌÁ¦ºÎÅÍ CentOS¿¡ Á¨Å²½º¸¦ ¼³Ä¡Çϵµ·Ï ÇÏ°Ú½À´Ï´Ù.


CentOS 7 ¼³Ä¡´Â ÀÌÀü Æ÷½ºÆÃÀ» Âü°íÇϽñ⠹ٶø´Ï´Ù.

https://blog.naver.com/tawoo0/221563030758

1. Jenkins ¼³Ä¡

- Jenkins ´Ù¿î·Îµå ÆäÀÌÁö¿¡ Á¢¼Ó ¡æ ÇÏ´ÜÀ¸·Î ½ºÅ©·Ñ ¡æ ´Ù¿î·Îµå Repository·Î À̵¿

¡æ ÃֽŹöÀü RPM °æ·Î º¹»ç(jenkins-2.176.1-1.1.noarch.rpm)

https://jenkins.io/download/

<Jenkins ´Ù¿î·Îµå ÆäÀÌÁö>

<Jenkins RPM °æ·Î º¹»ç>

- SSH ÅøÀ» ÀÌ¿ëÇÏ¿© CentOS root °èÁ¤ Á¢¼Ó

<SSH Åø Á¢¼Ó È­¸é>

- yumÀ» ÀÌ¿ëÇÏ¿© jenkins ¼³Ä¡(ÀÎÅͳÝÀÌ ¿¬°áµÇ¾îÁ® ÀÖ¾î¾ß ÇÔ)

yum ¿É¼Ç insall rpm¸µÅ© (¿É¼Ç - y : ¼³Ä¡ °úÁ¤ÀÇ ¸ðµç Áú¹®¿¡ yes·Î ´äÇÑ´Ù)

ex) yum -y intall https://pkg.jenkins.io/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm

[root@localhost]# yum -y intall https://pkg.jenkins.io/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm Loaded plugins: fastestmirror, langpacks jenkins-2.176.1-1.1.noarch.rpm | 74 MB 00:02:56 Examining /var/tmp/yum-root-tjJ0VK/jenkins-2.176.1-1.1.noarch.rpm: jenkins-2.176.1-1.1.noarch Marking /var/tmp/yum-root-tjJ0VK/jenkins-2.176.1-1.1.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package jenkins.noarch 0:2.176.1-1.1 will be installed --> Finished Dependency Resolution base/7/x86_64 | 3.6 kB 00:00:00 extras/7/x86_64 | 3.4 kB 00:00:00 extras/7/x86_64/primary_db | 205 kB 00:00:00 updates/7/x86_64 | 3.4 kB 00:00:00 updates/7/x86_64/primary_db | 6.4 MB 00:00:01 Dependencies Resolved ================================================================================ Package Arch ================================================================================ Installing: jenkins noarch Transaction Summary ================================================================================ Install 1 Package Total size: 74 M Installed size: 74 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : jenkins-2.176.1-1.1.noarch Verifying : jenkins-2.176.1-1.1.noarch Installed: jenkins.noarch 0:2.176.1-1.1 Complete! [root@localhost]#

2. Jenkins ¼³Á¤

- Á¨Å²½º ¼­ºñ½º Æ÷Æ®¸¦ º¯°æ(±âº» 8080 Æ÷Æ®¸¦ »ç¿ëÇصµ µÇÁö¸¸ Ȥ½Ã¶óµµ º¯°æÀÌ ÇÊ¿äÇÒ ¼ö Àֱ⠶§¹®¿¡...)

Á¨Å²½º ¼³Á¤ ÆÄÀÏ ¿ÀÇÂ(/etc/sysconfig/jenkins)

[root@localhost]#vi /etc/sysconfig/jenkins

- /etc/sysconfig/jenkins ¼³Á¤ ÆÄÀÏÀÇ JENKINS_PORT¸¦ 8081·Î º¯°æ ¡æ ESE ¹öÆ° ¡æ :wq·Î Á¤Àå ÈÄ vi Á¾·á

JENKINS_PORT="8081" :wq

- centos7ÀÇ jenkins Æ÷Æ®(8081·Î º¯°æµÇ Æ÷Æ®)¿ÀÇ ¡æ ¹æÈ­º® Àç±âµ¿

[root@localhost]# firewall-cmd --permanent --zone=public --add-port=8081/tcp success [root@localhost]# firewall-cmd --reload success [root@localhost]#

- Æ÷Æ®Æ÷¿öµù(ÇÊÀÚ´Â CentOS7À» VirtualBox¿¡ ¼³Ä¡ Çß°í, NAT ¹æ½Ä ³×Æ®¿öÅ©¸¦ ±¸¼ºÇ߱⠶§¹®¿¡ ÇÊ¿äÇÔ)

<¼³Á¤ â ¿­±â>

<³×Æ®¿öÅ© Æ÷Æ®Æ÷¿öµù>

<Æ÷Æ® Æ÷¿öµù ¼³Á¤>

3. Jenkins ½ÃÀÛ

- jenkins ½ÃÀÛ

[root@localhost]# service jenkins start

cf) Á¨Å²½º ½ÃÀÛ/Á¾·á/Àç½ÃÀÛ ¸í·É¾î

jenkins ½ÃÀÛ => service jenkins start jenkins Á¾·á => service jenkins stop jenkins Àç½ÃÀÛ => service jenkins restart

cf) CentOS7 Àç½ÃÀÛ ½Ã¿¡ Ç×»ó Jenkins¸¦ ±¸µ¿µÇ°Ô ¼³Á¤

systemctl enable jenkins

- ºê¶ó¿ìÁ®¸¦ ÅëÇØ jenkins ½ÃÀÛÀ» È®ÀÎ(http://127.0.0.1:18081)

<Jenkins ÃÖÃÊ ½ÃÀÛÈ­¸é>

3. Jenkins ±âº» ¼³Á¤

- Jenkins »ç¿ëÀ» À§Çؼ­ Unlock ÀÛ¾÷À» ¼öÇà

¼­¹ö¿¡¼­ ÃʱâÈ­ ºñ¹Ð¹øÈ£ º¹»ç ¡æ Administrator Password¿¡ º¹»çÇÑ °ª ÀÔ·Â ¡æ Continue ¹öÆ° Ŭ¸¯

[root@localhost]# vi /var/lib/jenkins/secrets/initialAdminPassword ³»¿ëÀ» º¹»çÇÏ°í vi Á¾·á

<Administrator Password ÀÔ·ÂÈ­¸é>

- Install Suggested plugins¸¦ ¼±ÅÃÇÏ¿© ±âº» Ç÷¯±×ÀÎ ¼³Ä¡È­¸éÀ¸·Î À̵¿

- ÀÚµ¿À¸·Î ±âº» Ç÷¯±×ÀÎ ¼³Ä¡ ÁøÇà(¿À·¡ °É¸²)

- °ü¸®ÀÚ °èÁ¤Á¤º¸ ÀÔ·Â ¡æ Save and Coninue ¹öÆ° Ŭ¸¯

<°ü¸®ÀÚ °èÁ¤ Á¤º¸ ÀÔ·Â È­¸é>

- Á¨Å²½º Á¢¼Ó URL ÀÔ·ÂÈ­¸é(Á¢¼ÓÇϱâÀ§ÇÑ URLÀ» ÀÔ·ÂÇÑ´Ù. ÃßÈÄ¿¡ ¼³Á¤¿¡¼­ º¯°æ °¡´É)

¡æ Save and Finish ¹öÆ° Ŭ¸¯

<Á¢¼Ó URL È­¸é>

- Start using Jenkins ¹öÆ° Ŭ¸¯

- Á¨Å²½º ¼³Ä¡ ¿Ï·á

<¼³Ä¡ ¿Ï·á ÈÄ Ãʱâ Á¢¼Ó È­¸é>

Jenkins ¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.