forked from bikalims/bika.lims
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·292 lines (221 loc) · 9.12 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/bin/bash
# Bika LIMS Installation
# ----------------------
#
# Original script by Inus Scheepers ([email protected]),
# Proxy handling and Fedora suppot added
# by Pieter vd Merwe [email protected]
# Minor updates by Inus Scheepers on 14 Aug 2013
# Updated for Debian 7 and cffi on 8 Oct 2013
#
# This document describes the installation of Bika LIMS
# on Ubuntu/Debian/Fedora Linux, using the Plone Unified Installer package.
# ## Configure environment.
# Change the following values if you are installing to a different directory
# or a using an internet proxy
# The target installation subdirectory name can be specified as an argument on the
# command line, failing which a subdirectory "bika" will be created in the current
# directory where the installation will be done.
if [ "$1" == '' ]; then
BIKA_HOME="`pwd`/bika"
else
BIKA_HOME="`pwd`/$1"
fi
echo "Installing into directory $BIKA_HOME"
# If a proxy is used, set this value.
# PROXY=http://user:password@proxy1:80
# Script check. You need to run this script as root
if [ ! $UID -eq 0 ]; then
echo "Script must be run as root"
echo "Try: sudo `basename $0`"
exit 1
fi
# Set the linux proxy environment variables. It may alread have been set
# but the sudo setup may not be configured to pass it along.
if [ -n "${PROXY}" ]; then
export http_proxy=${PROXY}
export https_proxy=${PROXY}
fi
# ## Download and install Plone
#
# The latest Unified Installer can be found at http://plone.org/products/plone/releases
# Plone 4 or newer is required. Bika has been tested with Plone 4.2.5.
#
# All steps are required except where marked as optionally. If your installation fails,
# ensure that each step has completed successfully.
#
# ## Install server (Linux) dependencies
#
# The following commands are as used for Ubuntu 12.04 and Fedora 17.
# Use a package manager to install the needed dependencies:
# (apt-get is an alternative to yum)
if [ -f /etc/lsb-release ] || [ -f /etc/issue ] ; then # Ubuntu or Debian 7
aptitude install -y gcc
aptitude install -y zlib1g-dev
aptitude install -y libssl-dev
aptitude install -y gnuplot
aptitude install -y git-core
aptitude install -y python-dev
aptitude install -y make
aptitude install -y libxml2-dev
aptitude install -y libxslt1-dev
aptitude install -y python-distribute
aptitude install -y build-essential
aptitude install -y libbz2-dev
aptitude install -y libjpeg-dev
aptitude install -y libreadline-dev
aptitude install -y wv
aptitude install -y poppler-utils
aptitude install -y python-imaging
aptitude install -y libffi-dev
else
if [ -f /etc/redhat-release ]; then # Fedora
yum install gcc zlib-devel openssl-devel gnuplot git-core wget patch
fi
fi
if ! [ -d $BIKA_HOME ] ; then
echo "Creating installation directory $BIKA_HOME"
mkdir -p $BIKA_HOME
else
echo "Installation directory $BIKA_HOME already exists"
fi
# Download and install the Plone UnifiedInstaller
if ! [ -f Plone-4.2.5-UnifiedInstaller.tgz ]; then
echo "Downloading Plone-4.2.5-UnifiedInstaller.tgz"
wget --no-check-certificate -nc https://launchpad.net/plone/4.2/4.2.5/+download/Plone-4.2.5-UnifiedInstaller.tgz
fi
if ! [ -d Plone-4.2.5-UnifiedInstaller ] ; then
echo "Extracting Plone-4.2.5-UnifiedInstaller.tgz"
tar xzf Plone-4.2.5-UnifiedInstaller.tgz
fi
echo "**** Starting Zope/Plone installation *******"
cd Plone-4.2.5-UnifiedInstaller
./install.sh --target=${BIKA_HOME} standalone
# Visit http://plone.org/documentation/topic/Installation for more
# information about setting up Plone if the above fails.
# ## Change to the new Plone instance directory
cd ${BIKA_HOME}/zinstance
# If the proxy isn't set for git, set it. The linux
# environment variables should be enough, but it didn't work on fedora.
if [ -n "$PROXY" ] && [ -z "`git config --get http.proxy`" ]; then
git config --global http.proxy ${PROXY}
fi
# At this point a plain Plone instance could be built and run.
# This is a good intermediary checkpoint in case of any system
# issues or installation problems. Refer to http://Plone.org
# if this step fails.
# ## (Option) Retrieve the development branch Bika code
git clone https://github.com/bikalabs/Bika-LIMS.git src/bika.lims
# Omit the command line switch '-b dev' to use the master branch instead.
# ## Edit Plone/zinstance/buildout.conf and add Bika LIMS.
# Find the "eggs" section and add "bika.lims"
#
# eggs =
# ...
# bika.lims
python -c 'open("buildout.1","w").write("".join([line.replace(" Pillow", " Pillow\n bika.lims") for line in open("buildout.cfg").readlines()]))'
mv buildout.1 buildout.cfg
### (Option) - Use the latest source code instead of the PYPI egg
# Find the "develop" section and add "src/bika.lims" to it
#
# develop =
# src/bika.lims
python -c 'open("buildout.2","w").write("".join([line.replace("develop =", "develop =\n src/bika.lims") for line in open("buildout.cfg").readlines()]))'
mv buildout.2 buildout.cfg
### Run buildout
bin/buildout
# Some error messages may scroll past, especially on the first run of
# buildout during the "reportlab" installation. They can be ignored.
# Eg. "Download error on http://stompstompstomp.com/pyPdf/ "
### Workaround for MacOSX locale error
if [ `uname` == "Darwin" ]; then
export LANG=
export LC_CTYPE=
fi
### Start Plone
# Start the Plone instance in foreground (debug) mode which will
# display the instance log on the console.
bin/plonectl fg
# Alternatively, start it as a normal server process:
# bin/plonectl start
# The log should indicate that the Zope server is ready to serve
# requests, and the port. If it does not start up, ensure that a
# server is not already using the chosen port.
#
# You may track the instance log for a server process by running
#
# tail -f var/log/instance.log
### Add a new Plone instance with the Bika LIMS extension:
# Assign an ID of your choice, and select the checkbox to activate the
# Bika-LIMS extension profile. The 'title' field is optional.
#
# To add Bika LIMS to an existing Plone site, visit the Addons page
# of Site Setup or the quickinstaller.
# IMPORTANT: Don't use "Bika" or "BIKA" as the instance name, this is a
# reserved namespace. If you get "Site Error" citing "AttributeError: adapters",
# this is the most likely cause.
### Removing the installed database and starting fresh
# In case you need to start with a clean slate, (re)move the Data.fs files.
# This will remove all Plone instances, and WILL DESTROY all entered data.
# The Plone and Bika code will not be affected.
# rm -f var/filestorage/*
# In this case, or if you have problems logging in, you might need to
# initialize the Plone database with an admin user:
# bin/plonectl adduser admin password
# That's it!
### Visit the site in your Browser
# You should be able to test the site now by visiting
# http://localhost:8080/Plone
# or, for the really lazy:
# http://admin:password@localhost:8080/Plone
# If you need to visit the ZMI, use
# http://localhost:8080/manage
# If no Plone object exists, add one and tick the "Bika LIMS" extension.
# (Note that "Bika" may not work as an instance name, see above.)
# You can edit the code in src/bika.lims and restart the instance to
# make the changes take effect. It should not affect the installed databases.
# Changing the CSS does not require the instance to be restarted.
#
# Once logged in, you will be given the option to load a test laboratory
# setup via a link on the front page. To verify, select a client from the
# left-hand portlet, add an Analysis Request, and fill in the fields.
# Progress the AR through reception, results entry, verification/retraction
# and publication phases. Note that the mail server setup, in "Site Setup"
# at the top righthand, needs to be completed before mail can be delivered.
#### Error code encountered in case the code for "bika.lims" not installed
# If you encounter the message "AttributeError: type object 'IIdServer' has no attribute '__iro__'"
# it may mean that the Bika lims code was not included, neither as egg
# or as source code, while the Bika objects are in the Plone database.
#
#
#### Adding Plone proxying to Apache setup for port 80 HTTP service
# Find the apache virtual host entry, by default in Ubuntu in
# /etc/apache2/sites-enabled/000-default and add the following:
# <Virtualhost *:80>
# ...
# <Proxy *>
# Order deny,allow
# Allow from all
# </Proxy>
# Proxypass / http://localhost:8080/
# ProxypassReverse / http://localhost:8080/
# </VirtualHost>
# You would also need to enable the module for the stock Ubuntu
# installation of apache:
# a2enmod proxy
# Restart apache to effect changes:
# apache2ctl restart
# You may now visit http://server/Plone (or your chosen instance name).
#### Adding Plone server to the system startup
# Add the following line to /etc/rc.local, before
# the "exit 0" line, adjusting for the target directory name:
# /home/bika/zinstance/bin/plonectl start
# Test by rebooting the server and verification by visiting the
# URL by browser to check if everything starts up and the site is accessible.
#
# Thank for you reading the entire document, you may run this
# installation on a new Ubuntu installation via bash as follows
#
# bash ./installation.sh
#
# The end.