Wiki source code of Deploying on Linux

Version 279.1 by Bastian Triller on 2013/05/21 17:23

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