Tomcat ContOS 6.5 3 DATAGRAM INC. 26 7 7 Linux(CentOS) Tomcat eclipse tomcat 1 Tomcat/Eclipse 2 1.1.............................................. 2 2 2 2.1...................................... 2 3 OS(Linux) 2 3.1................................. 2 3.2 OS................................... 3 3.2.1 SELinux................................... 3 3.2.2 Proxy...................................... 3 3.2.3..................................... 3 4 GUI 4 4.1.................................. 4 4.2 GUI (KDE )............................ 4 4.3................................... 4 4.4 KDE................................ 5 4.5 GUI......................................... 5 5 5 5.1 Firefox............................................. 5 6 Eclipse 5 6.1 Java/Eclipse......................................... 5 7 Tomcat 5 7.1 tomcat6............................................ 5 7.2.................................. 6 7.3 Administration..................................... 6 7.4 Tomcat.......................... 6 7.5 Tomcat...................................... 6 7.6 Tomcat.......................... 6 8 Eclipse 6 8.1 Eclipse...................................... 6 8.1.1 Eclipse........................... 6 8.1.2 Eclipse.......................... 6 8.2 Eclipse...................................... 6 8.2.1 Eclipse................................ 6 8.2.2 Eclipse............................... 7 1
8.3..................................... 7 8.4 java.sh......................................... 7 8.5........................... 7 8.6 Eclipse...................................... 7 8.7 Eclipse................................... 7 8.8 Java1.6......................................... 7 8.9 Eclipse................................... 8 8.10............................... 8 9 Hello World 8 9.1 Web.................................. 8 9.2........................................ 8 9.3 HelloWorld.java........................................ 8 9.4 web.xml............................................ 9 9.5.............................................. 9 9.6...................................... 9 9.7............................................ 10 9.8 LOCAL..................................... 10 2
1 Tomcat/Eclipse 1.1 CentOS 6.5 KDE Desktop Eclipse 3.6.1 Helios tomcat6 2 OS(Linux) yum 2.1 OS PC Windows OS CD iso CD/DVD Windows PC CD-R CD iso DVD CD URL iso http://ftp.iij.ad.jp/pub/linux/centos/6.5/isos/i386/centos-6.5-i386-netinstall.iso 64bit URL http://ftp.iij.ad.jp/pub/linux/centos/6.5/isos/x86 64/CentOS-6.5-x86 64-netinstall.iso unix vi URL OS emacs http://net-newbie.com/linux/commands/vi.html http://www.jitaku-server.net/vi.html http://www.envinfo.uee.kyoto-u.ac.jp/user/susaki/command/vi.html 3 OS(Linux) 3.1 LAN CD PC 1. Welcome to CentOS 6.5! Install or upgrade an existing system 2. Disk Found [skip] 3. Choose a Language English 4. Keyboard Type jp106 101 us 5. Installation Method URL 6. Configure TCP/IP Enable IPv4 support, Dynamic IP configuration (DHCP) IPv6 3
7. URL Setup http://ftp.iij.ad.jp/pub/linux/centos/6.5/os/i386/ http://ftp.iij.ad.jp/pub/linux/centos/6.5/os/x86 64/ http://192.168.101.36:8088 8. CentOS OK 9. System to Upgrade Reinstall System 10. Time Zone Selection System clock uses UTC, Asia Tokyo 11. Root Password ******** Weak Password Use Anyway 12. Partitioning Type Use entire drive 13. Wtiting storage configuration to disk Write changes to disk 14. Complete CD Reboot 3.2 OS 3.2.1 SELinux SELinux SELinux # vi /etc/selinux/config <<< SELINUX=disabled # shutdown -r now 3.2.2 Proxy Proxy # vi /etc/profile.d/proxy.sh <<< export http_proxy=http://192.168.101.36:8088/ export ftp_proxy=http://192.168.101.36:8088/ export HTTP_PROXY=http://192.168.101.36:8088/ export FTP_PROXY=http://192.168.101.36:8088/ # exit root 3.2.3 root 1. 4
# yum -y install make # yum -y install man-pages # yum -y install man # yum -y install mailx # yum -y install openssh-clients # yum -y install bind-utils # yum -y install nkf # yum -y install wget # yum -y install lynx # yum -y install emacs 2. DHCP IP 192.168.101.254, 192.168.101.1 # vi /etc/sysconfig/network-scripts/ifcfg-eth0 <<< DEVICE="eth0" BOOTPROTO="static" ONBOOT="yes" TYPE="Ethernet" IPADDR="192.168.101.254" NETMASK="255.255.255.0" GATEWAY="192.168.101.1" # vi /etc/sysconfig/network <<< NETWORKING=yes HOSTNAME=local254 3. dev, lsc # groupadd lsc # useradd -g lsc -m dev # passwd dev 4. # shutdown -r now 4 GUI root 4.1 # yum -y groupinstall "Development Tools" 4.2 GUI (KDE ) # yum -y groupinstall "X Window System" "Desktop" "KDE Desktop" 4.3 # yum -y groupinstall "Japanese Support" # vi /etc/sysconfig/i18n <<< LANG="ja_JP.UTF-8" 5
4.4 KDE GUI # shutdown -r now root # startx 4.5 GUI GUI # vi /etc/inittab id:3:initdefault: id:5:initdefault: # shutdown -r now 5 root [ ][ ][Konsole] $ su - : # 5.1 Firefox # yum -y groupinstall " " 6 Eclipse 6.1 Java/Eclipse # yum -y groupinstall "Java " "Eclipse" # yum -y install eclipse-nls-ja 7 Tomcat 7.1 tomcat6 # yum -y groupinstall "Web " # yum -y install tomcat6-webapps # yum -y install tomcat6-admin-webapps # yum -y install tomcat6-docs-webapp # yum -y install tomcat6-javadoc 6
7.2 # vi /etc/sysconfig/iptables <<< -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT # service iptables restart 7.3 Administration # vi /etc/tomcat6/tomcat-users.xml <<< tomcat-users 2 <role rolename="manager"/> <user username="tomcat" password="s3cret" roles="manager"/> 7.4 Tomcat # service tomcat6 start 7.5 Tomcat WEB Tomcat http://192.168.101.254:8080/ 7.6 Tomcat # service tomcat6 stop 8 Eclipse 8.1 Eclipse 8.1.1 Eclipse http://mergedoc.sourceforge.jp/ Pleiades Ver.1.4.0 /root/wrk/pleiades_1.4.0.zip 8.1.2 Eclipse # cd /usr/lib/eclipse/ # unzip /root/wrk/pleiades_1.4.0.zip 8.2 Eclipse 8.2.1 Eclipse tomcatpluginv33 # cd /root/wrk # wget http://www.eclipsetotale.com/tomcatplugin/tomcatpluginv33.zip 7
8.2.2 Eclipse # cd /usr/lib/eclipse/plugins # unzip /root/wrk/tomcatpluginv33.zip 8.3 ( :dev) root tomcat # vi /etc/group <<< root:x:0:dev... tomcat:x:91:dev 8.4 java.sh # vi /etc/profile.d/java.sh <<< export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0 export PATH=$JAVA_HOME/bin:$PATH export TOMCAT_HOME=/usr/share/tomcat6 export CATALINA_HOME=/usr/share/tomcat6 export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME:lib 8.5 # /usr/share/tomcat6/lib # ln -s tomcat6-servlet-2.5-api-6.0.24.jar servlet-api.jar # ln -s tomcat6-jsp-2.1-api-6.0.24.jar jsp-api.jar # ln -s tomcat6-el-2.1-api-6.0.24.jar el-api.jar 8.6 Eclipse KDE Eclipse [ ][ ][Eclipse] 8.7 Eclipse Eclipse Tomcat [ (W)][ (P)] 8.8 Java1.6 Java JRE JRE (J): /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre [ (F)] 8
8.9 Eclipse Tomcat Tomcat 6.x /usr/share/tomcat6 Server.xml /usr/share/tomcat6/server.xml Tomcat:JVM java-1.6.0-openjdk-1.6.0.0 8.10 [ (H)][...] http://download.eclipse.org/releases/helios Web XML JavaEE PHP Dali 9 Hello World 9.1 Web [ (F)][ (N)][ (R)] Web: Web [ (N)] (P): test001 [ (F)] 9.2 test001 [ (W)][ ] (M): jp.lsc [ (F)] jp.lsc [ (N)][ (O)] [Web][ ] [ (N)] (M): HelloWorld [ (F)] 9.3 HelloWorld.java HelloWorld.java package jp.lsc import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; 9
import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; /** * Servlet implementation class HelloWorld */ @WebServlet("/HelloWorld") public class HelloWorld extends HttpServlet { private static final long serialversionuid = 1L; /** * @see HttpServlet#HttpServlet() */ public HelloWorld() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IO // TODO Auto-generated method stub } response.setcontenttype("text/html; charset=windows-31j"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head>"); out.println("<title>helloworld</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>helloworld</h1>"); out.println("</body>"); out.println("</html>"); out.close(); /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void dopost(httpservletrequest request, HttpServletResponse response) throws ServletException, I // TODO Auto-generated method stub } } 9.4 web.xml web.xml Eclipse 9.5 CTRL+S [ (F)][ (E)] 9.6 HelloWorld.java [ (R)][ ] 10
Apache Tomcat v6.0 [ (F)] LOCAL 9.7 http://192.168.101.254:8080/test001/helloworld 9.8 LOCAL [ (T)] 11