@ -56,37 +56,36 @@ fi
# Update Server
# Update Server
#--------------------------------------------------
#--------------------------------------------------
echo -e "\n---- Update Server ----"
echo -e "\n---- Update Server ----"
sudo apt-get update
apt-get update && apt-get upgrade -y
sudo apt-get upgrade -y
#--------------------------------------------------
#--------------------------------------------------
# Install PostgreSQL Server
# Install PostgreSQL Server
#--------------------------------------------------
#--------------------------------------------------
echo -e "\n---- Install PostgreSQL Server ----"
echo -e "\n---- Install PostgreSQL Server ----"
sudo apt-get install postgresql -y
apt-get install postgresql -y
echo -e " \n---- PostgreSQL $PG_VERSION Settings ---- "
echo -e " \n---- PostgreSQL $PG_VERSION Settings ---- "
sudo sed -i s/"#listen_addresses = 'localhost'" /"listen_addresses = '*'" /g /etc/postgresql/9.3/main/postgresql.conf
sed -i s/"#listen_addresses = 'localhost'" /"listen_addresses = '*'" /g /etc/postgresql/9.3/main/postgresql.conf #FIXME this line needs to be keept udated or replace version with computed one instead of hardcoded... do we know ahead that posgresql 9.3 will be version installed?
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
sudo su - postgres -c " createuser -s $OE_USER " 2> /dev/null || true
su - postgres -c " createuser -s $OE_USER " 2> /dev/null || true
#--------------------------------------------------
#--------------------------------------------------
# Install Dependencies
# Install Dependencies
#--------------------------------------------------
#--------------------------------------------------
echo -e "\n---- Install tool packages ----"
echo -e "\n---- Install tool packages ----"
sudo apt-get install wget subversion git bzr bzrtools python-pip gdebi-core -y
apt-get install wget subversion git bzr bzrtools python-pip gdebi-core -y
echo -e "\n---- Install python packages ----"
echo -e "\n---- Install python packages ----"
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
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
echo -e "\n---- Install python libraries ----"
echo -e "\n---- Install python libraries ----"
sudo pip install gdata
pip install gdata
echo -e "\n--- Install other required packages"
echo -e "\n--- Install other required packages"
sudo apt-get install node-clean-css -y
apt-get install node-clean-css -y
sudo apt-get install node-less -y
apt-get install node-less -y
sudo apt-get install python-gevent -y
apt-get install python-gevent -y
#--------------------------------------------------
#--------------------------------------------------
# Install Wkhtmltopdf if needed
# Install Wkhtmltopdf if needed
@ -99,51 +98,51 @@ if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
else
else
_url = $WKHTMLTOX_X32
_url = $WKHTMLTOX_X32
fi
fi
sudo wget $_url
wget $_url
sudo gdebi --n ` basename $_url `
gdebi --n ` basename $_url `
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
ln -s /usr/local/bin/wkhtmltoimage /usr/bin
else
else
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
fi
fi
echo -e "\n---- Create ODOO system user ----"
echo -e "\n---- Create ODOO system user ----"
sudo adduser --system --quiet --shell= /bin/bash --home= $OE_HOME --gecos 'ODOO' --group $OE_USER
adduser --system --quiet --shell= /bin/bash --home= $OE_HOME --gecos 'ODOO' --group $OE_USER
#The user should also be added to the sudo'ers group.
#The user should also be added to the sudo'ers group.
sudo adduser $OE_USER sudo
adduser $OE_USER sudo
echo -e "\n---- Create Log directory ----"
echo -e "\n---- Create Log directory ----"
sudo mkdir /var/log/$OE_USER
mkdir /var/log/$OE_USER
sudo chown $OE_USER :$OE_USER /var/log/$OE_USER
chown $OE_USER :$OE_USER /var/log/$OE_USER
#--------------------------------------------------
#--------------------------------------------------
# Install ODOO
# Install ODOO
#--------------------------------------------------
#--------------------------------------------------
echo -e "\n==== Installing ODOO Server ===="
echo -e "\n==== Installing ODOO Server ===="
sudo git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT /
git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT /
echo -e "\n---- Create custom module directory ----"
echo -e "\n---- Create custom module directory ----"
sudo su $OE_USER -c " mkdir $OE_HOME /custom "
su $OE_USER -c " mkdir $OE_HOME /custom "
sudo su $OE_USER -c " mkdir $OE_HOME /custom/addons "
su $OE_USER -c " mkdir $OE_HOME /custom/addons "
echo -e "\n---- Setting permissions on home folder ----"
echo -e "\n---- Setting permissions on home folder ----"
sudo chown -R $OE_USER :$OE_USER $OE_HOME /*
chown -R $OE_USER :$OE_USER $OE_HOME /*
echo -e "* Create server config file"
echo -e "* Create server config file"
sudo cp $OE_HOME_EXT /debian/openerp-server.conf /etc/${ OE_CONFIG } .conf
cp $OE_HOME_EXT /debian/openerp-server.conf /etc/${ OE_CONFIG } .conf
sudo chown $OE_USER :$OE_USER /etc/${ OE_CONFIG } .conf
chown $OE_USER :$OE_USER /etc/${ OE_CONFIG } .conf
sudo chmod 640 /etc/${ OE_CONFIG } .conf
chmod 640 /etc/${ OE_CONFIG } .conf
echo -e "* Change server config file"
echo -e "* Change server config file"
sudo sed -i s/"db_user = .*" /" db_user = $OE_USER " /g /etc/${ OE_CONFIG } .conf
sed -i s/"db_user = .*" /" db_user = $OE_USER " /g /etc/${ OE_CONFIG } .conf
sudo sed -i s/"; admin_passwd.*" /" admin_passwd = $OE_SUPERADMIN " /g /etc/${ OE_CONFIG } .conf
sed -i s/"; admin_passwd.*" /" admin_passwd = $OE_SUPERADMIN " /g /etc/${ OE_CONFIG } .conf
sudo su root -c " echo 'logfile = /var/log/ $OE_USER / $OE_CONFIG $1 .log' >> /etc/ ${ OE_CONFIG } .conf "
su root -c " echo 'logfile = /var/log/ $OE_USER / $OE_CONFIG $1 .log' >> /etc/ ${ OE_CONFIG } .conf "
sudo su root -c " echo 'addons_path= $OE_HOME_EXT /addons, $OE_HOME /custom/addons' >> /etc/ ${ OE_CONFIG } .conf "
su root -c " echo 'addons_path= $OE_HOME_EXT /addons, $OE_HOME /custom/addons' >> /etc/ ${ OE_CONFIG } .conf "
echo -e "* Create startup file"
echo -e "* Create startup file"
sudo su root -c " echo '#!/bin/sh' >> $OE_HOME_EXT /start.sh "
su root -c " echo '#!/bin/sh' >> $OE_HOME_EXT /start.sh "
sudo su root -c " echo 'sudo -u $OE_USER $OE_HOME_EXT /openerp-server --config=/etc/ ${ OE_CONFIG } .conf' >> $OE_HOME_EXT /start.sh "
su root -c " echo 'sudo -u $OE_USER $OE_HOME_EXT /openerp-server --config=/etc/ ${ OE_CONFIG } .conf' >> $OE_HOME_EXT /start.sh "
sudo chmod 755 $OE_HOME_EXT /start.sh
chmod 755 $OE_HOME_EXT /start.sh
#--------------------------------------------------
#--------------------------------------------------
# Adding ODOO as a deamon (initscript)
# Adding ODOO as a deamon (initscript)
@ -224,18 +223,18 @@ exit 0
EOF
EOF
echo -e "* Security Init File"
echo -e "* Security Init File"
sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG
mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG
sudo chmod 755 /etc/init.d/$OE_CONFIG
chmod 755 /etc/init.d/$OE_CONFIG
sudo chown root: /etc/init.d/$OE_CONFIG
chown root: /etc/init.d/$OE_CONFIG
echo -e "* Change default xmlrpc port"
echo -e "* Change default xmlrpc port"
sudo su root -c " echo 'xmlrpc_port = $OE_PORT ' >> /etc/ ${ OE_CONFIG } .conf "
su root -c " echo 'xmlrpc_port = $OE_PORT ' >> /etc/ ${ OE_CONFIG } .conf "
echo -e "* Start ODOO on Startup"
echo -e "* Start ODOO on Startup"
sudo update-rc.d $OE_CONFIG defaults
update-rc.d $OE_CONFIG defaults
echo -e "* Starting Odoo Service"
echo -e "* Starting Odoo Service"
sudo su root -c " /etc/init.d/ $OE_CONFIG start "
su root -c " /etc/init.d/ $OE_CONFIG start "
echo "-----------------------------------------------------------"
echo "-----------------------------------------------------------"
echo "Done! The Odoo server is up and running. Specifications:"
echo "Done! The Odoo server is up and running. Specifications:"
echo " Port: $OE_PORT "
echo " Port: $OE_PORT "