151 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			151 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
#!/bin/bash
 | 
						|
################################################################################
 | 
						|
# Script for Installation: ODOO Saas4/Trunk server on Ubuntu 14.04 LTS
 | 
						|
# Author: André Schenkels, ICTSTUDIO 2014
 | 
						|
#-------------------------------------------------------------------------------
 | 
						|
#  
 | 
						|
# This script will install ODOO Server on
 | 
						|
# clean Ubuntu 14.04 Server
 | 
						|
#-------------------------------------------------------------------------------
 | 
						|
# USAGE:
 | 
						|
#
 | 
						|
# odoo-install
 | 
						|
#
 | 
						|
# EXAMPLE:
 | 
						|
# ./odoo-install 
 | 
						|
#
 | 
						|
################################################################################
 | 
						|
 
 | 
						|
##fixed parameters
 | 
						|
OE_USER="odoo"
 | 
						|
OE_HOME="/opt/$OE_USER"
 | 
						|
OE_HOME_EXT="/opt/$OE_USER/$OE_USER-server"
 | 
						|
 | 
						|
#Enter version for checkout "7.0" for version 7.0, "saas-4, saas-5 (opendays version) and "master" for trunk
 | 
						|
OE_VERSION="7.0"
 | 
						|
 | 
						|
#set the superadmin password
 | 
						|
OE_SUPERADMIN="c76EVdqj"
 | 
						|
OE_CONFIG="$OE_USER-server"
 | 
						|
 | 
						|
#--------------------------------------------------
 | 
						|
# Set Locale en_US.UTF-8
 | 
						|
#--------------------------------------------------
 | 
						|
#echo -e "\n---- Set en_US.UTF-8 Locale ----"
 | 
						|
#sudo cp /etc/default/locale /etc/default/locale.BACKUP
 | 
						|
#sudo rm -rf /etc/default/locale
 | 
						|
#echo -e "* Change server config file"
 | 
						|
#sudo su root -c "echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale"
 | 
						|
#sudo su root -c "echo 'LANG="en_US.UTF-8"' >> /etc/default/locale"
 | 
						|
#sudo su root -c "echo 'LANGUAGE="en_US:en"' >> /etc/default/locale"
 | 
						|
 | 
						|
#--------------------------------------------------
 | 
						|
# Update Server
 | 
						|
#--------------------------------------------------
 | 
						|
echo -e "\n---- Update Server ----"
 | 
						|
sudo apt-get upgrade -y
 | 
						|
sudo apt-get update
 | 
						|
 | 
						|
#--------------------------------------------------
 | 
						|
# Install PostgreSQL Server
 | 
						|
#--------------------------------------------------
 | 
						|
echo -e "\n---- Install PostgreSQL Server ----"
 | 
						|
sudo apt-get install postgresql -y  
 | 
						|
 | 
						|
#echo -e "\n---- PostgreSQL $PG_VERSION Settings  ----"
 | 
						|
#sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/g /etc/postgresql/9.3/main/postgresql.conf
 | 
						|
 | 
						|
echo -e "\n---- Creating the ODOO PostgreSQL User  ----"
 | 
						|
sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
 | 
						|
 | 
						|
#--------------------------------------------------
 | 
						|
# Install Dependencies
 | 
						|
#--------------------------------------------------
 | 
						|
echo -e "\n---- Install tool packages ----"
 | 
						|
sudo apt-get install wget git bzr python-pip -y
 | 
						|
 | 
						|
echo -e "\n---- Install python packages ----"
 | 
						|
sudo apt-get install python-gevent 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-pdftools python-setuptools python-pybabel python-imaging python-matplotlib python-reportlab-accel python-openssl python-egenix-mxdatetime python-paramiko antiword python-decorator poppler-utils python-requests python-passlib -y
 | 
						|
 | 
						|
sudo pip install gevent gevent_psycopg2 psycogreen passlib
 | 
						|
	
 | 
						|
echo -e "\n---- Install latest gdata-python-client ----"
 | 
						|
cd /tmp
 | 
						|
wget http://gdata-python-client.googlecode.com/files/gdata-2.0.18.tar.gz
 | 
						|
tar zxvf gdata-2.0.18.tar.gz
 | 
						|
cd gdata-2.0.18/
 | 
						|
sudo python setup.py install
 | 
						|
 | 
						|
 | 
						|
echo -e "\n---- Install Wkhtmltopdf 0.12.1 ----"
 | 
						|
sudo wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
 | 
						|
