Skip to content

Instantly share code, notes, and snippets.

@bistaray
Last active February 24, 2016 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bistaray/c508a707d98136c8b94f to your computer and use it in GitHub Desktop.
Save bistaray/c508a707d98136c8b94f to your computer and use it in GitHub Desktop.
Ubuntu Scripts
# download the Ubuntu package lists from the repositories and update them to get information
# on the newest versions of packages and their dependencies
sudo apt-get update
# create odoo user and group
sudo adduser --system --home=/opt/odoo --group odoo --shell /bin/bash
# Install PostgreSQL 9.4
sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt trusty-pgdg main"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.4
# install PostgreSQL 9.3 and create a user for Odoo to use
# sudo apt-get -y install postgresql
#sudo su postgres -c "createuser -s odoo"
# Allow odoo user to login without a password by setting up trust authentication for local connections
# as root this has to go above the other line in the conf file I think
#sudo sed -i '$a#permit trusted connections from localhost for the odoo user' /etc/postgresql/9.3/main/pg_hba.conf
#sudo sed -i '$alocal all odoo trust' /etc/postgresql/9.3/main/pg_hba.conf
#sudo service postgresql restart
# Install dependancies for installing
sudo apt-get -y install git python-pip npm python-dev
# Install dependancies via apt-get
sudo apt-get install -y python-pybabel python-jinja2 python-mako python-markupsafe python-imaging python-pychart python-yaml \
python-werkzeug python-argparse python-decorator python-docutils python-feedparser python-gdata python-gevent python-greenlet \
python-lxml python-mock python-passlib python-psutil python-psycopg2 python-pypdf python-pydot python-pyparsing python-dateutil \
python-ldap python-openid python-tz python-usb python-qrcode python-reportlab python-requests python-simplejson python-six \
python-suds python-unittest2 python-vatnumber python-vobject python-wsgiref python-xlwt node-less ttf-dejavu python-xlrd libffi-dev
# Install dependancies via pip (-i not needed on DO)
sudo pip install jcconv ofxparse psycogreen pyserial flanker -i https://pypi.python.org/pypi
# Install dependancies via npm
sudo npm install -g less less-plugin-clean-css
sudo ln -s /usr/bin/nodejs /usr/bin/node
# Install wktohtml binary
sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/
# Grab odoo from repo
sudo git clone --depth=1 --branch=9.0 https://github.com/odoo/odoo.git /opt/odoo
# After authentication with GH
sudo git clone --depth=1 --branch=9.0 https://github.com/odoo/enterprise /opt/enterprise_addons
# Create place for custom and enterprise addons and logfile and give ubuntu user permission
sudo mkdir /opt/custom_addons
sudo mkdir /opt/enterprise_addons
sudo mkdir /var/log/odoo
sudo touch /var/log/odoo/odoo-server.log
sudo usermod -a -G odoo ubuntu
sudo chown -R odoo:odoo /var/log/odoo
sudo chown -R odoo:odoo /opt/custom_addons
sudo chown -R odoo:odoo /opt/enterprise_addons
sudo chmod -R g+w /opt/custom_addons
sudo chmod -R g+w /opt/enterprise_addons
# Create and update Config file
sudo mkdir /etc/odoo
sudo chmod a+w /etc/odoo
sudo cp /opt/odoo/debian/openerp-server.conf /etc/odoo/openerp-server.conf
sudo sed -i '$aaddons_path = /opt/enterprise_addons,/opt/custom_addons,/opt/odoo/addons' /etc/odoo/openerp-server.conf
sudo sed -i '$alogfile = /var/log/odoo/odoo-server.log' /etc/odoo/openerp-server.conf
sudo sed -i '$alogrotate = True' /etc/odoo/openerp-server.conf
sudo sed -r '$alog_handler = werkzeug:CRITICAL' /etc/odoo/openerp-server.conf
# Add ubuntu user to odoo group to allow for copying files via scp to odoo folders
sudo usermod -a -G odoo ubuntu
# Service
sudo cp /opt/odoo/debian/init /etc/init.d/odoo
sudo chmod +x /etc/init.d/odoo
sudo ln -s /opt/odoo/odoo.py /usr/bin/odoo.py
sudo update-rc.d -f odoo defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment