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