http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=1224 [º¹»ç]
¸®´ª½º¿¡¼ Apache2, Tomcat5, JSP, Oracle9i ¿¬µ¿Çϱâ
¼³Ä¡È¯°æ
Red Hat 9.0(Kernel 2.4.20-8)
- Fedora Core2, Red Hat Enterprise Linux AS3¿¡¼µµ Àû¿ë Å×½ºÆ®
¼³Ä¡ ÆÐÅ°Áö ±¸¼º
Apache 2.0.49
J2SDK 1.4.2-04
Tomcat 5.0.25
JK2 Connector 2.0.4
¼³Ä¡°úÁ¤Àº J2SE ¼³Ä¡, Apache ¼³Ä¡, Tomcat ¼³Ä¡, Oracle ¿¬µ¿ÀÇ ¼ø¼´ë·Î ÁøÇàÇϸç, ÀÛ¾÷ ÁøÇà Áß ÇÊ¿äÇÑ ´Ù¿î·Îµå ¹ÞÀº ÆÄÀϵéÀº ¸ðµÎ /usr/local/src Æú´õ¿¡ ÀúÀåÇÏ´Â °ÍÀ¸·Î °¡Á¤ÇÕ´Ï´Ù.
1. J2SE ¼³Ä¡
http://java.sun.com/j2se/1.4.2/download.html ÀÇ Download J2SE v 1.4.2_04¿¡¼ SDK¸¦ ´Ù¿î·Îµå ¹Þ½À´Ï´Ù.
¹èÆ÷º» ÇüÅ´ 2°¡Áö·Î Çϳª´Â RPM ÆÄÀÏÀ» ¸¸µé¾îÁÖ´Â binary ÆÄÀÏÀÌ°í, ´Ù¸¥ Çϳª´Â ¹èÆ÷ÆÄÀÏÀÌ ÀÖ´Â ±× ÀÚ¸®¿¡¼ ¾ÐÃàÀ» Ç®¾î¼ ¼³Ä¡ÇÏ´Â ¹ÙÀ̳ʸ® ÆÄÀÏÀÔ´Ï´Ù. ·¹µåÇÞ ±â¹ÝÀÇ ¸®´ª½º¿¡¼´Â RPM ¼Ò½º Çü½ÄÀÇ ¹èÆ÷º»À» ´Ù¿î·Îµå ¹Þ¾Æ¼ ¼³Ä¡ÇÏ±æ ±ÇÀåÇÕ´Ï´Ù.
- RPM ¼Ò½º ¼³Ä¡
¹èÆ÷ÆÄÀÏ j2sdk-1_4_2_04-linux-i586-rpm.bin
/usr/local/src Æú´õ¿¡ ÀúÀåÇϱâ·Î °¡Á¤ ÇÏ¿´À¸¹Ç·Î ÇØ´ç Æú´õ·Î À̵¿ÇÏ¿© ´Ù¿î¹ÞÀº ÆÄÀÏÀÇ Æ۹̼ÇÀ» È®ÀÎÇÏ¿© ½ÇÇà°¡´ÉÇÑ Æ۹̼ÇÀ» °®µµ·Ï ¼³Á¤À» ÇÕ´Ï´Ù.
#> cd /usr/local/src
#> chmod 755 j2sdk-1_4_2_04-linux-i586-rpm.bin
#> ./j2sdk-1_4_2_04-linux-i586-rpm.bin
»ç¿ë±Ç °è¾àÀÌ È¸é¿¡ Ãâ·ÂµÇ¸é y ¶Ç´Â yes¸¦ ÀÔ·ÂÇÏ¿© µ¿ÀÇÇÕ´Ï´Ù. ÀÌ ÈÄ ¼³Ä¡°¡ °è¼Ó ÁøÇàµÇ¾î j2sdk-1_4_2_03-linux-i586.rpm ÆÄÀÏÀÌ »ý¼ºµË´Ï´Ù. »ý¼ºµÈ RPM ÆÄÀÏÀ» ¼³Ä¡ÇÕ´Ï´Ù.
#> rpm -ivh j2sdk-1_4_2_03-linux-i586.rpm
/usr/java/j2sdk1.4.2_04 µð·ºÅ丮°¡ »ý¼ºµÇ¸é¼ ÀÌ °÷¿¡¼ ¼³Ä¡°¡ ÀÌ·ç¾îÁý´Ï´Ù.
¼³Ä¡µÈ Æú´õ¸¦ link¸¦ ÀÌ¿ëÇÏ¿© º°·Î À̸§À¸·Î ÁöÁ¤ÇÕ´Ï´Ù.
#> ln –s /usr/java/j2sdk1.4.2_04 /usr/java/j2sdk
ÀÌ·¸°Ô ¸µÅ©¸¦ °É¾îµÎ¸é ³ªÁß¿¡ ÀÚ¹Ù ¹öÁ¯ÀÌ ¾÷µÈ ÆÐÅ°Áö°¡ ³ª¿À´õ¶óµµ ¾Æ·¡¿¡ ÀÛ¾÷ÇÒ È¯°æ ÆÄÀÏÀÇ ¼öÁ¤À» ÇÏÁö ¾Ê°í ÇØ´ç Æú´õÀÇ link¸¸ º¯°æÇØ ÁÖ¸é µÇ°í. ¾Æ·¡ ȯ°æ ÆÄÀÏÀ» ¼öÁ¤Çϱ⵵ ¼ö¿ùÇÕ´Ï´Ù.
/etc/profileÀ» ÆíÁýÇÏ¿© PATH ¼³Á¤À» ÇØÁÝ´Ï´Ù.
profile ùºÎºÐ¿¡ ´ÙÀ½À» Ãß°¡ÇØÁÝ´Ï´Ù.
#> vi /etc/profile
JAVA_HOME=/usr/java/j2sdk
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
º¯°æµÈ ¼³Á¤À» ½Ã½ºÅÛ¿¡ Àû¿ë½Ãŵ´Ï´Ù.
#> source /etc/profile
ÀÓÀÇÀÇ À§Ä¡¿¡¼ java¸¦ ½ÇÇà½Ãŵ´Ï´Ù.
#> java
JAVA optionµéÀÌ È¸é¿¡ Ãâ·ÂµÇ¸é ¼º°øÀûÀ¸·Î ¼³Ä¡°¡ ÀÌ·ç¾îÁø °ÍÀÔ´Ï´Ù.
- binary ¹èÆ÷º» ¼³Ä¡
¹èÆ÷ÆÄÀÏ j2sdk-1_4_2_04-linux-i586.bin
¼³Ä¡ÇÒ °æ·Î·Î ÆÄÀÏÀ» ¿Å±é´Ï´Ù. ¼³Ä¡ ÇÒ À§Ä¡´Â »ç¿ëÀÚ°¡ ÀÓÀÇ·Î Á¤Çؼ »ç¿ëÇÒ ¼ö ÀÖÀ¸¸ç
¿©±â¼´Â /usr/local ¿¡ J2SE¸¦ ¼³Ä¡ÇÏ´Â °ÍÀ¸·Î °¡Á¤ÇÏ°Ú½À´Ï´Ù.
#> mv j2sdk-1_4_2_04-linux-i586.bin /usr/local
#> cd /usr/local
Æ۹̼ÇÀ» È®ÀÎÇÏ¿© ÆÄÀÏÀÌ ½ÇÇà°¡´ÉÇϵµ·Ï ±ÇÇÑÀ» ¼³Á¤ÇÕ´Ï´Ù.
#> chmod 755 j2sdk-1_4_2_04-linux-i586.bin
ÆÄÀÏÀ» ½ÇÇà½ÃÄѼ J2SE¸¦ ¼³Ä¡ÇÕ´Ï´Ù.
#> ./ j2sdk-1_4_2_04-linux-i586.bin
¸ÕÀú ȸ鿡 »ç¿ë±Ç °è¾àÀÌ Ãâ·ÂµË´Ï´Ù. »ç¿ë±Ç °è¾à¿¡ µ¿ÀÇÇϱâ À§ÇØ y ¶Ç´Â yes¸¦ ÀÔ·ÂÇÏ¸é ¾ÐÃàÀÌ Ç®¸®¸é¼ SDK°¡ ¼³Ä¡µË´Ï´Ù. ¼³Ä¡°æ·Î´Â /usr/local/j2sdk1.4.2_04 ÀÔ´Ï´Ù. ¿ª½Ã ¼³Ä¡µÈ Æú´õ¸¦ link¸¦ ÀÌ¿ëÇÏ¿© º°·Î À̸§À¸·Î ÁöÁ¤ÇÕ´Ï´Ù.
#> ln –s /usr/local/j2sdk1.4.2_04 /usr/local/j2sdk
PATH¸¦ ¼³Á¤ÇØÁÝ´Ï´Ù. PATH ¼³Á¤Àº /etc/profileÀ» ÆíÁýÇÏ¿© ÀÌ·ç¾îÁý´Ï´Ù. /etc/profileÀ» ¿¡µðÅÍ·Î ¿¾î¼ ÆÄÀÏ Ã¹ ºÎºÐ¿¡ ´ÙÀ½À» Ãß°¡ÇÕ´Ï´Ù.
#> vi /etc/profile
JAVA_HOME=/usr/local/j2sdk
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
º¯°æµÈ ¼³Á¤À» ½Ã½ºÅÛ¿¡ Àû¿ë½Ãŵ´Ï´Ù.
#> source /etc/profile
ÀÓÀÇÀÇ À§Ä¡¿¡¼ java¸¦ ½ÇÇà½Ãŵ´Ï´Ù.
#> java
JAVA optionµéÀÌ È¸é¿¡ Ãâ·ÂµÇ¸é ¼º°øÀûÀ¸·Î ¼³Ä¡°¡ ÀÌ·ç¾îÁø °ÍÀÔ´Ï´Ù
Âü°í»çÇ×
- J2SEÀÇ ¹èÆ÷º»Àº JRE(Java Runtime Environment)¿Í SDK(Software Development Kit)·Î ³ª´µ¾îÁý´Ï´Ù. JRE´Â ÀÚ¹Ù·Î °³¹ßµÈ ¼ÒÇÁÆ®¿þ¾î¸¦ ½ÇÇà½ÃÅ°´Â µ¥ ÇÊ¿äÇÑ ÆÐÅ°ÁöÀÌ°í SDK´Â ÀÚ¹Ù¸¦ »ç¿ëÇÏ¿© ¼ÒÇÁÆ®¿þ¾î¸¦ °³¹ßÇÏ´Â °³¹ßÀÚµéÀ» À§ÇÑ ÆÐÅ°ÁöÀÔ´Ï´Ù. µû¶ó¼ °³¹ßÀ» ¸ñÀûÀ¸·Î ÀÚ¹Ù¸¦ ¼³Ä¡ÇÏ·Á´Â »ç¶÷Àº SDK¸¦ ´Ù¿î·Îµå ¹Þ¾Æ¼ ¼³Ä¡Çϱ⠹ٶø´Ï´Ù.
- /etc/profileÀº ·Î±×Àνà ÇÊ¿äÇÑ È¯°æÀ» ¼³Á¤ÇØÁÖ´Â ¼³Á¤ÆÄÀÏ·Î ½©½ºÅ©¸³Æ®·Î ÀÌ·ç¾îÁ®ÀÖ½À´Ï´Ù. profileÀÇ ³»¿ëÀ» Àß ÀÌÇØÇϽô ºÐÀº ÀÚ¹Ù ½ÇÇàÆÄÀÏÀÌ À§Ä¡ÇÑ JAVA_HOME/bin µð·ºÅ丮ÀÇ PATH°¡ Àß ÀÌ·ç¾îÁöµµ·Ï ÀÓÀÇ·Î º¯°æÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÚ¹Ù´Â PATH¿¡ »ó°ü¾øÀÌ ¹èÆ÷ÆÄÀÏÀ» ½ÇÇà½ÃÄѼ ¶Ç´Â ¹èÆ÷ÆÄÀÏÀ» ½ÇÇà½ÃÄѼ »ý¼ºµÈ RPMÀ» ¼³Ä¡ÇÔÀ¸·Î installÀÌ ¿Ï·áµÈ °ÍÀÔ´Ï´Ù. PATH ¼³Á¤Àº ¼³Ä¡µÈ ÀÚ¹Ù¸¦ ÀÓÀÇÀÇ À§Ä¡¿¡¼ Æí¸®ÇÏ°Ô »ç¿ë °¡´ÉÇϵµ·Ï Çϱâ À§ÇÑ °ÍÀÔ´Ï´Ù.
- ÀÚ¹ÙÀÇ °ø½Ä »çÀÌÆ® http://java.sun.com ¿¡¼ ´õ ¸¹Àº Á¤º¸µéÀ» ¾òÀ» ¼ö ÀÖ½À´Ï´Ù.
2. Apache ¼³Ä¡
±âÁ¸¿¡ Á¸ÀçÇÏ´Â RPM ÆÐÅ°Áö¸¦ ã¾Æ¼ »èÁ¦ÇÕ´Ï´Ù.
# rpm -qa | grep httpd
# rpm -e [httpd RPM name]
ÇÁ·Î¼¼½º¸¦ È®ÀÎÇÏ¿© ÇöÀç Apache À¥µ¥¸óÀÌ ½ÇÇàµÇ°í ÀÖ´ÂÁö È®ÀÎ ÇÕ´Ï´Ù.
#> ps –ef |grep httpd
ÀÛµ¿ÁßÀÎ Httpd µ¥¸óÀÌ ¸ñ·Ï¿¡ ³ªÅ¸³ª¸é Á¾·á ½Ãŵ´Ï´Ù.
#> /etc/init.d/httpd stop
°Á¦·Î Á¾·á ½Ãų¶§´Â kill [PID] ¸í·É¾î¸¦ ÀÌ¿ëÇÕ´Ï´Ù.
http://httpd.apache.org/download.cgi ¿¡¼ Apache¸¦ ´Ù¿î·Îµå ¹Þ½À´Ï´Ù. ¸®´ª½º¿¡¼ ¼³Ä¡ÇÒ ApacheÀÇ ¹èÆ÷º»Àº ¸ðµÎ ¼Ò½º Çü½ÄÀ¸·Î Á¦°øµË´Ï´Ù.
-> ¹èÆ÷ÆÄÀÏ httpd-2.0.49.tar.gz
#> cd /usr/local/src
#> tar xvfz httpd-2.0.49.tar.gz
¾ÐÃàÀÌ ÇØÁ¦µÇ¸é »ý¼ºµÈ µð·ºÅ丮 httpd-2.0.49·Î À̵¿ÇÕ´Ï´Ù.
#> cd httpd-2.0.49
¸®´ª½º¿¡¼ ¼Ò½ºÆÄÀÏ ¼³Ä¡´Â ´ÙÀ½°úÁ¤À¸·Î ¼³Ä¡ µË´Ï´Ù.
#> ./configure –options : ¼³Ä¡È¯°æ ¼³Á¤
#> make : ¼³Á¤µÈ ȯ°æÀ¸·Î ÄÄÆÄÀÏ
#> make install : ÄÄÆÄÀÏ µÈ ÆÄÀÏ ¼³Ä¡
´ÙÀ½°ú °°ÀÌ Apache ¼³Ä¡¸¦ ÁøÇà ÇÕ´Ï´Ù.
#> ./configure --enable-layout=RedHat
--enable-rule=SHARED_CORE
--enable-modules=so
--enable-so
¶Ç´Â –enable-layout=RedHat ¿É¼Ç ´ë½Å –prefix=/www ¿É¼ÇÀ» Àû¿ëÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
#> ./configure --prefix=/www
--enable-rule=SHARED_CORE
--enable-modules=so
--enable-so
#> make
#> make install
À§ÀÇ °úÁ¤À¸·Î ¼³Ä¡¸¦ ÁøÇàÇϸé configure´Ü°è¿¡¼ ÁöÁ¤ÇÑ ¿É¼Ç¿¡ µû¶ó ApacheÀÇ È¯°æÀÌ ¾Æ·¡¿Í °°Àº °æ·Î¿¡ ¼³Á¤ µË´Ï´Ù. ÀÌ ¼³Á¤Àº ´ÙÀ½¿¡ ÁøÇà ÇÒ ÀÛ¾÷µé¿¡¼ º°µµ·Î ÁöÁ¤µÇ¹Ç·Î ÀÚ½ÅÀÇ ¼³Á¤¿¡ µû¸¥ ÆÄÀϵéÀÇ ÀúÀå °æ·Î¸¦ È®ÀÎÇÏ°í ÁøÇà Çϱ⠹ٶø´Ï´Ù.
±¸ºÐ
--enable-layout=RedHat
--prefix=/www
½ÇÇàÆÄÀÏ À§Ä¡
/usr/sbin
/www/bin
¼³Á¤ÆÄÀÏ À§Ä¡
/etc/httpd/conf
/www/conf
¼ºñ½º±âÁØÀ§Ä¡
/var/www
/www
html root À§Ä¡
/var/www/html
/www/htdocs
libÆÄÀÏ À§Ä¡
/usr/lib/apache/
/www/lib
¾Æ·¡¿¡ ÁøÇàÇÒ ¼³¸íÀº --enable-layout=RedHat¿É¼ÇÀ» ±âÁØÀ¸·Î Çϸç --prefix=/www¿É¼ÇÀ¸·Î ¼³Á¤ÇÏ¿´À» °æ¿ì´Â ÇØ´ç¼³¸í¿¡¼ °ýÈ£ ¾È¿¡ À½¿µÃ³¸®·Î ±¸ºÐÇϵµ·Ï ÇÏ°Ú½À´Ï´Ù.
·¹µåÇÞ ±â¹ÝÀÇ ¸®´ª½º´Â ±âº»ÀûÀ¸·Î À¥¼¹ö·Î Apache¸¦ »ç¿ëÇϱ⠶§¹®¿¡ ¸®´ª½º ¼³Ä¡ ÈÄ Ãß°¡ÀûÀÎ ¾÷±×·¹ÀÌµå ¾øÀÌ Apache·Î À¥¼¹ö¸¦ ¿î¿µÇßÀ» °æ¿ì ±âÁ¸ÀÇ µð·ºÅ丮 ±¸Á¶¸¦ ±×´ë·Î À¯ÁöÇÏ°Ô µË´Ï´Ù. ÀÌ°ÍÀº configure ÁøÇà½Ã --enable-layout=RedHatÀ̶ó´Â ¿É¼ÇÀ» »ç¿ëÇ߱⠶§¹®ÀÔ´Ï´Ù. µð·ºÅ丮¿¡ ´ëÇÑ Á¤º¸´Â /usr/local/src/httpd-2.0.49/config.layout¿¡¼ È®ÀÎ ÇÒ ¼ö ÀÖ½À´Ï´Ù.
<Layout RedHat>
prefix: /usr
exec_prefix: ${prefix}
bindir: ${prefix}/bin
sbindir: ${prefix}/sbin
libdir: ${prefix}/lib
libexecdir: ${prefix}/lib/apache
mandir: ${prefix}/man
sysconfdir: /etc/httpd/conf
datadir: /var/www
installbuilddir: ${datadir}/build
errordir: ${datadir}/error
iconsdir: ${datadir}/icons
htdocsdir: ${datadir}/html
manualdir: ${datadir}/manual
cgidir: ${datadir}/cgi-bin
includedir: ${prefix}/include/apache
localstatedir: /var
runtimedir: ${localstatedir}/run
logfiledir: ${localstatedir}/log/httpd
proxycachedir: ${localstatedir}/cache/httpd
</Layout>
´ÙÀ½À¸·Î /etc/httpd/conf (--prefix=/www·Î ¼³Á¤ ÇÏ¿´À» °æ¿ì /www/conf ¿¡ ÀúÀåµÇ¹Ç·Î link¸¦ ÀÌ¿ëÇÏ¿© /etc/httpd/conf·Î ÇØ´ç Æú´õ¸¦ ¸µÅ©ÇØ µÎ¸é ¼öÁ¤Çϱ⿡ ¿ëÀÌ ÇÕ´Ï´Ù.) µð·ºÅ丮ÀÇ ¼³Á¤ÆÄÀÏÀ» º¯°æÇÕ´Ï´Ù. ¼³Ä¡ Àü¿¡ À¥¼¹ö¸¦ ¿î¿µÇÏ¸é¼ »ç¿ëµÈ ¼³Á¤ÆÄÀϵéÀº ¼³Ä¡ÇÏ¸é¼ º¯°æµÇÁö ¾Ê½À´Ï´Ù.
¼³Ä¡ ½Ã »ý¼ºµÈ ÆÄÀϵéÀº highperformance-std.conf, httpd-std.conf, ssl-std.conf ÀÔ´Ï´Ù. ÀÌ ¼¼ ÆÄÀϵéÀ» °¢°¢ highperformance.conf, httpd.conf, ssl.conf ·Î À̸§À» º¯°æÇÏ¿© ±âÁ¸ÀÇ ÆÄÀÏ¿¡ µ¤¾î¾º¿ó´Ï´Ù.
¸®´ª½º¸¦ ¼³Ä¡ÇÏ¸é¼ ±âÁ¸¿¡ rpmÀ¸·Î µÈ À¥¼ºñ½º¸¦ ¼³Ä¡ÇÏÁö ¾Ê¾ÒÀ» °æ¿ì´Â ÇØ´ç Æú´õ¿Í ÆÄÀϵéÀÌ »õ·Î »ý¼ºµÇ¾î ¼³Ä¡µÇ¹Ç·Î º°µµ º¹»çÀÛ¾÷À» ÇÏÁö ¾Ê¾Æµµ ÇØ´ç ÆÄÀÏÀÌ »ý¼ºµÇ¾î ÀÖ½À´Ï´Ù.
/usr/sbin/apachectl (/www/bin/apachectl) ½ÇÇàÆÄÀÏÀ» ÀÌ¿ëÇÏ¿© À¥µ¥¸óÀ» ½ÇÇà½ÃÄѺ¾´Ï´Ù.
Apache ¼³Ä¡ Àü À¥µ¥¸óÀ» ÁßÁö½ÃÄ×´Ù¸é ´ÙÀ½°ú °°ÀÌ ½ÇÇàÀÌ µÉ °ÍÀÔ´Ï´Ù.
#> /usr/sbin/apachectl start (/www/bin/apachectl start)
httpd: Could not determine the server's fully qualified domain name, using 127.0
.0.1 for ServerName
ÀÌ ¸Þ½ÃÁö´Â /etc/httpd/conf/httpd.conf ¼³Á¤ÆÄÀÏÀ» ¼öÁ¤ÇÏÁö ¾Ê¾Ò±â ¶§¹®¿¡ Ç¥½ÃµÇ´Â °ÍÀÔ´Ï´Ù. ±×·¯³ª À¥µ¥¸óÀº Àß µ¿ÀÛÇÏ°í ÀÎÅͳÝÀ» ÅëÇØ Á¢¼ÓÀÌ °¡´ÉÇÕ´Ï´Ù.
start ¸í·É¿Ü¿¡ stop°ú restart ¸í·ÉÀ» »ç¿ëÇÏ¿© À¥µ¥¸ó °¡µ¿À» ÁßÁö½ÃÅ°°Å³ª Àç½ÃÀÛÇÒ ¼ö ÀÖ½À´Ï´Ù.
#> /usr/sbin/apachectl restart (/www/bin/apachectl restart)
#> /usr/sbin/apachectl stop (/www/bin/apachectl stop)
ºÎÆýà ÀÚµ¿À¸·Î httpd µ¥¸óÀÌ ½ÇÇàµÇµµ·Ï ¼³Á¤ÇÕ´Ï´Ù.
/usr/sbin/apachectl (/www/bin/apachectl) ÆÄÀÏÀ» /etc/init.d µð·ºÅ丮¿¡ httpd·Î À̸§À» º¯°æÇÏ¿© º¹»çÇÕ´Ï´Ù. ±âÁ¸¿¡ httpd ÆÄÀÏÀÌ Á¸ÀçÇÒ °æ¿ì µ¤¾î ¾º¿ó´Ï´Ù. ±×¸®°í /etc/rc.d/rc0.d, /etc/rc.d/rc3.d, /etc/rc.d/rc5.d µð·ºÅ丮¿¡ /etc/rc.d/init.d/httpd ÀÇ symbolic link ÆÄÀÏÀÌ ÀÖ´ÂÁö È®ÀÎÇÏ°í ¾øÀ¸¸é link ÆÄÀÏÀ» »ý¼ºÇÕ´Ï´Ù.
#> ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc0.d/K90httpd
#> ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S89httpd
#> ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S89httpd
À§ ¸í·É¾î ´ë½Å chkconfig ¸í·É¾î¸¦ ÀÌ¿ëÇÏ¿© °¢ ½ÇÇà·¹º§¿¡¼ httpdµ¥¸óÀÌ ÀÚµ¿ ½ÇÇà µÇµµ·Ï ¼³Á¤ÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
#> su – (root ¸¸ÀÌ ½ÇÇà·¹º§À» º¯°æÇÒ ¼ö ÀÖÀ½)
#> chkconfig –level 35 httpd on
httpd µ¥¸óÀ» ½ÇÇà ·¹º§ 3, 5·¹º§¿¡¼ ÀÚµ¿ ½ÇÇà ½ÃÅ°µµ·Ï ¼³Á¤ÇÏ´Â ³»¿ëÀÔ´Ï´Ù.
¸¶Áö¸·À¸·Î /etc/httpd/conf/httpd.conf ÆÄÀÏÀÇ ¼³Á¤À» º¯°æÇÕ´Ï´Ù.
±âº»ÀûÀ¸·Î º¯°æÇؾßÇÒ ºÎºÐÀº
#servername www.example.com:80
À¸·Î #À» Á¦°ÅÇÏ°í www.example.comÀ» À¥¼¹öÀÇ domain nameÀ¸·Î ¼öÁ¤ÇØ Áְųª localhost·Î Àû¾îÁÝ´Ï´Ù.
servername hostname.domainname:80
¶Ç´Â
servername localhost:80
µÚÀÇ 80À̶ó´Â ¼ýÀÚ´Â À¥¼¹ö°¡ ÀÌ¿ëÇÒ port ¹øÈ£¸¦ °¡¸®Åµ´Ï´Ù.
À¥¼¹ö´Â ±âº»ÀûÀ¸·Î 80¹ø port¸¦ »ç¿ëÇϸç Ưº°ÇÑ °æ¿ì°¡ ¾Æ´Ï¶ó¸é º¯°æÇÏÁö ¾Ê±â¸¦ ¹Ù¶ø´Ï´Ù.
ÇѱÛÀ» Áö¿øÇϱâ À§Çؼ AddDefaultCharset ISO-8859-1 ºÎºÐÀ» ã¾Æ¼ AddDefaultCharset utf8 ¶Ç´Â AddDefaultCharset euc_kr ·Î º¯°æÇÕ´Ï´Ù.
httpd.conf ¼³Á¤ÆÄÀÏÀº Apache À¥¼¹ö¸¦ ½Ã½ºÅÛ¿¡ ¸Â°Ô ±¸µ¿½ÃÅ°´Âµ¥ ¸Å¿ì Áß¿äÇÑ Á¤º¸µéÀ» ´ã°í ÀÖ½À´Ï´Ù.
Apache HTTP Server Version 2.0 ¹®¼ http://httpd.apache.org/docs-2.0/ ¸¦ Âü°íÇϽñ⠹ٶø´Ï´Ù.
À§ÀÇ °úÁ¤À¸·Î Apache À¥¼¹öÀÇ ¼³Ä¡°¡ ³¡³µ½À´Ï´Ù.
±×·¯³ª ¾ÆÆÄÄ¡ À¥¼¹ö´Â °ü¸®ÀÚ°¡ ¸ðµâµéÀ» ¼±ÅÃÇÏ¿© ¼¹ö¿¡ Æ÷ÇÔÇÒ ±â´ÉÀ» °áÁ¤ÇÒ ¼ö ÀÖ´Â ¸ðµâÈµÈ ÇÁ·Î±×·¥À¸·Î ¸ðµâÀÇ °³³ä ¹× »ç¿ë¹ý, µ¿Àû°øÀ¯°´Ã¼(DSO) µîÀ» ÀÌÇØÇÏ¿©¾ß ¾ÆÆÄÄ¡ÀÇ È®ÀåµÈ ±â´ÉÀ» »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. Áï, PHP¿Í °°Àº ÇÁ·Î±×·¡¹Ö ¾ð¾î¸¦ »ç¿ëÇÏ°íÀÚ ÇÒ °æ¿ì ¶Ç´Â ÀÚ¹ÙÀÇ Servlet ContainerÀÎ Tomcat°ú Apache À¥¼¹ö¿ÍÀÇ ¿¬µ¿Àº ¸ðµâÀ» ÅëÇÏ¿© ÀÌ·ç¾îÁý´Ï´Ù.
Àü¹ÝÀûÀÎ ³»¿ëÀº Apache HTTP Server Version 2.0 ¹®¼ http://httpd.apache.org/docs-2.0/ ¿¡ ÀÖ½À´Ï´Ù. ¿©±â¼´Â ±âº»ÀûÀ¸·Î ÇÊ¿äÇÑ »çÇ׿¡ ´ëÇؼ¸¸ ¼³¸íÇÏ°Ú½À´Ï´Ù.
Âü°í»çÇ×
* apache configure ¿É¼Ç (autoconf Ãâ·Â ¿É¼Ç)
--help
¸ðµç ¿É¼Ç°ú »ç¿ë¹ýÀ» ȸ鿡 Ãâ·ÂÇØÁÝ´Ï´Ù. ½ÇÁ¦·Î configure°¡ ÀÌ·ç¾îÁöÁö ¾Ê½À´Ï´Ù.
--prefix=/usr/local/share/apache
Apache À¥¼¹ö°¡ ¼³Ä¡µÉ µð·ºÅ丮¸¦ ¼³Á¤ÇÕ´Ï´Ù. ÀÌ ¹®¼¿¡¼´Â RedHat¿¡ Æ÷ÇÔµÈ ApacheÀÇ ±âº» µð·ºÅ丮 ±¸Á¶¸¦ µû¶ó°¡°íÀÚ ÀÌ ¿É¼ÇÀ» »ç¿ëÇÏÁö ¾Ê°í --enable-layout=RedHatÀ̶ó´Â ¿É¼ÇÀ» »ç¿ëÇß½À´Ï´Ù.
--enable-layout=RedHat
ÀÌ ¿É¼ÇÀ» ÅëÇØ ¿©·¯°¡Áö Ç÷§Æû¿¡ ÇØ´çÇÏ´Â ÀûÀýÇÑ µð·ºÅ丮 ±¸Á¶¸¦ µû¶ó Apache¸¦ ¼³Ä¡ÇÒ ¼ö ÀÖ½À´Ï´Ù. °¢ Ç÷§ÆûÀÇ path layoutÀº config.layout ÆÄÀÏ¿¡ ±â·ÏµÇ¾î ÀÖ½À´Ï´Ù.
--enable-rule=SHARED_CORE
Apache ÄÄÆÄÀϽà ruleÀ» ÁöÁ¤ÇÕ´Ï´Ù. SHARED_CORE´Â DSO(Dynamic Shared Objects, µ¿Àû°øÀ¯°´Ã¼)¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Â ÇüÅ·ΠApache¸¦ ÄÄÆÄÀÏÇϵµ·Ï ÇÏ´Â ÀÏÁ¾ÀÇ ±ÔÄ¢ÀÔ´Ï´Ù. ÀÌ ¿É¼ÇÀ» ÁöÁ¤ÇØÁÖ¸é DSO·Î ÄÄÆÄÀÏµÈ ¾ÆÆÄÄ¡¿¡¼ Á¦°øÇÏÁö ¾Ê´Â ¿ÜºÎ ¸ðµâµéÀ» ¼±ÅÃÀûÀ¸·Î »ç¿ëÇÒ ¼ö ÀÖ°Ô µË´Ï´Ù. ±âº»ÇüÀº --enable-rule=[RULE-NAME]À¸·Î [RULE-NAME]¿¡ ÇØ´çÇÏ´Â ÄÄÆÄÀÏ ±ÔÄ¢À» enable½Ãŵ´Ï´Ù. --help ¿É¼ÇÀ¸·Î ³ªÅ¸³ª´Â µµ¿ò¸»¿¡¼´Â ÀÌ ¿É¼ÇÀ» Ç¥½ÃÇÏ°í ÀÖÁö ¾Ê½À´Ï´Ù.
--enable-modules=so
mod_so(so_module)¸¦ Apache¿¡ ÄÄÆÄÀÏÇÏ¿© Æ÷ÇÔ½Ãŵ´Ï´Ù.(¸ðµâÀÇ Á¤Àû ÄÄÆÄÀÏ)
±âº»ÇüÀº --enable-modules=[MODULE-LIST]·Î °ø¹éÀ¸·Î ±¸ºÐÇÑ [MODULE-LIST]¿¡ ³ª¿ÍÀÖ´Â ¸ðµâµéÀ» ÄÄÆÄÀÏÇÏ¿© Æ÷ÇÔÇÕ´Ï´Ù.
--enable-so
Apache°¡ ½ÇÇà½Ã Ưº°ÇÑ ¿É¼Ç¾øÀÌ ÀÚµ¿À¸·Î µ¿Àû°øÀ¯°´Ã¼(DSO-Dynamic Shared Objects)¸¦ ÀоîµéÀÏ ¼ö ÀÖµµ·Ï Çϱâ À§ÇÑ ¼³Á¤¿É¼ÇÀÔ´Ï´Ù.
ÀÌ¿Ü¿¡ ¿©·¯°¡Áö ¿É¼ÇµéÀÌ Á¦°øµË´Ï´Ù. Ãß°¡ÀûÀÎ »çÇ×Àº Apache HTTP Server Version 2.0 ¹®¼ http://httpd.apache.org/docs-2.0/ À» ã¾Æº¸°Å³ª --help ¿É¼ÇÀ¸·Î È®ÀÎÇϱ⠹ٶø´Ï´Ù.
* ¸ðµâ
Apache´Â ¸ðµâÈµÈ ¼³°è·Î ÀÌ·ç¾îÁø ÇÁ·Î±×·¥ÀÔ´Ï´Ù. ¸ðµâÀº Ưº°ÇÑ ±â´ÉÀ» ¼öÇàÇϱâ À§ÇÑ ÀÛÀº ÇÁ·Î±×·¥À¸·Î ÀÌÇØÇÒ ¼ö ÀÖ½À´Ï´Ù. Áï, ¸ðµâ¸¶´Ù °¢°¢ÀÇ ¿ªÇÒÀÌ ´Ù¸£±â ¶§¹®¿¡ ÇÙ½É ±¸ÇöºÎ ¶Ç´Â ½ÇÇàºÎ¿¡ Ãß°¡ÀûÀ¸·Î Æ÷ÇÔ½ÃÄÑ ¿øÇÏ´Â ±â´ÉÀ» ¼±ÅÃÀûÀ¸·Î »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ApacheÀÇ ÇÙ½É ±â´ÉÀ» ±¸ÇöÇÏ´Â ¸ðµâÀº coreÀÌ°í core¸¦ ±â¹ÝÀ¸·Î ¸ðµâÀ» Ãß°¡ÇÏ¿© È®ÀåµÈ ±â´ÉÀ» »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ¸ðµâÀº Apache ÄÄÆÄÀÏ ½Ã Á¤ÀûÀ¸·Î Æ÷ÇÔ½Ãų ¼ö ÀÖ°í, ¶Ç´Â DSO mechanism¿¡ ÀÇÇØ Apache ÄÄÆÄÀÏ ÀÌÈÄ Ãß°¡ÀûÀ¸·Î Æ÷ÇÔÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. DSO(Dynamic Shared Objects)¸¦ Áö¿øÇϱâ À§Çؼ´Â ÄÄÆÄÀÏ ½Ã configure ¿É¼ÇÀ¸·Î --enable-rule=SHARED_CORE¸¦ Ãß°¡ÇÏ¿© DSO Áö¿ø Çü½ÄÀ¸·Î Apache¸¦ ÄÄÆÄÀÏ ÇÏ¿©¾ß Çϸç, mod_so ¸ðµâÀ» ÄÄÆÄÀÏ ½Ã Æ÷ÇÔ½ÃÄÑ¾ß ÇÕ´Ï´Ù. mod_so ¸ðµâÀº core¸¦ Á¦¿ÜÇÏ°í DSO°¡ µÉ ¼ö ¾ø´Â À¯ÀÏÇÑ ¸ðµâ·Î¼ Apache Çٽɿ¡ Á¤ÀûÀ¸·Î ÄÄÆÄÀÏ ÇØ¾ß Çϸç, DSO·Î ÄÄÆÄÀÏ µÈ ¸ðµâÀ» Apache¿¡¼ ÀÐ¾î µéÀ̱â À§ÇÑ ±â´ÉÀ» Á¦°øÇÕ´Ï´Ù. µû¶ó¼ configureÁøÇà ½Ã ÀϹÝÀûÀ¸·Î mod_so¸¦ Æ÷ÇÔÇϵµ·Ï ÇÕ´Ï´Ù. ³ª¸ÓÁö ¸ðµâ¿¡ °üÇÏ¿©´Â Apache Document¸¦ Âü°íÇϱ⠹ٶø´Ï´Ù.
* µ¿Àû°øÀ¯°´Ã¼(DSO-Dynamic Shared Objects)
Apache°¡ µ¿ÀûÀ¸·Î loadÇÒ ¼ö ÀÖ´Â °´Ã¼ÀÔ´Ï´Ù. core¿Í mod_so¸¦ Á¦¿ÜÇÑ ´Ù¸¥ ¸ðµç ¾ÆÆÄÄ¡ ¸ðµâ ¼Ò½º¸¦ DSO Çü½ÄÀÇ ¸ðµâ·Î ÄÄÆÄÀÏ ÇÏ¿© Apache¿¡¼ loadÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. DSO·Î »ç¿ëÇÒ ¾ÆÆÄÄ¡ ¸ðµâÀ» ½±°Ô ¸¸µé±â À§Çؼ apxs(Apache Extension Tool)¶ó´Â Áö¿øÇÁ·Î±×·¥ÀÌ ÀÖ½À´Ï´Ù. ÀÌ ÇÁ·Î±×·¥À¸·Î ¾ÆÆÄÄ¡ ¹èÆ÷º» ¼Ò½º Æ®¸® ¾øÀÌ, DSO Áö¿øÀ» À§ÇÑ Ç÷§Æû ƯÀ¯ÀÇ ÄÄÆÄÀÏ·¯ ¿É¼Ç°ú ¸µÄ¿ ¿É¼ÇÀ» °í·ÁÇÏÁö ¾Ê°í ¸ðµâ ¼Ò½º¸¦ DSO ¸ðµâ·Î ½±°Ô ÄÄÆÄÀÏ ÇÒ ¼ö ÀÖ½À´Ï´Ù. PHP¿Í Tomcat µî ¿ÜºÎ ÇÁ·Î±×·¥¿¡¼ Á¦°øÇÏ´Â DSO ¸ðµâÀº ÇÁ·Î±×·¥ configure½Ã apxs¸¦ »ç¿ëÇÑ ¿É¼ÇÀ» ÅëÇØ ÇÁ·Î±×·¥°ú ÇÔ²² ÄÄÆÄÀÏ µÇ¾î »ý¼ºµË´Ï´Ù. ÀÚ¼¼ÇÑ »çÇ×Àº Apache Document ³»ÀÇ µ¿Àû°øÀ¯°´Ã¼(DSO) http://httpd.apache.org/docs-2.0/dso.html ¹®¼¸¦ Âü°íÇϱ⠹ٶø´Ï´Ù.
´ÙÀ½Àº Apache HTTP Server Project »çÀÌÆ®¿¡¼ Á¦°øÇÏ´Â ¹®¼ÀÔ´Ï´Ù. ÀÌ ¹®¼¸¦ ÅëÇØ Apache¿¡ ´ëÇØ ´õ À¯ÀÍÇÑ Á¤º¸µéÀ» ¾òÀ» ¼ö ÀÖ½À´Ï´Ù.
Apache HTTP Server Version 2.0 ¹®¼ http://httpd.apache.org/docs-2.0/
3. Tomcat ¼³Ä¡
- ¹ÙÀ̳ʸ® ¼³Ä¡
http://jakarta.apache.org/site/binindex.cgi¿¡¼ Tomcat 5.0.25ÀÇ tarball Çü½ÄÀÇ ¹èÆ÷º»À» ´Ù¿î·Îµå ¹Þ½À´Ï´Ù.
¹èÆ÷ÆÄÀÏ Jakarta-tomcat-5.0.25.tar.gz
´Ù¿îÆÄÀÏÀÇ ÀúÀåÀ§Ä¡ÀÎ /usr/local/src¿¡¼ ¼³Ä¡ÇÏ°íÀÚ ÇÏ´Â °æ·Î·Î ÆÄÀÏÀ» º¹»çÇÏ¿© ¾ÐÃàÀ» Ç®¾îÁÝ´Ï´Ù. ¹ÙÀ̳ʸ® ¹èÆ÷º»Àº ¾ÐÃàÀ» Ç®¾îÁÜÀ¸·Î ±âº»ÀûÀÎ ¼³Ä¡°¡ ¿Ï·áµÈ °ÍÀÔ´Ï´Ù.
#> cd /usr/local/src
#> cp jakarta-tomcat-5.0.25.tar.gz /usr/local
#> cd /usr/local
#> tar xvfz jakarta-tomcat-5.0.25.tar.gz
Jakarta-tomcat-5.0.25 µð·ºÅ丮°¡ »ý¼ºµÇ°í ¾ÐÃàÀÌ Ç®¸³´Ï´Ù.
¿ª½Ã ÇØ´ç Æú´õ¸¦ link¸¦ ÀÌ¿ëÇÏ¿© tomcat À̶ó´Â °æ·Î·Î ÁöÁ¤ÇÕ´Ï´Ù.
#> ln –s /usr/local/Jakarta-tomcat-5.0.25 /usr/local/tomcat
½ÇÇàÆÄÀÏÀÌ µé¾îÀÖ´Â µð·ºÅ丮·Î À̵¿Çؼ TomcatÀ» ½ÇÇà½ÃÄѺ¾´Ï´Ù. TomcatÀº bin µð·ºÅ丮ÀÇ catalina.sh ¶Ç´Â startup.sh ÆÄÀÏÀ» ½ÇÇà½ÃÄѼ ÀÛµ¿½Ãŵ´Ï´Ù.
#> cd /usr/local/tomcat/bin
#> ./catalina.sh start
¶Ç´Â
#> ./startup.sh
Using CATALINA_BASE: /usr/local/share/Jakarta-tomcat-5.0.25
Using CATALINA_HOME: /usr/local/share/Jakarta-tomcat-5.0.25
Using CATALINA_TMPDIR: /usr/local/share/Jakarta-tomcat-5.0.25/temp
Using JAVA_HOME: /usr/java/j2sdk1.4.2_03
À§ÀÇ ¸Þ½ÃÁö°¡ ³ª¿À¸é TomcatÀÌ Á¤»óÀûÀ¸·Î ÀÛµ¿ÇÏ´Â °ÍÀÔ´Ï´Ù. Ŭ¶óÀ̾ðÆ®¿¡¼ À¥ºê¶ó¿ìÀú¸¦ ÅëÇØ ´ÙÀ½ÀÇ ÁÖ¼Ò·Î Á¢¼ÓÇÕ´Ï´Ù.
http://localhost:8080 ¶Ç´Â http://¼³Ä¡ÇѼ¹öÀÇÁÖ¼Ò:8080
Á¤»óÀûÀ¸·Î TomcatÀÌ ÀÛµ¿ÇÏ°í ÀÖ´Ù¸é ºê¶ó¿ìÀú¿¡ Tomcat °ü·Ã ¹®¼°¡ ³ªÅ¸³¯ °ÍÀÔ´Ï´Ù.
¸¸ÀÏ, Á¤»óÀûÀ¸·Î ÀÛµ¿ÇÏÁö ¾Ê´Â´Ù¸é J2SEÀÇ ¼³Ä¡°¡ Á¦´ë·Î ÀÌ·ç¾îÁöÁö ¾Ê¾Ò°Å³ª PATH ¼³Á¤ÀÌ ¿Ã¹Ù¸£°Ô ÀÌ·ç¾îÁöÁö ¾Ê¾Æ¼ÀÔ´Ï´Ù. /etc/profileÀ» ¿¡µðÅÍ·Î ¿¾î¼ J2SE ¼³Ä¡ ½Ã PATH ¼³Á¤ÇÑ ºÎºÐÀ» È®ÀÎÇØ º¾´Ï´Ù.
TomcatÀÇ Shut downÀº catalina.sh ¶Ç´Â shutdown.sh ÆÄÀÏÀ» ÀÌ¿ëÇÕ´Ï´Ù.
#> ./catalina.sh stop
¶Ç´Â
#> ./shutdown.sh
¸¶Áö¸·À¸·Î PATH¸¦ ¼³Á¤ÇØÁÝ´Ï´Ù. PATH ¼³Á¤Àº /etc/profileÀ» ÆíÁýÇÏ¿© ÀÌ·ç¾îÁý´Ï´Ù. /etc/profileÀ» ¿¡µðÅÍ·Î ¿¾î¼ J2SE ¼³Ä¡ ½Ã PATH ¼³Á¤ÇÑ ºÎºÐ¿¡ ´ÙÀ½À» Ãß°¡ÇÕ´Ï´Ù.
#> vi /etc/profile
JAVA_HOME=/usr/java/j2sdk (¶Ç´Â JAVA_HOME=/usr/local/j2sdk)
#JAVA_HOME´Â J2SE¸¦ rpmÀ̳ª ¹ÙÀ̳ʸ® Áß ÀÚ½ÅÀÌ ¼³Ä¡ÇÑ ¹æ½Ä¿¡ µû¶ó ÁöÁ¤ÇÕ´Ï´Ù.
CATALINA_HOME=/usr/local/tomcat
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export JAVA_HOME CATALINA_HOME
º¯°æµÈ ¼³Á¤À» ½Ã½ºÅÛ¿¡ Àû¿ë½Ãŵ´Ï´Ù.
#> source /etc/profile
PATH¸¦ ¼³Á¤ÇØÁÖ¾úÀ¸¹Ç·Î ÀÓÀÇÀÇ À§Ä¡¿¡¼ TomcatÀ» ½ÇÇà½Ãų ¼ö ÀÖ½À´Ï´Ù.
TomcatÀÌ ÇöÀç ¿î¿µ ÁßÀ̶ó¸é ShutdownÀ» ÇÏ°í ´Ù½Ã ½ÇÇà½Ãŵ´Ï´Ù.
#> ps -el
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦.
0 S 0 1012 1 0 85 0 - 61602 schedu ? 00:00:12 java
¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦.
#> catalina.sh stop
¶Ç´Â
#> shutdown.sh
#> catalina.sh start
¶Ç´Â
#> startup.sh
¼³Ä¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù.
Âü°í»çÇ×
* Java Servlet Container
JVM »ó¿¡¼ WEB ¼ºñ½º¸¦ À§ÇÑ Java Servlet API¸¦ ±¸ÇöÇÏ¿© ¼ºñ½º ÇØÁÖ´Â Java ProgramÀ¸·Î, Servlet Container´Â ClientÀÇ http ¿äûÀ» À¥¼¹ö¸¦ ÅëÇØ Àü´Þ¹Þ¾Æ¼ Application Servlet¿¡ Àü´ÞÇÏ°í, ServletÀÇ http ÀÀ´ä ¸Þ½ÃÁö¸¦ À¥¼¹ö¿¡°Ô Àü´ÞÇؼ Client·Î µ¹·ÁÁÖ´Â ¿ªÇÒÀ» ÇÑ´Ù.
* Servlet ContainerÀÇ Á¾·ù
1) Sun Microsystems Á¦°ø Servlet Container
JSDK(Java Servlet Development Kit)
JSWDK(JavaServer Web Development Kit)
J2EE(Java2 SDK, Enterprise Edition)
Java Web Server(iPlanet Web Server)
2) Apache Á¦°ø Servlet Container
Apache JServ, Tomcat
3) ±âŸ Servlet Container
JRun/JRun Pro, Resin, WebLogic, Web Sphere, IAS
* Tomcat
TomcatÀº Apache Software FoundationÀÇ Jakarta ÇÁ·ÎÁ§Æ®ÀÇ ÀÏȯÀ¸·Î °³¹ßÁßÀÎ ¼ÒÇÁÆ®¿þ¾îÀÔ´Ï´Ù.
TomcatÀº Java Servlet°ú Java Server Page¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÏ´Â Servlet ContainerÀÌ¸ç µ¶¸³ÀûÀ¸·Î À¥¼¹öÀÇ ±â´ÉÀ» ¼öÇàÇÕ´Ï´Ù. ±×·¯³ª ÀÏ¹Ý html ¹®¼µµ Servlet Container¸¦ ÅëÇØ ¹ø¿ªµÇ¹Ç·Î ¼öÇà¼Óµµ°¡ ´À¸®°í À¥¼¹ö·Î¼ÀÇ ±â´É¿¡ Á¦ÇÑÀÌ ÀÖÀ¸¹Ç·Î º¸Åë ´Ù¾çÇÑ ¸ðµâ°ú ¸·°ÇÑ ±â´ÉÀ» °¡Áö°í ÀÖ´Â Apache À¥¼¹ö¿Í ¿¬µ¿ÇÏ¿© »ç¿ëÇÕ´Ï´Ù.
¹èÆ÷º»Àº binary¿Í source Çü½ÄÀ¸·Î Á¦°øµË´Ï´Ù. ¿©±â¼´Â ¹ÙÀ̳ʸ® ¹èÆ÷º»ÀÇ ¼³Ä¡¸¸ ¼³¸íÇÕ´Ï´Ù. The Apache Jakarta Project ȨÆäÀÌÁöÀÇ Downloads ºÎºÐ¿¡ ÀÖ´Â CVS repositories´Â ÇöÀç °³¹ßÁßÀÎ ¼Ò½ºµéÀ» È®ÀÎÇÏ°í ´Ù¿î·Îµå ¹ÞÀ» ¼ö ÀÖ´Â ÆäÀÌÁöÀÔ´Ï´Ù. (CVS´Â Concurrent Version SystemÀÇ ¾à¾î·Î ¿ÀǼҽº ÇÁ·ÎÁ§Æ®¿¡¼ °³¹ßÁßÀÎ ¼Ò½ºÀÇ ¹öÀüÀ» °ü¸®ÇØÁÖ´Â ½Ã½ºÅÛÀÔ´Ï´Ù. CVS¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ »çÇ×Àº ÀÌ ¹®¼ÀÇ ¼º°Ý°ú ´Ù¸£¹Ç·Î ¾ð±ÞÇÏÁö ¾Ê°Ú½À´Ï´Ù. ÀÚ¼¼ÇÑ »çÇ×Àº CVS ¸Å´º¾óÀ» Âü°íÇϱ⠹ٶø´Ï´Ù.)
4. Tomcat Web Server Connector, JK2¸¦ ÀÌ¿ëÇÑ Apache2 À¥¼¹ö¿Í Tomcat5ÀÇ ¿¬µ¿
Apache¿Í TomcatÀÇ ¼³Ä¡°¡ ¿Ï·áµÇ¾úÀ¸¸é µÎ ¼¹ö¸¦ ¿¬µ¿ÇÏ´Â ÀÛ¾÷À» ÁøÇà ÇÕ´Ï´Ù.
The Apache Jakarta Project »çÀÌÆ®¿¡¼ JK2 connector¸¦ ´Ù¿î·Îµå ¹Þ½À´Ï´Ù. JK2ÀÇ binary ¹èÆ÷º»Àº Solaris¿Í WIN32¿ë ¸¸ÀÌ ¹èÆ÷µÇ°í ÀÖÀ¸¹Ç·Î ¼Ò½º ÇüÅÂÀÇ ¹èÆ÷º»À» ´Ù¿î·Îµå ¹Þ¾Æ¾ß ÇÕ´Ï´Ù. http://jakarta.apache.org/site/sourceindex.cgi ¿¡¼ JK 2.0.4 Source Release tar.gz¸¦ ´Ù¿î·Îµå ¹Þ½À´Ï´Ù.
¹èÆ÷ÆÄÀÏ jakarta-tomcat-connectors-jk2-src-current.tar.gz
JK2 connector ¼Ò½º¸¦ ÄÄÆÄÀÏ ÇÏ¸é ¾òÀ» ¼ö ÀÖ´Â °ÍÀÌ mod_jk2.so ¸ðµâÀÔ´Ï´Ù.
Apache À¥¼¹ö¿Í TomcatÀ» ¿¬µ¿ÇÒ mod_jk2.so ¸ðµâÀ» ¾ò´Â °ÍÀÌ ÄÄÆÄÀÏÀÇ ¸ñÀûÀÔ´Ï´Ù.
Àû´çÇÑ À§Ä¡¿¡¼ ¾ÐÃàÀ» Ç®¾îÁÝ´Ï´Ù. ¼Ò½ºµéÀ» ÄÄÆÄÀÏÇÏ°í ÇÊ¿äÇÑ ÆÄÀϵéÀ» À̵¿½ÃÅ°¸é ´õ ÀÌ»ó »ç¿ëÇÏÁö ¾Ê±â ¶§¹®¿¡ ´Ù¿î¹ÞÀº ±âº»Æú´õÀÎ /usr/local/src¿¡¼ ¾ÐÃàÀ» Ç®¾îÁÖ°Ú½À´Ï´Ù.
#> cd /usr/local/src
#> tar xvfz jakarta-tomcat-connectors-jk2-src-current.tar.gz
¾ÐÃàÀÌ Ç®¸®¸é ÇØ´ç µð·ºÅ丮·Î À̵¿ÇÕ´Ï´Ù. JK2 ¸ðµâÀ» ¾ò±â À§Çؼ´Â jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2·Î À̵¿ÇÕ´Ï´Ù.
#> cd /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
´ÙÀ½°ú °°ÀÌ configure¸¦ ½ÇÇàÇÏ°í make·Î ÄÄÆÄÀÏÀ» ÇÕ´Ï´Ù.
configure ¿É¼Ç(autoconf Ãâ·Â¿É¼Ç) --with-apxs2[=FILE]
#> ./configure --with-apxs2=/usr/sbin/apxs
#> make
Apache ¼³Ä¡°úÁ¤¿¡¼ –enable-layout=RedHat ¿É¼Ç´ë½Å –prefix=/www·Î ¼³Á¤ÇÏ°í ¼³Ä¡ÇÏ¿´À» °æ¿ì´Â
#> ./configure --with-apxs2=/www/bin/apxs
#> make
Apache 2.0 ¿¡¼ °øÀ¯ÇÒ DSO ¸ðµâÀ» buildÇϱâ À§ÇØ »ç¿ëÇÕ´Ï´Ù. FILEÀº Apache apxs toolÀÌ ÀÖ´Â °æ·Î¸¦ ³ªÅ¸³À´Ï´Ù.
make½Ã ¿¡·¯°¡ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ°ÍÀº autoconf ½ÇÇà Áß ¼³Á¤µÇ´Â Apache Ȩµð·ºÅ丮°¡ RedHat¿¡¼´Â /usrÀ̹ǷÎ, ÄÄÆÄÀÏ Áß¿¡ ÇÊ¿ä·Î ÇÏ´Â libtool ½ÇÇàÆÄÀÏÀ» /usr/build/ °æ·Î¿¡¼ ã´Âµ¥ RedHat¿¡¼´Â /var/www/build/ (/www/build)°æ·Î¿¡ Á¸ÀçÇϱ⠶§¹®ÀÔ´Ï´Ù. µû¶ó¼ ¹®Á¦°¡ ¹ß»ýÇÒ °æ¿ì¿¡´Â /var/www/build (/www/build)µð·ºÅ丮¸¦ /usr µð·ºÅ丮 ¹ØÀ¸·Î º¹»çÇϱ⠹ٶø´Ï´Ù.
¹®Á¦¾øÀÌ ¿Ï·áµÇ¾ú´Ù¸é, ÇöÀç À§Ä¡ÇÑ /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.4 -src/jk/native2 µð·ºÅ丮¸¦ ±âÁØÀ¸·Î ../build/jk2/apache2/ÀÇ °æ·Î¿¡ mod_jk2.so ÆÄÀÏÀÌ ¸¸µé¾îÁ³À» °ÍÀÔ´Ï´Ù. ÀÌ ÆÄÀÏÀ» ¾ÆÆÄÄ¡ ¸ðµâÀÌ ÀÖ´Â µð·ºÅ丮·Î º¹»çÇÕ´Ï´Ù.
#> pwd
/usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2
#> cd ../build/jk2/apache2
#> pwd
/usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2
#> ls (mod_jk2.so ÆÄÀÏÀÌ Á¸ÀçÇÏ´ÂÁö È®ÀÎÇÕ´Ï´Ù.)
#> cp mod_jk2.so /usr/lib/apache/ (/www/lib)
(·¹µåÇÞ¿¡¼´Â ¾ÆÆÄÄ¡ ¸ðµâÀÌ /usr/lib/apache(/www/lib) µð·ºÅ丮¿¡ À§Ä¡ÇÕ´Ï´Ù.)
/usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/conf/workers2.properties ÆÄÀÏÀ» /etc/httpd/conf/ À§Ä¡·Î º¹»çÇÕ´Ï´Ù.
#> cd /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/conf
#> cp workers2.properties /etc/httpd/conf
ÀÌ ÆÄÀÏÀº Apache À¥¼¹ö¿¡¼ JK2 ¸ðµâÀ» »ç¿ëÇÒ ¶§ ÇÊ¿äÇÑ ¿©·¯°¡Áö ¼³Á¤À» ÀúÀåÇÑ ÆÄÀÏÀÔ´Ï´Ù. ÀÌ ÆÄÀÏ ÀÌ¿Ü¿¡ jk2.properties ÆÄÀÏÀÌ Áß¿äÇѵ¥, workers2.properties ÆÄÀÏÀÌ Apache ÂÊ¿¡¼ JK2 ¸ðµâÀÇ ¼³Á¤À» ´ã´çÇÑ´Ù¸é, jk2.properties ÆÄÀÏÀº Tomcat ÂÊ¿¡¼ JK2 ¸ðµâÀ» ÅëÇÑ À¥¼¹ö¿ÍÀÇ ¿¬°á ¼³Á¤À» ´ã´çÇÕ´Ï´Ù. Tomcat 5.0 ¹öÀü¿¡¼´Â JK2 connector¸¦ ó¸®ÇÒ ¼ö ÀÖ´Â coyote connector°¡ ±âº»¼³Ä¡ µÇ¾î Àֱ⠶§¹®¿¡ jk2.properties ÆÄÀÏÀ» TomcatÀÇ conf µð·ºÅ丮·Î º¹»çÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù.
/etc/httpd/conf/httpd.conf ÆÄÀÏÀ» vi¿Í °°Àº ÆíÁý±â·Î ¿¾î LoadModule ºÎºÐÀ» ã¾Æ¼ ¾Æ·¡¿Í °°ÀÌ Ãß°¡ÇÏ°í, DirectoryIndex ºÎºÐÀ» ã¾Æ¼ index.jsp¸¦ Ãß°¡ÇÕ´Ï´Ù.
LoadModule jk2_module lib/apache/mod_jk2.so (/www/lib/mod_jk2.so)
¡¦
DirectoryIndex index.html index.html.var index.php index.phtml index.jsp
ÀúÀåÇÏ°í ÆíÁý±â¸¦ ³¡³À´Ï´Ù.
´ÙÀ½À¸·Î /etc/httpd/conf µð·ºÅ丮¿¡ º¹»çÇسõÀº workers2.properties¸¦ ¼öÁ¤ÇÕ´Ï´Ù. ¾Æ·¡ÀÇ ¼³Á¤ ³»¿ëÀ» ÇØ´ç ÆÄÀÏ ¸Ç ¾Æ·¡ ºÎºÐ¿¡ Ãß°¡ ÇÕ´Ï´Ù.
#> cd /etc/httpd/conf
#> vi worker2.properties
# Shared memory handling. Needs to be set.
[shm]
file=/var/log/httpd/shm.file (/www/logs/shm.file)
size=1048576
# Example socket channel, explicitly set port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Announce a "status" worker
[status:status]
# Uri mapping
[uri:/jsp-examples/*]
worker=ajp13:localhost:8009
[uri:/servlets-examples/*]
worker=ajp13:localhost:8009
[uri:/tomcat-docs/*]
worker=ajp13:localhost:8009
[uri:/*]
worker=ajp13:localhost:8009
[uri:/status/*]
worker=status:status
À̹ø¿£ /usr/local/tomcat/conf/jk2.properties¸¦ ¼öÁ¤ÇÕ´Ï´Ù.
#> cd /usr/local/tomcat/conf
#> vi jk2.properties
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.
## COMMENTS WILL BE _LOST_
## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.
# Set the desired handler list
# handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
channelSocket.port=8009
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm
shm.file=/var/log/httpd/jk2.shm (/www/logs/jk2.shm)
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so
# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
apr.jniModeSo=inprocess
(À§ ¼³Á¤³»¿ëÀº Æ÷½ºµ¥ÀÌŸ¢ß BPM »ç¾÷ÃßÁø¹Ý ÀåÀ±±â ´ë¸®´ÔÀÌ ÀÛ¼ºÇÑ <¾ÆÆÄÄ¡¿Í ÅèĹ ¿¬µ¿ ¹× ·Îµå ¹ß¶õ½Ì ±¸Çö>¿¡¼ ¹ßÃéÇÏ¿© ¼öÁ¤ÇÑ °ÍÀÔ´Ï´Ù.)
¸ðµç ¼³Á¤ÀÌ ³¡³µ½À´Ï´Ù. ½ÇÇà½ÃÅ°±â Àü¿¡ /usr µð·ºÅ丮¿¡¼ /etc/httpd/conf µð·ºÅ丮¿¡ ¿¬°áµÈ ¸µÅ© ÆÄÀÏÀ» ¸¸µé¾îÁÝ´Ï´Ù. ÀÌ°ÍÀº mod_jk2.so ¸ðµâÀ» ÄÄÆÄÀÏ ÇÒ ¶§ Apache Home Directory¸¦ /usr ·Î ÀνÄÇ߱⠶§¹®¿¡ workers2.properties ÆÄÀÏÀ» /usr/conf¿¡¼ ã±â ¶§¹®ÀÔ´Ï´Ù. ´ÙÀ½°ú °°ÀÌ ½ÇÇàÇÕ´Ï´Ù.
(ÀÌ ºÎºÐÀº ¾Õ °úÁ¤¿¡¼ /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2 µð·ºÅ͸®¿¡¼ ./configure --with-apxs2=/usr/sbin/apxs ¸í·É¾î·Î ȯ°æ ¼³Á¤À» Çϱâ Àü ./configure –help ¸í·ÉÀ» ÀÌ¿ëÇÏ¿© configuration optionÀ» È®ÀÎÇÏ¸é ³ªÅ¸³ª´Â optionÁß --with-apache2=DIR ¿É¼Ç¿¡ Apache ¼³Ä¡°úÁ¤¿¡ ÄÄÆÄÀÏ È¯°æ¿¡ µû¸¥ ¼³Ä¡À§Ä¡¸¦ ÁöÁ¤ÇÏ¸é µÉ µí Çѵ¥ °¢ÀÚ ÇØ º¸½Ã±æ¡¦. ÀÌ ¿Ü¿¡µµ --with-apache2-include=DIR, --with-apache2-lib=DIR, --with-java-home=DIR µîÀÇ ¿É¼ÇÀÌ ÀÖÀ¸¹Ç·Î ¼³¸íÀ» ÂüÁ¶ÇÏ¿© ´Ù¾çÇÑ ¿É¼ÇÀ» Àû¿ëÇÏ¿© ÄÄÆÄÀÏ ÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù)
#> cd /usr
#> ln -s /etc/httpd/conf ./conf
¸ðµç °úÁ¤ÀÌ ³¡³µÀ¸¸é Tomcat°ú Apache À¥¼¹ö¸¦ ½ÇÇà½Ãŵ´Ï´Ù. ps ¸í·É¾î·Î ÇöÀç ½ÇÇàÁßÀÎ process ¸ñ·ÏÀ» È®ÀÎÇؼ Tomcat°ú Apache°¡ °¡µ¿ÁßÀÎÁö È®ÀÎÇÏ°í, °¡µ¿ÁßÀ̶ó¸é ½ÇÇàÀ» ÁßÁö½Ãŵ´Ï´Ù. Âü°í·Î TomcatÀÇ Process CMD´Â javaÀÔ´Ï´Ù.
#> ps -el
(ÇÁ·Î¼¼½º°¡ Á¸ÀçÇÏ´ÂÁö È®ÀÎ)
#> catalina.sh stop
(ÇÁ·Î¼¼½º°¡ Á¸ÀçÇÏ¸é ½ÇÇàÁßÁö)
#> catalina.sh start
#> /etc/init.d/httpd stop
(Apache ÇÁ·Î¼¼½º°¡ Á¸ÀçÇÏ¸é ½ÇÇàÁßÁö)
#> /etc/init.d/httpd start
¶Ç´Â (Apache ÇÁ·Î¼¼½º°¡ Á¸ÀçÇÒ °æ¿ì)
#> /etc/init.d/httpd restart
Ŭ¶óÀ̾ðÆ®¿¡¼ http://serverURL ·Î ¿¬°áÇØ º¾´Ï´Ù. Apache Tomcat À¥ÆäÀÌÁö°¡ º¸À̸é Á¤»óÀûÀ¸·Î ¿¬µ¿µÇ¾î ÀÛµ¿ÇÏ´Â °ÍÀÔ´Ï´Ù.
jk2.propertiesÀÇ ¼³Á¤À» º¯°æÇÏ¿´À» °æ¿ì À̸¦ Àû¿ë½ÃÅ°±â À§Çؼ´Â TomcatÀ» Àç°¡µ¿ ½ÃÄÑÁÖ°í Apache ¶ÇÇÑ ´Ù½Ã ½ÇÇà½ÃÄÑÁÖ¾î¾ß ÇÕ´Ï´Ù. workers2.propertiesÀÇ ¼³Á¤À» º¯°æÇÑ °æ¿ì¿¡´Â Apache À¥¼¹ö¸¸ Àç°¡µ¿½Ãŵ´Ï´Ù.
Âü°í»çÇ×
- Apache Tomcat ¿¬µ¿¿¡¼ °¡Àå Áß¿äÇÑ ºÎºÐÀº ÀÚ½ÅÀÇ ½Ã½ºÅÛ ¶Ç´Â Á¦°øÇÏ·Á´Â ¼ºñ½º¿¡ ¾Ë¸ÂÀº ¼³Á¤ ÆÄÀÏÀ» ÀÛ¼ºÇÏ´Â °ÍÀÔ´Ï´Ù. ÀÌ ¹®¼¿¡¼´Â ±âº»ÀûÀÎ ¼³Ä¡¸¸À» ´Ù·ç°í Àֱ⠶§¹®¿¡ ÀÚ¼¼ÇÑ »çÇ×Àº Apache Jakarta ȨÆäÀÌÁö¸¦ ¹æ¹®Çؼ Tomcat 5.0 Document¸¦ Âü°íÇϱ⠹ٶø´Ï´Ù.
- Âü°í¹®¼
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/index.html Tomcat 5.0 Document
http://www.javamania.pe.kr/index2.html [ÀÚ¹ÙÀ̾߱â>ÀÚ·á½Ç] ¾ÆÆÄÄ¡¿Í ÅèĹ ¿¬µ¿ ¹× ·Îµå ¹ß¶õ½Ì ±¸Çö (ÀåÀ±±â ´Ô)
5. Tomcat ¼³Á¤À» ÀÌ¿ëÇÏ¿© ¼¹öÀÇ ÀÏ¹Ý »ç¿ëÀÚ °èÁ¤¿¡¼ JSP¼ºñ½º¸¦ Á¦°øÇϱâ
¾Æ·¡ ³»¿ëÀ» ¼öÁ¤ÇÕ´Ï´Ù.
# vi $CATALINA_HOME/conf/server.xml
<!-- Host ºÎºÐÀº ¿ø·¡ ÀÖ´Â ³»¿ë -->
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- Ãß°¡ ÇØ¾ß ÇÏ´Â ³»¿ë -->
<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="public_html"
userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
ÆÄÀÏ ÀúÀå ÈÄ¿¡ TomcatÀ» ¼ºñ½º¸¦ ´Ù½Ã Çѹø ½ÃÀÛÇØÁØ´Ù.
* ListenerÀ» Ãß°¡ÇÏ°Ô µÇ¸é
http://localhost:8080/~user_account (or http://localhost/~user_account)·Î Á¢±ÙÇÒ ¼ö ÀÖ´Ù.
* °èÁ¤º° Class Path »ç¿ëÇؼ Java Class¸¦ »ç¿ëÇÏ°í ½ÍÀº °æ¿ì
1. °¢ °èÁ¤º° ¼³Á¤
#> vi .bash_profile ¿¡¼
export CLASSPATH=`./public_html/WEB-INF/classes`
¸¦ Ãß°¡ÇÑ ÈÄ ÀúÀåÇÑ ÈÄ
#> source .bash_profile
#> startup.sh (ÅèĹ Àç°¡µ¿. or catalina.sh start
2. »ç¿ëÀÚ ¸ðµÎ ¼³Á¤½Ã
#> vi /etc/profile
export CLASSPATH=`/home/*/public_html/WEB-INF/classes`
¸¦ Ãß°¡ÇÑ ÈÄ ÀúÀåÇÑ´Ù.
#> source /etc/profile
#> startup.sh (ÅèĹ Àç°¡µ¿. or catalina.sh start
6. JSP¿¡¼ Oracle9i ¿¬µ¿Çϱâ
¿À¶óŬDB¸¦ ¿¬µ¿Çϱâ À§Çؼ´Â JDBCµå¶óÀ̹ö°¡ ÇÊ¿äÇÏ´Ù.
http://otn.oracle.com/software/tech/java/sqlj_jdbc/index.html ¿¡¼ ´Ù¿î ¹ÞÀ» ¼ö ÀÖ´Ù.
À§ »çÀÌÆ®¿¡¼ ÀÚ½ÅÀÇ oracle°ú ȣȯµÇ´Â ¹öÀüÀÇ jdbcµå¶óÀ̹ö¸¦ ´Ù¿î ¹Þ´Â´Ù. ¼³¸íÀº ¸®´ª½º¿ë Oracle9i 9.2.0.4¿Í ȣȯµÇ´Â Oracle9i 9.2.0.3 JDBC Drivers¸¦ ÀÌ¿ëÇϵµ·Ï ÇÏ°Ú½À´Ï´Ù. http://download.oracle.com/otn/utilities_drivers/jdbc/9203/ojdbc14.jar ÆÄÀÏÀ» ´Ù¿î¹Þ½À´Ï´Ù. ´Ù¿î ¹ÞÀº ÆÄÀÏÀÇ ÆÄÀϸíÀ» classes12.jar·Î º¯°æÇÕ´Ï´Ù.
¸¸ÀÏ ¿À¶óŬÀ» ¼³Ä¡ÇÏ¿´´Ù¸é ¼³Ä¡µÈ ¼¹öÀÇ ¿À¶óŬ ¼³Ä¡ À§Ä¡¿¡ JDBC driver ÆÄÀÏÀÌ Á¸ÀçÇϹǷΠÀ§ ÆÄÀÏÀ» ´Ù¿î¹ÞÁö ¾Ê°í ±× ÆÄÀÏÀ» ÀÌ¿ëÇÏ¿©µµ µË´Ï´Ù. ¿À¶óŬÀ» ¼³Ä¡ ½Ã ¼³Ä¡ °æ·Î¸¦ /opt/oracle/product/9.2.0·Î ¼³Á¤ ÇÏ¿´´Ù¸é /opt/oracle/product/9.2.0/jdbc/lib Æú´õ¿¡ JDBC Driver ÆÄÀÏÀÎ classes12.jarÀÌ Á¸Àç ÇÕ´Ï´Ù.
À§ µÎ °¡Áö ¹æ¹ý Áß ÀÚ½ÅÀÌ ¿øÇÏ´Â ¹æ¹ýÀ¸·Î classes12.jarÀ» ±¸Çß´Ù¸é ±× ÆÄÀÏÀ» J2SDK°¡ ¼³Ä¡µÈ Æú´õÀÇ /usr/java/j2sdk/jre/lib/ext Æú´õ¿¡ º¹»çÇÕ´Ï´Ù.
ÀÚ¹Ù¿¡¼´Â /ÀÚ¹Ù¼³Ä¡µð·ºÅ丮/jre/lib/ext/ Æú´õ¿¡ ÀÖ´Â ÆÄÀϵéÀº ÀÚµ¿À¸·Î ·ÎµùÇϱ⠶§¹®¿¡ µû·Î classpath¸¦ Àâ¾ÆÁÖÁö ¾Ê¾Æµµ µË´Ï´Ù. ±×·¸Áö ¾Ê°í µû·Î classpath¸¦ ¼³Á¤ÇÏ°í ½ÍÀ¸½Å ºÐµéÀº classes12.jar ÆÄÀÏÀ» ÀÚ½ÅÀÌ ¿øÇÏ´Â Æú´õ¿¡ ÀúÀåÇϽðí Ŭ·¡½º Æнº¸¦ ¼³Á¤Çϼŵµ µË´Ï´Ù. (±ÇÀå ÇÏÁö´Â ¾Ê½À´Ï´Ù.)
¿¹) /usr/local/tomcat/common/lib/classes12.jar ¿¡ ÆÄÀÏÀ» À§Ä¡ ½ÃÄ×À» °æ¿ì
Root »ç¿ëÀÚ ±ÇÇÑ¿¡¼¸¸ »ç¿ëÇÏ·Á¸é /root µð·ºÅ丮¿¡¼ .bash_profileÀ» ¼öÁ¤ÇÏ°í ¸ðµç»ç¿ëÀÚ¿¡°Ô »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ¼³Á¤ ÇÑ´Ù¸é /etc/profile ÆÄÀÏÀ» ¾Æ·¡¿Í °°ÀÌ ¼öÁ¤ ÇÕ´Ï´Ù.
#> vi /etc/profile (¸ðµç »ç¿ëÀÚ¿¡°Ô Àû¿ëÇÑ´Ù¸é)
JAVA_HOME=/usr/java/j2sdk (¶Ç´Â JAVA_HOME=/usr/local/j2sdk)
#JAVA_HOME´Â J2SE¸¦ rpmÀ̳ª ¹ÙÀ̳ʸ® Áß ÀÚ½ÅÀÌ ¼³Ä¡ÇÑ ¹æ½Ä¿¡ µû¶ó ÁöÁ¤ÇÕ´Ï´Ù.
CATALINA_HOME=/usr/local/tomcat
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export JAVA_HOME CATALINA_HOME
export CLASSPATH$CATALINA_HOME/common/lib/classes12.jar
ÀúÀåÇÏ°í ºüÁ® ³ª¿É´Ï´Ù.
º¯°æµÈ ¼³Á¤À» Àû¿ëÇÕ´Ï´Ù.
#> source /etc/profile
- Oracle DB ¿¬µ¿Å×½ºÆ®
¾Æ·¡ ³»¿ëÀ» ¿¡µðÅÍ·Î ÆíÁýÇÏ¿© jspÈ®ÀåÀÚ¸¦ °¡Áö´Â Àû´çÇÑ À̸§À¸·Î ÀúÀåÇÑ´Ù. ÀúÀåÇÒ À§Ä¡´Â tomcatÀÌ ¼³Á¤µÈ À§Ä¡ ¾Æ·¡¿¡ ÀÖ´Â webapps/ROOT/ °æ·Î¿¡ ÀúÀåÇÑ´Ù. À§ ¼³¸í¿¡¼ TomcatÀ» /usr/local/tomcat ¿¡ ¼³Ä¡ÇÏ´Â °ÍÀ¸·Î °¡Á¤ÇÏ¿´À¸¹Ç·Î ÆÄÀÏÀÌ ÀúÀåµÉ Àý´ë°æ·Î´Â /usr/local/tomcat/webapps/ROOT/ µð·ºÅ͸®¿¡ ÀúÀåÇÏ¸é µÈ´Ù. ÀúÀåÀ» ÇÑ ÈÄ À¥ºê¶ó¿ìÁ®¿¡¼ µ¥ÀÌÅͺ£À̽º¿¡ ÀúÀåµÈ Å×À̺íÀÇ °ªÀ» Àоî¿Í »Ñ·ÁÁÖ¸é ¿À¶óŬDB¿Í Á¤»óÀûÀ¸·Î ¿¬µ¿µÈ °ÍÀÌ´Ù.
<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import="java.sql.*" %>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:@211.234.53.212:1521:ws16ora1","scott","tiger");
String sql="select empno,ename,job,mgr,hiredate,sal,comm, deptno from emp";
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while (rs.next()) {
out.print(rs.getInt(1)+"||");
out.print(rs.getString(2)+"||");
out.print(rs.getString(3) +"||");
out.print(rs.getInt(4) +"||");
out.print(rs.getDate(5) +"||");
out.print(rs.getInt(6) +"||");
out.print(rs.getInt(7) +"||");
out.print(rs.getInt(8) +"<br>");
}
rs.close();
stmt.close();
con.close();
Ãâó---http://blog.naver.com/mickey109/60004785056
|
Hit : 24316 Date : 2009/05/30 10:13
|