Wiki source code of Deploying on Linux

Version 92.1 by Maik Musall on 2015/05/19 06:13

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