Wiki source code of Deploying on Linux

Version 273.1 by Pascal Robert on 2012/12/02 22:09

Show last authors
1 === Install Sun Java JDK ===
2
3 ~1. You should install a [[Sun/Oracle Java SDK>>http://www.oracle.com/technetwork/java/javase/downloads/index.html]]. Use Oracle's [[installation instructions>>http://www.oracle.com/technetwork/java/javase/index-137561.html#linux]]. Choose the appropriate 32-bit or 64-bit Linux installer, for example jdk-6u27-linux-x64-rpm.bin, and install it.
4
5 {{warning}}
6 Make sure to install the correct "bit" version for the OS, e.g. install 64 bit JVM on a 64 bit installation, and a 32 bit JVM on a 32 bit installation\! To find that information, do:
7 {code}uname -p{code}
8 If the response is _x86_64_, it's a 64 bit system. If the response is _i386_ or _i686_, it's a 32 bit system.
9
10 {{/warning}}
11
12 Creating symbolic links as follows is useful (alternatively use the 'alternatives' command to manage JVMs):
13
14 {{code}}
15
16 ln -s /usr/java/jdk1.6.0_27 /usr/java/jdk1.6
17 ln -s /usr/java/jdk1.6/bin/java /usr/bin/java
18
19 {{/code}}
20
21 and you need to change your path in your bash profile (//,,/.bash,,//,,profile) to have this path :,,
22
23 {{code}}
24
25 PATH=$PATH:/usr/java/jdk1.6/bin:$HOME/bin
26
27 {{/code}}
28
29 === Optional: Install the WebObjects frameworks ===
30
31 {{info}}
32 If you embed the frameworks into your applications, you don't need to install the core frameworks on the deployment system. Install them only if your applications don't have the frameworks inside their bundles.
33 {{/info}}
34
35 2. Get the WebObjects installer from the wocommunity's Web site :
36
37 {{code}}
38
39 curl -C - -O http://wocommunity.org/documents/tools/WOInstaller.jar
40
41 OR
42
43 wget http://wocommunity.org/documents/tools/WOInstaller.jar
44
45 {{/code}}
46
47 and install it like this :
48
49 {{code}}
50
51 sudo /usr/java/latest/bin/java -jar WOInstaller.jar 5.4.3 /opt
52
53 {{/code}}
54
55 WebObjects frameworks are now installed in ///opt//
56
57 {{code}}
58
59 [root@ ~]# ls -l /opt
60 total 12
61 drwxr-xr-x 3 root root 4096 Nov 9 08:19 Developer
62 drwxr-xr-x 4 root root 4096 Nov 9 08:19 Library
63 drwxr-xr-x 3 root root 4096 Nov 9 08:20 Local
64
65 {{/code}}
66
67 === Creating the //appserver// user and starting wotaskd/JavaMonitor ===
68
69 To follow the conventions from Mac OS X, we will create two users to run wotaskd and Monitor under this user :
70
71 {{code}}
72
73 sudo groupadd appserveradm
74 sudo useradd -g appserveradm appserver
75
76 {{/code}}
77
78 Edit the bash profile of the appserver
79
80 {{code}}
81
82 #sudo su - appserver
83 % vi .bash_profile
84
85 {{/code}}
86
87 and add this line :
88
89 {{code}}
90
91 export NEXT_ROOT=/opt
92
93 {{/code}}
94
95 and run it manually in your current shell :
96
97 {{code}}
98
99 [appserver@ ~]$ . .bash_profile
100
101 {{/code}}
102
103 3. Next, we need to install the Wonder version **wotaskd** and **JavaMonitor**.
104
105 {{code}}
106
107 mkdir -p /opt/Local/Library/WebObjects/JavaApplications
108 cd /opt/Local/Library/WebObjects/JavaApplications
109
110 wget http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/artifact/Root/Roots/wotaskd.tar.gz
111 tar zpxf wotaskd.tar.gz
112 rm wotaskd.tar.gz
113 wget http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/artifact/Root/Roots/JavaMonitor.tar.gz
114 tar zpxf JavaMonitor.tar.gz
115 rm JavaMonitor.tar.gz
116
117 {{/code}}
118
119 4. Now we need to change some permissions:
120
121 {{code}}
122
123 sudo chown -R appserver:appserveradm /opt/Local
124 sudo chown -R appserver:appserveradm /opt/Library
125
126 {{/code}}
127
128 5. Now we can start wotask and Monitor
129
130 {{code}}
131
132 [root@ ~]# sudo su - appserver
133
134 {{/code}}
135
136 You can start wotaskd and Monitor to make sure that they run without any problems :
137
138 {{code}}
139
140 [appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
141 [appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &
142
143 {{/code}}
144
145 === Apache ===
146
147 6. First step : installing Apache httpd
148
149 ===== For Ubuntu distributions : =====
150
151 {{code}}
152
153 sudo apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils apache2-threaded-dev ssl-cert
154
155 {{/code}}
156
157 On that system the relevant command names are //apache2ctl// and //apxs2//, and the document root is ///var/www// (not ///usr/local/apache/htdocs// as in the example below).
158
159 (you will need httpd-devel and gcc)
160
161 ===== For CentOS, RedHat or Fedora distributions : =====
162
163 {{code}}
164
165 yum install httpd mod_ssl httpd-devel
166 chkconfig httpd on
167 /etc/init.d/httpd start
168
169 {{/code}}
170
171 .. default install location is then /etc/httpd
172
173 === HTTP Adaptor ===
174
175 First, check if a pre-built module already exists at [[wocommunity.org>>http://wocommunity.org/documents/tools/mod_WebObjects/]]. If you are running CentOS 6.x, you can use the module for CentOS 5.5, it works fine.
176
177 Once you have downloaded the module, you can install it with:
178
179 {{code}}
180 sudo apxs -i -a -n WebObjects mod_WebObjects.so
181 {{/code}}
182
183 If you can't find a adaptor for your Linux platform, you [[will have to build it>>Compiling the HTTP adaptor on Linux]]
184
185 === Apache Configuration ===
186
187 Instead of copying the //WebObjects// directory, you can use a alias to point to the folder inside NEXT//ROOT. In your Apache configuration, add something like ~://
188
189 {{code}}
190
191 Alias /WebObjects "/opt/Local/Library/WebServer/Documents/WebObjects"
192
193 {{/code}}
194
195 and add a directive to allow fetching files in this directory:
196
197 {{code}}
198
199 <Directory "/opt/Local/Library/WebServer/Documents/WebObjects">
200 AllowOverride All
201 Order allow,deny
202 Allow from all
203 </Directory>
204
205 {{/code}}
206
207 Or (depending on your Apache configuration) you could use a symbolic link.
208
209 You also need, as explained by the adaptor's README file, to add this directive in //httpd.conf// :
210
211 {{code}}
212
213 <LocationMatch /apps/WebObjects/.*>
214 Order allow,deny
215 Allow from all
216 </LocationMatch>
217
218 {{/code}}
219
220 If you don't add it, you will get 403s (Forbidden) HTTP errors.
221
222 If you want to keep ///cgi-bin/WebObjects// as the base URL, you will need to remove a line in //httpd.conf//. Find the line that starts with //ScriptAlias /cgi-bin// and comment it out, or else Apache will try to find a //WebObjects// CGI in ///cgi-bin// instead of loading the adaptor from the Apache module.
223
224 And edit ///usr/local/apache/conf/extra/webobjects.conf// to comment the //LoadModule WebObjects//module// line. You can also change the //WebObjectsAlias// property, in my case I use ///apps/WebObjects//. Last step : add the following line in httpd.conf (near the end)~://
225
226 {{code}}
227
228 Include conf/extra/webobjects.conf
229
230 {{/code}}
231
232 Check for any errors with //apachectl configtest//, and if everything's ok, you are good to go. You can install your first app, don't forget that your app must be accessible by the //appserver// user or the //appserveradm// group. If your app don't start or if Monitor complains about a path, it might be a permission problem.
233
234 Jerome Chan told me that you can check if the Apache module is loaded by doing this :
235
236 {{code}}
237
238 /usr/local/apache/bin/apachectl -M
239
240 {{/code}}
241
242 On my installation on OpenSuse 11.1, I had to change the path to the lib64 directory where Apache contains the modules.
243
244 {{code}}
245 LoadModule WebObjects_module /usr/lib64/apache2/mod_WebObjects.so
246
247 {{/code}}
248
249 === Auto Start WOTaskd and WOMonitor ===
250
251 One last thing, you need a init script to start wotaskd and Monitor at boot time.
252
253 ==== Systems using upstart (Ubuntu and maybe others) ====
254
255 If you are running Ubuntu that have support for [[upstart>>http://upstart.ubuntu.com/]], you can grab the two startup scripts for upstart on [[GitHub>>https://github.com/projectwonder/wonder/blob/integration/Utilities/Linux/StartupScripts/Ubuntu/]]. Grab the two files (womonitor.conf and wotaskd.conf) and copy them in ///etc/init///. Once they are in this directory, run:
256
257 {{code}}
258 sudo service wotaskd start
259 sudo service womonitor start
260 {{/code}}
261
262 {{info}}
263 Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights\!
264 {code}
265 chown root /etc/init/wotaskd.conf
266 chown root /etc/init/womonitor.conf
267 chmod 755 /etc/init/wotaskd.conf
268 chmod 755 /etc/init/womonitor.conf
269 {code}
270
271 {{/info}}
272
273 ==== Systems not using upstart (CentOS, RedHat, Fedora and others) ====
274
275 If you are running a system not capable of running upstart, like CentOS, RedHat or older versions of Ubuntu, you need to use the old-style init.d startup script. Again, the scripts are [[available>>https://github.com/projectwonder/wonder/tree/integration/Utilities/Linux/StartupScripts/RedHat]] on GitHub. Grab the two files (//womonitor// and //wotaskd//) and copy them in ///etc/init.d///.
276
277 Once the scripts are in ///etc/init.d///, you can start them:
278
279 {{code}}
280 sudo service wotaskd start
281 sudo service womonitor start
282 {{/code}}
283
284 Last step: add the startup scripts under chkconfig control with:
285
286 {{code}}
287 sudo /sbin/chkconfig --add webobjects
288 sudo /sbin/chkconfig webobjects on
289 {{/code}}
290
291 If you are using Ubuntu or Debian without upstart support, you need to use //update-rc.d// instead of //chkconfig//:
292
293 {{code}}
294 sudo update-rc.d wotaskd defaults 90 20
295 sudo update-rc.d womonitor defaults 90 20
296 {{/code}}
297
298 {{info}}
299 Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights\!
300 {code}
301 chown root /etc/init.d/wotaskd
302 chown root /etc/init.d/womonitor
303 chmod 755 /etc/init.d/wotaskd
304 chmod 755 /etc/init.d/womonitor
305 {code}
306
307 {{/info}}
308
309 == Problems with Application Responding to WOMonitor/WOTaskd ==
310
311 If your Linux server is a virtual machine or if it has multiple IP addresses, you may find that clicking 'Stop' in WOMonitor has no effect on instances, or that the applications never start (the level just go up and down non-stop). This can usually be solved for all Wonder-based applications running on hosts with such a problem by simply creating the following file (known as the 'Machine Properties' file in Wonder's ERXProperties):
312
313 {{code}}
314
315 /etc/WebObjects/Properties
316
317 {{/code}}
318
319 And inside that file, add an array property that defines all the IP addresses assigned to your host, for example:
320
321 {{code}}
322
323 er.extensions.WOHostUtilities.localhostips=(192.168.3.168,192.168.1.168)
324
325 {{/code}}
326
327 {{info}}
328
329 To learn more, see the class named WOHostUtilities in ERExtensions framework
330
331 {{/info}}
332
333 == SELinux ==
334
335 If SELinux is enabled on your system, wotaskd won't run because of SELinux policies. You need to run :
336
337 {{code}}
338
339 sudo setsebool -P httpd_can_network_connect=1
340
341 {{/code}}
342
343 {{warning}}
344 Be aware that SELinux is enabled by default on CentOS 6.x, you will need to either call the _setsebool_ command or to [disable SELinux|http://www.how2centos.com/disable-selinux-centos-6/]
345 {{/warning}}
346
347 == Additional Resources ==
348
349 [[Jonathon Rentzsch WOPlat Project 'WOInstaller + Wonder Web Server Adaptor + OS Support Files'>>http://github.com/rentzsch/woplat]]
350 [[http://vmadmin.nt.com.au/?p=47]]
351 [[http://www.watermarkstudios.com/blog/?p=48]]