forked from bikalims/bika.lims
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·286 lines (218 loc) · 9.3 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
#!/bin/bash
# This file is part of Bika LIMS
#
# Copyright 2011-2016 by it's authors.
# Some rights reserved. See LICENSE.txt, AUTHORS.txt.
#
# Original script by Inus Scheepers (inus@bikalabs.com),
# Proxy handling and Fedora suppot added
# by Pieter vd Merwe pieter_vdm@debortoli.com.au
# Updated to Plone 4.3.3 on 10 Jun 2014 by Inus Scheepers
# Also see https://github.com/bikalabs/Bika-LIMS/wiki/Bika-LIMS-Installation
# Bika LIMS Installation
# ----------------------
#
# This document describes the installation of Bika LIMS
# on Ubuntu/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 directory
BIKA_HOME=/home/bika
PLONE_VERSION=4.3.3
# 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.3.
#
# 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 ]; then # Ubuntu
aptitude install gcc
aptitude install zlib1g-dev
aptitude install libssl-dev
aptitude install gnuplot
aptitude install git-core
# WeasyPrint dependencies:
# http://weasyprint.org/docs/install/#debian-ubuntu
aptitude install libffi-dev
# Debian 7.0 Wheezy or newer, Ubuntu 11.10 Oneiric or newer:
aptitude install libcairo2
aptitude install libpango1.0-0
aptitude install libgdk-pixbuf2.0-0
#Debian 6.0 Squeeze, Ubuntu 10.04 Lucid
aptitude install libgtk2.0-0
else
if [ -f /etc/redhat-release ]; then # Fedora
yum install gcc zlib-devel openssl-devel gnuplot git-core wget patch
# WeasyPrint dependencies:
# see http://weasyprint.org/docs/install/#fedora
yum install libcairo2 libpango1.0-0 libgdk-pixbuf2.0-0 libffi-dev
fi
fi
# ## Download and install the Plone UnifiedInstaller
# Retrieve the unified installer and run the install shell script.
# The "dev" branch is used in this case. Omit the "-b dev" argument
# to use the master branch instead.
mkdir -p $BIKA_HOME
wget -nc --no-check-certificate "https://launchpad.net/plone/4.3/$PLONE_VERSION/+download/Plone-$PLONE_VERSION-UnifiedInstaller.tgz"
tar xzf Plone-$PLONE_VERSION-UnifiedInstaller.tgz
cd Plone-$PLONE_VERSION-UnifiedInstaller/
./install.sh --build-python --static-lxml=yes --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 -b dev https://github.com/bikalabs/Bika-LIMS.git src/bika.lims
git clone -b release/3.1.9 http://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
# WeasyPrint
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
python -c 'open("buildout.1","w").write("".join([line.replace(" Pillow", " Pillow\n WeasyPrint") for line in open("buildout.cfg").readlines()]))'
mv buildout.1 buildout.cfg
#and 'WeasyPrint = 0.19.2'
# in [versions] section
python -c 'open("buildout.1","w").write("".join([line.replace("[versions]", "[versions]\nWeasyPrint = 0.19.2") 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 non-fatal error messages may scroll past
### 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 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.txt
#
# The end.
#
# (Reuploaded on 26 Feb 2013 after it got clobbered)tion on a new Ubuntu installation via bash as follows
#
# bash ./installation.txt
#
# The end.
#
# (Reuploaded on 26 Feb 2013 after it got clobbered)