sudo dpkg -i wkhtmltox-*.deb
 | 
						|
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
 | 
						|
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
 | 
						|
	
 | 
						|
echo -e "\n---- Create ODOO system user ----"
 | 
						|
sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER
 | 
						|
sudo adduser $OE_USER sudo
 | 
						|
sudo cp /root/.profile $OE_HOME
 | 
						|
sudo chown $OE_USER:$OE_USER $OE_HOME/.profile
 | 
						|
sudo cp /root/.bashrc $OE_HOME
 | 
						|
sudo chown $OE_USER:$OE_USER $OE_HOME/.bashrc
 | 
						|
 | 
						|
echo -e "\n---- Create Log directory ----"
 | 
						|
sudo mkdir /var/log/$OE_USER
 | 
						|
sudo chown $OE_USER:$OE_USER /var/log/$OE_USER
 | 
						|
sudo chmod 700 /var/log/$OE_USER
 | 
						|
 | 
						|
echo -e "\n---- Set Logrotate config ----"
 | 
						|
sudo ln -s /opt/odoo/ext/config/logrotate /etc/logrotate.d/odoo
 | 
						|
 | 
						|
#--------------------------------------------------
 | 
						|
# Install ODOO
 | 
						|
#--------------------------------------------------
 | 
						|
 | 
						|
echo -e "\n---- Setting permissions on home folder ----"
 | 
						|
sudo chown -R $OE_USER:$OE_USER $OE_HOME/*
 | 
						|
 | 
						|
echo -e "Odoo Init File"
 | 
						|
sudo ln -s /opt/odoo/exit/config/odoo-server.init /etc/init.d/odoo-server
 | 
						|
 | 
						|
echo -e "\n---- Setup Git ----"
 | 
						|
sudo -u odoo mkdir /opt/odoo/odoo.git
 | 
						|
sudo -u odoo mkdir /opt/odoo/odoo
 | 
						|
sudo -u odoo mkdir /opt/odoo/ext.git
 | 
						|
sudo -u odoo mkdir /opt/odoo/ext
 | 
						|
cd /opt/odoo/odoo.git
 | 
						|
sudo -u odoo git init --bare
 | 
						|
cd /opt/odoo/ext.git
 | 
						|
sudo -u odoo git init --bare
 | 
						|
 | 
						|
sudo -u odoo touch /opt/odoo/odoo.git/hooks/post-receive
 | 
						|
sudo -u odoo echo -e '#!/bin/bash' >> /opt/odoo/odoo.git/hooks/post-receive
 | 
						|
sudo -u odoo echo -e 'git --work-tree=/opt/odoo/odoo --git-dir=/opt/odoo/odoo.git checkout -f' >> /opt/odoo/odoo.git/hooks/post-receive
 | 
						|
sudo -u odoo chmod +x /opt/odoo/odoo.git/hooks/post-receive
 | 
						|
 | 
						|
sudo -u odoo touch /opt/odoo/ext.git/hooks/post-receive
 | 
						|
sudo -u odoo echo -e '#!/bin/bash' >> /opt/odoo/ext.git/hooks/post-receive
 | 
						|
sudo -u odoo echo -e 'git --work-tree=/opt/odoo/ext --git-dir=/opt/odoo/ext.git checkout -f' >> /opt/odoo/ext.git/hooks/post-receive
 | 
						|
sudo -u odoo chmod +x /opt/odoo/ext.git/hooks/post-receive
 | 
						|
 | 
						|
echo "Done! The ODOO server can be started with /etc/init.d/$OE_CONFIG"
 | 
						|
echo "Please reboot the server now so that Wkhtmltopdf is working with your install."
 | 
						|
 | 
						|
echo "Done! Please specify a password for user '$OE_USER'"
 | 
						|
sudo passwd $OE_USER
 | 
						|
 | 
						|
##
 | 
						|
##  HERE git push of local is required
 | 
						|
##
 | 
						|
## Local commands:
 | 
						|
#git init 
 | 
						|
#git remote add odoo https://github.com/odoo/odoo.git
 | 
						|
#git pull odoo 8.0 
 | 
						|
#git remote add production odoo@134.119.17.66:/opt/odoo/odoo.git
 | 
						|
#git config --global push.default simple  # only push if on remote exists branch with same name
 | 
						|
#git push --set-upstream production master
 | 
						|
 | 
						|
echo -e "* Start ODOO on Startup"
 | 
						|
sudo update-rc.d $OE_CONFIG defaults
 |