Skip to content

Commit a3a263a

Browse files
committed
Dev version
Dev version
1 parent f248b38 commit a3a263a

File tree

1 file changed

+234
-0
lines changed

1 file changed

+234
-0
lines changed

development/odoo_install.txt

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
#!/bin/bash
2+
################################################################################
3+
# Script for Installation: ODOO Saas4/Trunk server on Ubuntu 14.04 LTS
4+
# Author: Yenthe Van Ginneken
5+
#-------------------------------------------------------------------------------
6+
#
7+
# This script will install Odoo on your Ubuntu 14.04 server. It can install multiple Odoo instances
8+
# in one Ubuntu because of the different xmlrpc_ports
9+
#-------------------------------------------------------------------------------
10+
# USAGE:
11+
#
12+
# odoo-install
13+
#
14+
# EXAMPLE:
15+
# ./odoo-install
16+
#
17+
################################################################################
18+
19+
##fixed parameters
20+
#odoo
21+
OE_USER="odoo"
22+
OE_HOME="/$OE_USER"
23+
OE_HOME_EXT="/$OE_USER/${OE_USER}-server"
24+
#The default port where this Odoo instance will run under (provided you use the command -c in the terminal)
25+
#Set to true if you want to install it, false if you don't need it or have it already installed.
26+
INSTALL_WKHTMLTOPDF="True"
27+
##
28+
### WKHTMLTOPDF download links
29+
## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links,
30+
## in order to have correct version of wkhtmltox installed, for a danger note refer to
31+
## https://www.odoo.com/documentation/8.0/setup/install.html#deb ):
32+
WKHTMLTOX_X64=http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
33+
WKHTMLTOX_X32=http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-i386.deb
34+
35+
36+
#Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.)
37+
OE_PORT="8069"
38+
39+
#Choose the Odoo version which you want to install. For example: 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed.
40+
#IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 9.0
41+
OE_VERSION="9.0"
42+
43+
#set the superadmin password
44+
OE_SUPERADMIN="admin"
45+
OE_CONFIG="${OE_USER}-server"
46+
47+
#--------------------------------------------------
48+
# Update Server
49+
#--------------------------------------------------
50+
echo -e "\n---- Update Server ----"
51+
sudo apt-get update
52+
sudo apt-get upgrade -y
53+
54+
#--------------------------------------------------
55+
# Install PostgreSQL Server
56+
#--------------------------------------------------
57+
echo -e "\n---- Install PostgreSQL Server ----"
58+
sudo apt-get install postgresql -y
59+
60+
echo -e "\n---- PostgreSQL $PG_VERSION Settings ----"
61+
sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/g /etc/postgresql/9.3/main/postgresql.conf
62+
63+
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
64+
sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
65+
66+
#--------------------------------------------------
67+
# Install Dependencies
68+
#--------------------------------------------------
69+
echo -e "\n---- Install tool packages ----"
70+
sudo apt-get install wget subversion git bzr bzrtools python-pip gdebi-core -y
71+
72+
echo -e "\n---- Install python packages ----"
73+
sudo apt-get install python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests python-passlib python-pil -y
74+
75+
echo -e "\n---- Install python libraries ----"
76+
sudo pip install gdata
77+
78+
echo -e "\n--- Install other required packages"
79+
sudo apt-get install node-clean-css -y
80+
sudo apt-get install node-less -y
81+
sudo apt-get install python-gevent -y
82+
83+
#--------------------------------------------------
84+
# Install Wkhtmltopdf if needed
85+
#--------------------------------------------------
86+
if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
87+
echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 9 ----"
88+
#pick up correct one from x64 & x32 versions:
89+
if ((1<<32));then
90+
_url=$WKHTMLTOX_X64
91+
else
92+
_url=$WKHTMLTOX_X32
93+
fi
94+
sudo wget $_url
95+
sudo gdebi --n `basename $_url`
96+
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
97+
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
98+
else
99+
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
100+
fi
101+
102+
echo -e "\n---- Create ODOO system user ----"
103+
sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER
104+
#The user should also be added to the sudo'ers group.
105+
sudo adduser $OE_USER sudo
106+
107+
echo -e "\n---- Create Log directory ----"
108+
sudo mkdir /var/log/$OE_USER
109+
sudo chown $OE_USER:$OE_USER /var/log/$OE_USER
110+
111+
#--------------------------------------------------
112+
# Install ODOO
113+
#--------------------------------------------------
114+
echo -e "\n==== Installing ODOO Server ===="
115+
sudo git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/
116+
117+
echo -e "\n---- Create custom module directory ----"
118+
sudo su $OE_USER -c "mkdir $OE_HOME/custom"
119+
sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons"
120+
121+
echo -e "\n---- Setting permissions on home folder ----"
122+
sudo chown -R $OE_USER:$OE_USER $OE_HOME/*
123+
124+
echo -e "* Create server config file"
125+
sudo cp $OE_HOME_EXT/debian/openerp-server.conf /etc/${OE_CONFIG}.conf
126+
sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf
127+
sudo chmod 640 /etc/${OE_CONFIG}.conf
128+
129+
echo -e "* Change server config file"
130+
sudo sed -i s/"db_user = .*"/"db_user = $OE_USER"/g /etc/${OE_CONFIG}.conf
131+
sudo sed -i s/"; admin_passwd.*"/"admin_passwd = $OE_SUPERADMIN"/g /etc/${OE_CONFIG}.conf
132+
sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf"
133+
sudo su root -c "echo 'addons_path=$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf"
134+
135+
echo -e "* Create startup file"
136+
sudo su root -c "echo '#!/bin/sh' >> $OE_HOME_EXT/start.sh"
137+
sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/openerp-server --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh"
138+
sudo chmod 755 $OE_HOME_EXT/start.sh
139+
140+
#--------------------------------------------------
141+
# Adding ODOO as a deamon (initscript)
142+
#--------------------------------------------------
143+
144+
echo -e "* Create init file"
145+
cat <<EOF > ~/$OE_CONFIG
146+
#!/bin/sh
147+
### BEGIN INIT INFO
148+
# Provides: $OE_CONFIG
149+
# Required-Start: \$remote_fs \$syslog
150+
# Required-Stop: \$remote_fs \$syslog
151+
# Should-Start: \$network
152+
# Should-Stop: \$network
153+
# Default-Start: 2 3 4 5
154+
# Default-Stop: 0 1 6
155+
# Short-Description: Enterprise Business Applications
156+
# Description: ODOO Business Applications
157+
### END INIT INFO
158+
PATH=/bin:/sbin:/usr/bin
159+
DAEMON=$OE_HOME_EXT/openerp-server
160+
NAME=$OE_CONFIG
161+
DESC=$OE_CONFIG
162+
# Specify the user name (Default: odoo).
163+
USER=$OE_USER
164+
# Specify an alternate config file (Default: /etc/openerp-server.conf).
165+
CONFIGFILE="/etc/${OE_CONFIG}.conf"
166+
# pidfile
167+
PIDFILE=/var/run/\${NAME}.pid
168+
# Additional options that are passed to the Daemon.
169+
DAEMON_OPTS="-c \$CONFIGFILE"
170+
[ -x \$DAEMON ] || exit 0
171+
[ -f \$CONFIGFILE ] || exit 0
172+
checkpid() {
173+
[ -f \$PIDFILE ] || return 1
174+
pid=\`cat \$PIDFILE\`
175+
[ -d /proc/\$pid ] && return 0
176+
return 1
177+
}
178+
case "\${1}" in
179+
start)
180+
echo -n "Starting \${DESC}: "
181+
start-stop-daemon --start --quiet --pidfile \$PIDFILE \
182+
--chuid \$USER --background --make-pidfile \
183+
--exec \$DAEMON -- \$DAEMON_OPTS
184+
echo "\${NAME}."
185+
;;
186+
stop)
187+
echo -n "Stopping \${DESC}: "
188+
start-stop-daemon --stop --quiet --pidfile \$PIDFILE \
189+
--oknodo
190+
echo "\${NAME}."
191+
;;
192+
restart|force-reload)
193+
echo -n "Restarting \${DESC}: "
194+
start-stop-daemon --stop --quiet --pidfile \$PIDFILE \
195+
--oknodo
196+
sleep 1
197+
start-stop-daemon --start --quiet --pidfile \$PIDFILE \
198+
--chuid \$USER --background --make-pidfile \
199+
--exec \$DAEMON -- \$DAEMON_OPTS
200+
echo "\${NAME}."
201+
;;
202+
*)
203+
N=/etc/init.d/\$NAME
204+
echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2
205+
exit 1
206+
;;
207+
esac
208+
exit 0
209+
EOF
210+
211+
echo -e "* Security Init File"
212+
sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG
213+
sudo chmod 755 /etc/init.d/$OE_CONFIG
214+
sudo chown root: /etc/init.d/$OE_CONFIG
215+
216+
echo -e "* Change default xmlrpc port"
217+
sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf"
218+
219+
echo -e "* Start ODOO on Startup"
220+
sudo update-rc.d $OE_CONFIG defaults
221+
222+
echo -e "* Starting Odoo Service"
223+
sudo su root -c "/etc/init.d/$OE_CONFIG start"
224+
echo "-----------------------------------------------------------"
225+
echo "Done! The Odoo server is up and running. Specifications:"
226+
echo "Port: $OE_PORT"
227+
echo "User service: $OE_USER"
228+
echo "User PostgreSQL: $OE_USER"
229+
echo "Code location: $OE_USER"
230+
echo "Addons folder: $OE_USER/$OE_CONFIG/addons/"
231+
echo "Start Odoo service: sudo service $OE_CONFIG start"
232+
echo "Stop Odoo service: sudo service $OE_CONFIG stop"
233+
echo "Restart Odoo service: sudo service $OE_CONFIG restart"
234+
echo "-----------------------------------------------------------"

0 commit comments

Comments
 (0)