Wiki source code of Deploying on Linux

Version 286.1 by Ray Kiddy on 2021/04/15 23:23

Show last authors
1 (% class="auto-cursor-target" %)
2 \\
3
4 {{warning}}
5 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.
6
7 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 (although not yet for Xenial)!
8 {{/warning}}
9
10 Install Sun Java JDK
11
12 ~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.
13
14 {{warning}}
15 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:
16
17 {{code}}
18 uname -p
19 {{/code}}
20
21 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.
22 {{/warning}}
23
24 Creating symbolic links as follows is useful (alternatively use the 'alternatives' command to manage JVMs):
25
26 {{code}}
27 ln -s /usr/java/jdk1.6.0_27 /usr/java/jdk1.6 ln -s /usr/java/jdk1.6/bin/java /usr/bin/java
28 {{/code}}
29
30 and you need to change your path in your bash profile (_~~/.bash_profile) to have this path :
31
32 {{code}}
33 PATH=$PATH:/usr/java/jdk1.6/bin:$HOME/bin
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 https://jenkins.wocommunity.org/job/WOInstaller/lastSuccessfulBuild/artifact/Utilities/WOInstall/WOInstaller.jar OR wget https://jenkins.wocommunity.org/job/WOInstaller/lastSuccessfulBuild/artifact/Utilities/WOInstall/WOInstaller.jar
46 {{/code}}
47
48 and install it like this :
49
50
51 [[https:~~/~~/download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/Mac_OS_X/downloads/061-4634.20080915.3ijd0/WebObjects543.dmg>>url:https://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/Mac_OS_X/downloads/061-4634.20080915.3ijd0/WebObjects543.dmg||shape="rect"]]\\
52
53 {{{ wget sudo java -jar WOInstaller.jar dev54 /opt}}}
54
55 You may see an error as the command above finishes, but WO may still be installed.
56
57 This command below is what you could do if you did not need the dmg above. Unfortunately there is a bug having to do with downloading via HTTPS and you do not get the WebObjects543.dmg automatically and you need the command above.
58
59 \\
60
61
62 \\///opt
63 \\//
64
65 {{{ sudo /usr/java/latest/bin/java -jar WOInstaller.jar 5.4.3 /optWebObjects frameworks are now installed in }}}
66
67 {{code}}
68 [root@ ~]# ls -l /opt total 12 drwxr-xr-x 3 root root 4096 Nov 9 08:19 Developer drwxr-xr-x 4 root root 4096 Nov 9 08:19 Library drwxr-xr-x 3 root root 4096 Nov 9 08:20 Local
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 sudo useradd -g appserveradm appserver
77 {{/code}}
78
79 Edit the bash profile of the appserver
80
81 {{code}}
82 #sudo su - appserver % vi .bash_profile
83 {{/code}}
84
85 and add this line :
86
87 {{code}}
88 export NEXT_ROOT=/opt
89 {{/code}}
90
91 and run it manually in your current shell :
92
93 {{code}}
94 [appserver@ ~]$ . .bash_profile
95 {{/code}}
96
97 3. Next, we need to install the Wonder version **wotaskd** and **JavaMonitor**.
98
99 {{code}}
100 mkdir -p /opt/Local/Library/WebObjects/JavaApplications cd /opt/Local/Library/WebObjects/JavaApplications wget https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/artifact/Root/Roots/wotaskd.tar.gz tar zpxf wotaskd.tar.gz rm wotaskd.tar.gz wget https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/artifact/Root/Roots/JavaMonitor.tar.gz tar zpxf JavaMonitor.tar.gz rm JavaMonitor.tar.gz
101 {{/code}}
102
103 4. Now we need to change some permissions:
104
105 {{code}}
106 sudo chown -R appserver:appserveradm /opt/Local sudo chown -R appserver:appserveradm /opt/Library
107 {{/code}}
108
109 5. Now we can start wotask and Monitor
110
111 {{code}}
112 [root@ ~]# sudo su - appserver
113 {{/code}}
114
115 You can start wotaskd and Monitor to make sure that they run without any problems :
116
117 {{code}}
118 [appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd & [appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &
119 {{/code}}
120
121 Apache
122
123 If your Linux installation don't already have Apache httpd running or installed, you need to install it:
124
125 For Ubuntu distributions :
126
127 {{code}}
128 sudo apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils apache2-threaded-dev ssl-cert
129 {{/code}}
130
131 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).
132
133 (you will need httpd-devel and gcc)
134
135 For CentOS, RedHat or Fedora distributions :
136
137 {{code}}
138 I found on AWS for apache 2.4 I had to change the yum to: yum install httpd24 httpd24-devel   yum install httpd mod_ssl httpd-devel chkconfig httpd on /etc/init.d/httpd start
139 {{/code}}
140
141 .. default install location is then /etc/httpd
142
143 HTTP Adaptor
144
145 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.
146
147 Once you have downloaded the module, you can install it with:
148
149 {{code}}
150 sudo apxs -i -a -n WebObjects mod_WebObjects.so
151 {{/code}}
152
153 If you can't find a adaptor for your Linux platform, you [[will have to build it>>doc:Compiling the HTTP adaptor on Linux]]
154
155 Apache Configuration
156
157 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 :
158
159 {{code}}
160 Alias /WebObjects "/opt/Local/Library/WebServer/Documents/WebObjects"
161 {{/code}}
162
163 and add a directive to allow fetching files in this directory:
164
165 {{code}}
166 <Directory "/opt/Local/Library/WebServer/Documents/WebObjects"> AllowOverride All Order allow,deny Allow from all </Directory>
167 {{/code}}
168
169 Or (depending on your Apache configuration) you could use a symbolic link.
170
171 You also need, as explained by the adaptor's README file, to add this directive in //httpd.conf// :
172
173 {{code}}
174 <LocationMatch /apps/WebObjects/.*> Order allow,deny Allow from all </LocationMatch>
175 {{/code}}
176
177 If you don't add it, you will get 403s (Forbidden) HTTP errors.
178
179 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.
180
181 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):
182
183 {{code}}
184 Include conf/extra/webobjects.conf
185 {{/code}}
186
187 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.
188
189 Jerome Chan told me that you can check if the Apache module is loaded by doing this :
190
191 {{code}}
192 /usr/local/apache/bin/apachectl -M
193 {{/code}}
194
195 On my installation on OpenSuse 11.1, I had to change the path to the lib64 directory where Apache contains the modules.
196
197 {{code}}
198 LoadModule WebObjects_module /usr/lib64/apache2/mod_WebObjects.so
199 {{/code}}
200
201 Auto Start WOTaskd and WOMonitor
202
203 One last thing, you need a init script to start wotaskd and Monitor at boot time.
204
205 Systems using upstart (Ubuntu and maybe others)
206
207 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:
208
209 {{code}}
210 sudo service wotaskd start sudo service womonitor start
211 {{/code}}
212
213 (% class="auto-cursor-target" %)
214 \\
215
216 {{info}}
217 Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights!
218
219 {{code}}
220 chown root /etc/init/wotaskd.conf chown root /etc/init/womonitor.conf chmod 755 /etc/init/wotaskd.conf chmod 755 /etc/init/womonitor.conf
221 {{/code}}
222
223 (% class="auto-cursor-target" %)
224 \\
225 {{/info}}
226
227 Systems not using upstart (CentOS, RedHat, Fedora and others)
228
229 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///.
230
231 Once the scripts are in ///etc/init.d///, you can start them:
232
233 {{code}}
234 sudo service wotaskd start sudo service womonitor start
235 {{/code}}
236
237 Last step: add the startup scripts under chkconfig control with:
238
239 {{code}}
240 sudo /sbin/chkconfig --add webobjects sudo /sbin/chkconfig webobjects on
241 {{/code}}
242
243 If you are using Ubuntu or Debian without upstart support, you need to use //update-rc.d// instead of //chkconfig//:
244
245 {{code}}
246 sudo update-rc.d wotaskd defaults 90 20 sudo update-rc.d womonitor defaults 90 20
247 {{/code}}
248
249 (% class="auto-cursor-target" %)
250 \\
251
252 {{info}}
253 Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights!
254
255 {{code}}
256 chown root /etc/init.d/wotaskd chown root /etc/init.d/womonitor chmod 755 /etc/init.d/wotaskd chmod 755 /etc/init.d/womonitor
257 {{/code}}
258
259 (% class="auto-cursor-target" %)
260 \\
261 {{/info}}
262
263 (% style="font-weight: bold;" %)
264
265
266 (% style="font-weight: bold;" %)Systems using systemd instead of upstart (like Ubuntu 16.04 LTS)
267
268 Here's a systemd unit to put into {{code language="none"}}/lib/systemd/system/wotaskd.service{{/code}}
269
270 {{code}}
271 # systemd unit for wotaskd to run on Ubuntu 16.04 LTS # Maik Musall <maik@selbstdenker.ag>, Aug 2016 [Unit] Description=WebObjects/Wonder wotaskd Documentation=https://wiki.wocommunity.org/display/documentation/Wonder+JavaMonitor+and+wotaskd AssertPathExists=/var/log/webobjects AssertPathExists=/opt/Local/Library/WebObjects/JavaApplications/wotaskd.woa [Service] User=appserver Group=appserveradm Environment=NEXT_ROOT=/opt Environment="JVM_OPTIONS=-Xms32m -Xmx64m -XX:NewSize=2m" Environment=WOTASKD_LOG=/var/log/webobjects/wotaskd.log ExecStart=/opt/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 -Xms32m -Xmx64m >> $WOTASKD_LOG 2>&1 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
272 {{/code}}
273
274 Start it with {{code language="none"}}systemctl start wotaskd.service{{/code}}
275
276 Start it at runtime by doing {{code language="none"}}systemctl enable wotaskd.service{{/code}}
277
278 Problems with Application Responding to WOMonitor/WOTaskd
279
280 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):
281
282 {{code}}
283 /etc/WebObjects/Properties
284 {{/code}}
285
286 And inside that file, add an array property that defines all the IP addresses assigned to your host, for example:
287
288 {{code}}
289 er.extensions.WOHostUtilities.localhostips=(192.168.3.168,192.168.1.168)
290 {{/code}}
291
292 (% class="auto-cursor-target" %)
293 \\
294
295 {{info}}
296 To learn more, see the class named WOHostUtilities in ERExtensions framework
297 {{/info}}
298
299 SELinux
300
301 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:
302
303 {{code}}
304 sudo setsebool -P httpd_can_network_connect=1
305 {{/code}}
306
307 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.
308
309 {{warning}}
310 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"]]
311 {{/warning}}
312
313 Additional Resources
314
315 [[Jonathon Rentzsch WOPlat Project 'WOInstaller + Wonder Web Server Adaptor + OS Support Files'>>url:http://github.com/rentzsch/woplat||shape="rect"]]
316 [[http:~~/~~/vmadmin.nt.com.au/?p=47>>url:http://vmadmin.nt.com.au/?p=47||shape="rect"]]
317 [[http:~~/~~/www.watermarkstudios.com/blog/?p=48>>url:http://www.watermarkstudios.com/blog/?p=48||shape="rect"]]