Wiki source code of Deploying on Linux

Version 275.1 by Pascal Robert on 2013/01/11 12:33

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