Namestitev SubmitServer » History » Version 2
Gašper Fele-Žorž, 03.02.2011 20:17
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 | Ustvarimo tabele v bazi: |
||
45 | |||
46 | <pre> |
||
47 | polz@bober:~/marmoset$ cd SubmitServerModelClasses/trunk/SubmitServerModelClasses/dbScripts/ |
||
48 | polz@bober:~/marmoset/SubmitServerModelClasses/trunk/SubmitServerModelClasses/dbScripts$ mysql -u marmoset -p -e "source marmoset-schema.sql" -D marmoset |
||
49 | </pre> |
||
50 | |||
51 | Ustvarimo uporabnika v bazi. Najprej popravimo bootstrap.sql, ki vsebuje nekaj takega: |
||
52 | |||
53 | <pre> |
||
54 | INSERT INTO students |
||
55 | VALUES (DEFAULT, 'USERNAME', 'UNIKATNA_ID_ŠTEVILKA', 'IME', 'PRIIMEK', 'yes', DEFAULT, DEFAULT, DEFAULT, 'GESLO'); |
||
56 | </pre> |
||
57 | |||
58 | Nato izvedemo: |
||
59 | <pre> |
||
60 | mysql -u marmoset -p -e "source bootstrap.sql" -D marmoset |
||
61 | </pre> |
||
62 | |||
63 | Namestimo SubmitServer na Tomcat - pred tem lahko popravimo local.properties, kjer je mogoče nastaviti direktorij, |
||
64 | v katerega se marmoset namesti. V svn je različica, ki ima ta direktorij nastavljen na /var/lib/tomcat6 |
||
65 | |||
66 | <pre> |
||
67 | polz@bober:~/marmoset# cd SubmitServer/trunk/SubmitServer2/ |
||
68 | polz@bober:~/marmoset/SubmitServer/trunk/SubmitServer2# ant production.install |
||
69 | </pre> |
||
70 | |||
71 | 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 |
||
72 | <pre>/etc/tomcat6/catalina.properties</pre> tako, da k common.loader dodamo ",/usr/share/java/*.jar": |
||
73 | <pre> |
||
74 | 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 |
||
75 | </pre> |
||
76 | |||
77 | 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>". |
||
78 | Konec datoteke potem izgleda takole: |
||
79 | |||
80 | <pre> |
||
81 | <context-param> |
||
82 | <param-name>authentication.service</param-name> |
||
83 | <param-value>edu.umd.cs.submitServer.GenericStudentPasswordAuthenticationService</param-value> |
||
84 | </context-param> |
||
85 | <context-param> |
||
86 | <param-name>database.server.jdbc.url</param-name> |
||
87 | <param-value>jdbc:mysql://localhost/marmoset</param-value> |
||
88 | </context-param> |
||
89 | <context-param> |
||
90 | <param-name>database.user</param-name> |
||
91 | <param-value>marmoset</param-value> |
||
92 | </context-param> |
||
93 | <context-param> |
||
94 | <param-name>database.password</param-name> |
||
95 | <param-value>malaopica</param-value> |
||
96 | </context-param> |
||
97 | <context-param> |
||
98 | <param-name>database.driver</param-name> |
||
99 | <param-value>org.gjt.mm.mysql.Driver</param-value> |
||
100 | </context-param> |
||
101 | </web-app> |
||
102 | </pre> |
||
103 | |||
104 | Ponovno zaženemo Tomcat: |
||
105 | <pre> |
||
106 | bober:/home/polz/marmoset/SubmitServer/trunk/SubmitServer2# /etc/init.d/tomcat6 restart |
||
107 | </pre> |
||
108 | |||
109 | Bravo! S tem je SubmitServer v principu nameščen. Zakaj le v principu? Zato, ker je treba omogočiti dostop do njega prek https. |
||
110 | Postopek je opisan "tukaj":http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html . Vseeno na hitro povzetek. |
||
111 | |||
112 | Najprej ustvarimo ključe: |
||
113 | <pre> |
||
114 | bober:~# keytool -genkey -alias tomcat -keyalg RSA -keystore /usr/share/tomcat6/.keystore |
||
115 | </pre> |
||
116 | |||
117 | Geslo si seveda zapomnimo. |
||
118 | |||
119 | Nato nastavimo tomcat, da jih uporabi. To storimo tako, da v <pre>/etc/tomcat6/server.xml</pre> odkomentiramo in dodamo geslo v odsek: |
||
120 | |||
121 | <pre> |
||
122 | <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" |
||
123 | maxThreads="150" scheme="https" secure="true" |
||
124 | keystorePass="GESLO" |
||
125 | clientAuth="false" sslProtocol="TLS" /> |
||
126 | </pre> |
||
127 | |||
128 | Ponovno zaženemo Tomcat: |
||
129 | <pre> |
||
130 | bober:/home/polz/marmoset/SubmitServer/trunk/SubmitServer2# /etc/init.d/tomcat6 restart |
||
131 | </pre> |