Last active
October 12, 2017 08:59
-
-
Save netjunky-hub/ac65b479fc4a306ae6bc to your computer and use it in GitHub Desktop.
Odoo development setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run as your work user | |
# Make sure you are not using root | |
# Disable sudo timeout | |
sudo sh -c 'echo "\nDefaults timestamp_timeout=-1">>/etc/sudoers' | |
# Projects root directory | |
ODOO_PROJECTS_DIR="projects" | |
# Odoo version | |
ODOO_VERSION="8.0" | |
# Confirm: that we are not using 'root' | |
echo -e "\n---- Check that we are not using 'root' ----" | |
whoami | |
# Check and update language | |
echo -e "\n---- Check and update language ----" | |
env | grep LANG | |
export LANG=hr_HR.UTF-8 | |
export LANGUAGE=hr_HR.UTF-8 | |
sudo dpkg-reconfigure locales | |
# This is your home directory | |
echo -e "\n---- This is your home directory ----" | |
echo $HOME | |
# Install system updates | |
echo -e "\n---- Install system updates ----" | |
sudo apt-get update && apt-get upgrade -y | |
# Install Git | |
echo -e "\n---- Install Git ----" | |
sudo apt-get install git -y | |
# Install Install PostgreSQL Server | |
echo -e "\n---- Install PostgreSQL Server ----" | |
sudo apt-get install postgresql -y | |
#echo -e "\n---- Creating the ODOO PostgreSQL User ----" | |
#sudo su - postgres -c "createuser -s $(whoami)" 2> /dev/null || true | |
# Install Odoo dependencies | |
echo -e "\n---- Install Odoo dependencies ----" | |
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 python-pip -y | |
# Create a directory to work in | |
echo -e "\n---- Create a directory to work in ----" | |
mkdir ~/$ODOO_PROJECTS_DIR | |
mkdir ~/$ODOO_PROJECTS_DIR/odoo-dev | |
# Go into our work directory | |
cd ~/$ODOO_PROJECTS_DIR/odoo-dev | |
# Get Odoo source code from gitub | |
# -b option asks to explicitly download the 8.0 branch of Odoo | |
# --depth 1 retrieves the latest version without all the history.. | |
echo -e "\n---- Get Odoo source code from gitub ----" | |
#git clone https://www.github.com/odoo/odoo --depth 1 --branch $ODOO_VERSION --single-branch . | |
git clone https://github.com/odoo/odoo.git -b $ODOO_VERSION | |
# Install Odoo system dependencies | |
echo -e "\n---- Install Odoo system dependencies ----" | |
./odoo/odoo.py setup_deps -y | |
# Create PostgreSQL superuser for this Unix user | |
echo -e "\n---- Create PostgreSQL superuser for this Unix user ----" | |
./odoo/odoo.py setup_pg | |
# Install wkhtml and place on correct place for ODOO | |
echo -e "\n---- Install wkhtml and place on correct place for ODOO ----" | |
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 cp /usr/local/bin/wkhtmltopdf /usr/bin | |
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin | |
sudo rm -rf wkhtmltox-0.12.1_linux-trusty-amd64.deb | |
# Create config directory so you can test different configs during development | |
# This exports and save current config and copy exported file into config directory | |
echo -e "\n---- Create config directory so you can test different configs during development ----" | |
mkdir ~/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config | |
sudo -su $(whoami) ~/$ODOO_PROJECTS_DIR/odoo-dev/odoo/odoo.py --save --stop-after-init | |
sudo cp ~/.openerp_serverrc ~/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config/openerp-server.conf | |
sudo chown $(whoami):$(whoami) ~/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config/openerp-server.conf | |
# Configure custom addons path. You don't want to mix custom modules and Odoo modules. | |
echo -e "\n---- Configure custom addons path ----" | |
mkdir ~/$ODOO_PROJECTS_DIR/odoo-dev/odoo/custom | |
mkdir ~/$ODOO_PROJECTS_DIR/odoo-dev/odoo/custom/addons | |
sudo sed -i "s|addons_path = *|addons_path = /home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/custom/addons,|" /home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config/openerp-server.conf | |
#sudo su root -c "echo 'addons_path=/home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/addons,/home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/custom/addons' >> /home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config/openerp-server.conf" | |
#sudo chown $(whoami):$(whoami) /home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config/openerp-server.conf | |
# It's time to install your favorite IDE | |
# Pycharm | |
echo -e "\n---- It's time to install your favorite IDE ----" | |
echo -e "\n---- Pycharm ... ----" | |
sudo wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add - | |
sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu $(lsb_release -sc)-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list' | |
sudo apt-get update | |
sudo apt-get install pycharm -y | |
# Remove libre office | |
echo -e "\n---- Remove libre office ----" | |
sudo apt-get remove --purge libreoffice-core -y | |
# Install Useful tools | |
echo -e "\n---- Install useful tools ----" | |
sudo apt-get install meld pgadmin3 poedit -y | |
# Remove Libre Office | |
echo -e "\n---- Remove Libre Office ----" | |
sudo apt-get purge libreoffice* -y | |
# Install open office | |
echo -e "\n---- Install open office ----" | |
cd /home/$(whoami) | |
wget http://sourceforge.net/projects/openofficeorg.mirror/files/4.1.1/binaries/en-US/Apache_OpenOffice_4.1.1_Linux_x86-64_install-deb_en-US.tar.gz | |
tar xzf Apache_OpenOffice_4.1.1_Linux_x86-64_install-deb_en-US.tar.gz | |
cd en-US/DEBS/ | |
sudo dpkg -i *.deb | |
cd desktop-integration/ | |
sudo dpkg -i openoffice4.1-debian-menus*.deb | |
cd /home/$(whoami) | |
rm -rf Apache_OpenOffice_4.1.1_Linux_x86-64_install-deb_en-US.tar.gz | |
rm -rf -R en-US | |
# Enable sudo timeout | |
sudo sed -i "/Defaults timestamp_timeout=-1/d" /etc/sudoers | |
echo -e "\n---- That's all folks. cd into pycharm bin folder and start pycharm ----" | |
echo "Path to your new config file:" | |
echo "/home/$(whoami)/$ODOO_PROJECTS_DIR/odoo-dev/odoo/config/openerp-server.conf" | |
echo -e "\n---- Templates will be installed after you exit pycharm ----" | |
echo -e "\n---- Happy coding ----" | |
cd /usr/share/pycharm/bin | |
./pycharm.sh | |
# Install Odoo templates for PyCharm. Thanks to Mohamed Magdy | |
# https://github.com/mohamedmagdy/odoo-pycharm-templates | |
echo -e "\n---- Install Odoo templates for PyCharm ----" | |
sudo wget https://raw.githubusercontent.com/mohamedmagdy/odoo-pycharm-templates/master/Odoo.xml -P /home/$(whoami)/.PyCharm40/config/templates | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment