Namestitev SubmitServer » History » Version 4
Gašper Fele-Žorž, 04.02.2011 19:22
1 | 1 | Gašper Fele-Žorž | h1. Namestitev SubmitServer |
---|---|---|---|
2 | |||
3 | Najprej namestimo potrebne dodatne pakete: |
||
4 | |||
5 | <pre> |
||
6 | apt-get install tomcat6 mysql-server subversion ant liblog4j1.2-java libmysql-java |
||
7 | </pre> |
||
8 | |||
9 | Geslo za root mysql je na marmoset.fri.uni-lj.si enako geslu za root sicer. |
||
10 | |||
11 | 2 | Gašper Fele-Žorž | Nato "dodamo userja":http://dev.mysql.com/doc/refman/5.1/en/adding-users.html in "ustvarimo podatkovno bazo":http://dev.mysql.com/doc/refman/5.0/en/create-database.html na mysql: |
12 | 1 | Gašper Fele-Žorž | |
13 | <pre> |
||
14 | shell> mysql -u root -p |
||
15 | mysql> create user 'marmoset'@'localhost' identified by 'malaopica'; |
||
16 | mysql> create database marmoset character set = utf8; |
||
17 | mysql> grant all privileges on marmoset.* to 'marmoset'@'localhost'; |
||
18 | </pre> |
||
19 | |||
20 | Preverimo, če baza deluje: |
||
21 | |||
22 | <pre> |
||
23 | polz@bober:~$ mysql -u marmoset -p -D marmoset |
||
24 | Enter password: |
||
25 | Welcome to the MySQL monitor. Commands end with ; or \g. |
||
26 | Your MySQL connection id is 43 |
||
27 | Server version: 5.1.49-3 (Debian) |
||
28 | |||
29 | Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
||
30 | This software comes with ABSOLUTELY NO WARRANTY. This is free software, |
||
31 | and you are welcome to modify and redistribute it under the GPL v2 license |
||
32 | |||
33 | Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. |
||
34 | |||
35 | mysql> |
||
36 | </pre> |
||
37 | |||
38 | Če deluje, lahko iz svn repozitorija poberemo marmoset. Uporabimo kopijo, ki je na redmine. |
||
39 | |||
40 | <pre> |
||
41 | polz@bober:~$ svn co https://lusy.fri.uni-lj.si/svn/marmoset/ |
||
42 | </pre> |
||
43 | |||
44 | 4 | Gašper Fele-Žorž | Če bi slučajno kdo še hotel uporabiti marmoset iz git snapshota, potlej bi moral |
45 | popraviti še datoteko "build.xml" - iz neznanega razloga developerji niso hoteli, |
||
46 | da bi se v .war spravila celotna aplikacija. Popraviti je torej treba pravilo |
||
47 | "war", da potlej izgleda takole: |
||
48 | |||
49 | <pre> |
||
50 | <war |
||
51 | destfile="${dist}/${warfile}" |
||
52 | webxml="WebRoot/WEB-INF/web.xml" |
||
53 | > |
||
54 | <fileset dir="WebRoot"> |
||
55 | <!-- |
||
56 | <exclude name="WEB-INF/classes/edu/umd/cs/submitServer/shared/*class"/> |
||
57 | <exclude name="WEB-INF/lib/log4j.jar"/> |
||
58 | --> |
||
59 | </fileset> |
||
60 | </war> |
||
61 | </pre> |
||
62 | |||
63 | 1 | Gašper Fele-Žorž | Ustvarimo tabele v bazi: |
64 | |||
65 | <pre> |
||
66 | polz@bober:~/marmoset$ cd SubmitServerModelClasses/trunk/SubmitServerModelClasses/dbScripts/ |
||
67 | polz@bober:~/marmoset/SubmitServerModelClasses/trunk/SubmitServerModelClasses/dbScripts$ mysql -u marmoset -p -e "source marmoset-schema.sql" -D marmoset |
||
68 | </pre> |
||
69 | |||
70 | Ustvarimo uporabnika v bazi. Najprej popravimo bootstrap.sql, ki vsebuje nekaj takega: |
||
71 | |||
72 | <pre> |
||
73 | INSERT INTO students |
||
74 | VALUES (DEFAULT, 'USERNAME', 'UNIKATNA_ID_ŠTEVILKA', 'IME', 'PRIIMEK', 'yes', DEFAULT, DEFAULT, DEFAULT, 'GESLO'); |
||
75 | </pre> |
||
76 | |||
77 | Nato izvedemo: |
||
78 | <pre> |
||
79 | mysql -u marmoset -p -e "source bootstrap.sql" -D marmoset |
||
80 | </pre> |
||
81 | |||
82 | Namestimo SubmitServer na Tomcat - pred tem lahko popravimo local.properties, kjer je mogoče nastaviti direktorij, |
||
83 | v katerega se marmoset namesti. V svn je različica, ki ima ta direktorij nastavljen na /var/lib/tomcat6 |
||
84 | |||
85 | <pre> |
||
86 | polz@bober:~/marmoset# cd SubmitServer/trunk/SubmitServer2/ |
||
87 | polz@bober:~/marmoset/SubmitServer/trunk/SubmitServer2# ant production.install |
||
88 | </pre> |
||
89 | |||
90 | Nastavimo Tomcat tako, da bo classe iskal tudi v direktoriju, kjer je večina javanskih knjižnic. SubmitServer namreč od tam potrebuje log4j knjižnico. Popravimo datoteko |
||
91 | <pre>/etc/tomcat6/catalina.properties</pre> tako, da k common.loader dodamo ",/usr/share/java/*.jar": |
||
92 | <pre> |
||
93 | common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/var/lib/tomcat6/common/classes,/var/lib/tomcat6/common/*.jar,/usr/share/java/*.jar |
||
94 | </pre> |
||
95 | |||
96 | Med nastavitve Tomcata dodamo podatke o podatkovni bazi, na katero se SubmitServer povezuje. To storimo tako, da v <pre>/etc/tomcat6/web.xml</pre> dodamo nekaj vnosov "<context-param>". |
||
97 | Konec datoteke potem izgleda takole: |
||
98 | |||
99 | <pre> |
||
100 | <context-param> |
||
101 | <param-name>authentication.service</param-name> |
||
102 | <param-value>edu.umd.cs.submitServer.GenericStudentPasswordAuthenticationService</param-value> |
||
103 | </context-param> |
||
104 | <context-param> |
||
105 | <param-name>database.server.jdbc.url</param-name> |
||
106 | <param-value>jdbc:mysql://localhost/marmoset</param-value> |
||
107 | </context-param> |
||
108 | <context-param> |
||
109 | <param-name>database.user</param-name> |
||
110 | <param-value>marmoset</param-value> |
||
111 | </context-param> |
||
112 | <context-param> |
||
113 | <param-name>database.password</param-name> |
||
114 | <param-value>malaopica</param-value> |
||
115 | </context-param> |
||
116 | <context-param> |
||
117 | <param-name>database.driver</param-name> |
||
118 | <param-value>org.gjt.mm.mysql.Driver</param-value> |
||
119 | </context-param> |
||
120 | </web-app> |
||
121 | </pre> |
||
122 | |||
123 | Ponovno zaženemo Tomcat: |
||
124 | <pre> |
||
125 | bober:/home/polz/marmoset/SubmitServer/trunk/SubmitServer2# /etc/init.d/tomcat6 restart |
||
126 | </pre> |
||
127 | |||
128 | Bravo! S tem je SubmitServer v principu nameščen. Zakaj le v principu? Zato, ker je treba omogočiti dostop do njega prek https. |
||
129 | Postopek je opisan "tukaj":http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html . Vseeno na hitro povzetek. |
||
130 | |||
131 | Najprej ustvarimo ključe: |
||
132 | <pre> |
||
133 | bober:~# keytool -genkey -alias tomcat -keyalg RSA -keystore /usr/share/tomcat6/.keystore |
||
134 | </pre> |
||
135 | |||
136 | Geslo si seveda zapomnimo. |
||
137 | |||
138 | Nato nastavimo tomcat, da jih uporabi. To storimo tako, da v <pre>/etc/tomcat6/server.xml</pre> odkomentiramo in dodamo geslo v odsek: |
||
139 | |||
140 | <pre> |
||
141 | <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" |
||
142 | maxThreads="150" scheme="https" secure="true" |
||
143 | 4 | Gašper Fele-Žorž | keystorePass="GESLO" URIEncoding="UTF-8" |
144 | 1 | Gašper Fele-Žorž | clientAuth="false" sslProtocol="TLS" /> |
145 | </pre> |
||
146 | |||
147 | Ponovno zaženemo Tomcat: |
||
148 | <pre> |
||
149 | bober:/home/polz/marmoset/SubmitServer/trunk/SubmitServer2# /etc/init.d/tomcat6 restart |
||
150 | </pre> |
||
151 | 3 | Gašper Fele-Žorž | |
152 | Če kaj ne deluje, si razčesnemo glavo. |