Skip to content

Instantly share code, notes, and snippets.

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 inspiretk/a7ff17644ced0d9badc2e70bf82edd58 to your computer and use it in GitHub Desktop.
Save inspiretk/a7ff17644ced0d9badc2e70bf82edd58 to your computer and use it in GitHub Desktop.
odoo11 Server Setup Install
Follow scripts to install odoo 11 on Ubuntu 18.04
Nginx setup for redirect
SSL setup with Lets Encrypt
# do the following commands manually
# Update server, and install odoo
#install odoo 11 requirements
#ignore sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less -y
#ignore wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb
#ignore sudo apt install ./wkhtmltox_0.12.1.3-1~bionic_amd64.deb -y
sudo apt update && sudo apt upgrade -y
# source go to https://github.com/Yenthe666/InstallScript
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh
nano odoo_install.sh
# Line OE_USER="odoo" is your odoo folder name leave as it is
# Line OE_SUPERADMIN="admin" is the master password for this Odoo installation (admin). Change admin to your new strong password
sudo chmod +x odoo_install.sh
sudo ./odoo_install.sh
# odoo will install on port 8069; odoo version 12 community edition
# If you're installing multiple domain:
## Go to your DNS, and point A record to your seriver IP
## Access your odoo: domain:8069 and create your domain
#!/bin/bash
# This script is to setup server, install nginx and setup, install Lets Encrypt
# It will have lets encrypt ssl, www to non www redirect, odoo port 8069 to port 80
# Make sure you make a STRONG PASSWORD for Master Password for your databases
# go to cd /etc and type ls and see if you can see your odoo conf file, this script has /etc/odoo-server.conf, yours can be different
# if your odoo conf file is different, rename it in the script variables ODOOCFOLDER and ODOOCFILE
# run these commands below with root user, you can disable root user after you're done
# nano serversetup.sh
# Copy everything in this script and paste it in, save file and exit
# chmod +x serversetup.sh
# ./serversetup.sh
# (when script is running, press enter to continue, put your important email for ssl renewal notices, 2 for redirect to non www)
ODOOCFOLDER=/etc
ODOOCFILE=odoo-server.conf
sudo apt update && sudo apt upgrade -y
echo -e "\n---- Update odoo conf file for mutliple database ----"
cd $ODOOCFOLDER
# echo "db_host = False" >> $ODOOCFILE
# echo "db_port = False" >> $ODOOCFILE
# echo "db_user = odoo" >> $ODOOCFILE
echo "dbfilter = %d" >> $ODOOCFILE
# sudo sed -i 's/dbfilter = /dbfilter = ^%h\$/g' $ODOOCFILE
sudo service odoo-server restart
echo -e "\n---- apt-get update and upgrade ----"
cd
sudo apt-get update
sudo apt-get upgrade -y
echo -e "\n---- Install nginx, and set up ----"
sudo apt install nginx -y
echo -e "\n---- Setting up basic firewall Nginx Full and OpenSSH ----"
sudo ufw enable
sudo ufw allow 'Nginx Full'
sudo ufw allow 'OpenSSH'
echo -e "\n---- Setting up nginx conf default file as templaet for your future domain name ----"
cd /etc/nginx/sites-available
sudo sed -i '$ d' default
sudo sed -i '$ d' default
sudo sed -i '$ d' default
sudo sed -i 's|# First attempt to serve request as file, then|proxy_pass http://localhost:8069;|g' default
sudo sed -i 's|# as directory, then fall back to displaying a 404.|proxy_http_version 1.1;|g' default
sudo sed -i 's|try_files $uri $uri/ =404;|proxy_set_header Upgrade $http_upgrade;|g' default
sudo sed -i "/proxy_set_header Upgrade \$http_upgrade;/a proxy_set_header Connection 'upgrade';" default
sudo sed -i "/proxy_set_header Connection 'upgrade';/a proxy_set_header Host \$host;" default
sudo sed -i "/proxy_set_header Host \$host;/a proxy_cache_bypass \$http_upgrade;" default
echo -e "\n---- Removing default_server in default nginx file----"
cd /etc/nginx/sites-available
sudo sed -i 's/listen 80 default_server;/listen 80;/g' default
sudo sed -i "s|listen \[::\]:80 default_server;|listen \[::\]:80;|g" default
echo -e "\n---- Installing Lets Encrypt only ----"
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
apt install python-certbot-nginx -y
sudo apt-get install software-properties-common python-software-properties
apt-get install python-certbot-nginx -y
sudo nginx -t
systemctl reload nginx.service
echo -e "\n---- EVERYTHING COMPLETED!!! ----"
echo -e "\n---- Gooooood Luck to you!!! ----"
#!/bin/bash
# This script is to setup 1 New Domain Redirect using Nginx
# Change DOMAIN1=yourdomainname.com (lowercase)
# nano newdomainredirect.sh
# Copy everything in this script and paste it in, save file and exit
# chmod +x newdomainredirect.sh
# ./newdomainredirect.sh
DOMAIN1=cellardrop.com.au
echo -e "\n---- Rename default nginx file to your domain name and delete enabled default file ----"
cd /etc/nginx/sites-available
sudo cp default $DOMAIN1
echo -e "\n---- Setting up redirect www to non www and fixing up server name----"
echo -e "\n---- Doing on domain1 ----"
cd /etc/nginx/sites-available
echo "server {" >> $DOMAIN1
echo "listen 80;" >> $DOMAIN1
echo "server_name www.$DOMAIN1;" >> $DOMAIN1
echo "return 301 \$scheme://$DOMAIN1\$request_uri;" >> $DOMAIN1
echo "}" >> $DOMAIN1
sed -i "/server_name _;/c\server_name $DOMAIN1;" $DOMAIN1
sudo service nginx restart
echo -e "\n---- Enable the domains ngix file from available to enable ----"
sudo ln -s /etc/nginx/sites-available/$DOMAIN1 /etc/nginx/sites-enabled/$DOMAIN1
nginx -t
sudo service nginx restart
echo -e "\n---- EVERYTHING COMPLETED!!! ----"
echo -e "\n---- will push www to non www; ----"
echo -e "\n---- use default website port 80, so no need to put port number 8069 at the end for odoo ----"
echo -e "\n---- Gooooood Luck to you!!! ----"
#!/bin/bash
# Copy this script with below instructions
# Change DOMAIN1=yourdomainname.com (lowercase)
# nano newdomainssl.sh
# Copy everything in this script and paste it in, save file and exit
# chmod +x newdomainssl.sh
# ./newdomainssl.sh
DOMAIN1=cellardrop.com.au
echo -e "\n---- Setting up SSL on domain1 ----"
certbot --nginx -d $DOMAIN1
sudo nginx -t
systemctl reload nginx.service
echo -e "\n---- EVERYTHING COMPLETED!!! ----"
echo -e "\n---- SSL Setup completed for your new domain name ----"
echo -e "\n---- Gooooood Luck to you!!! ----"
# If you get the following errors, solutions available:
Error: when creating a database in odoo, this error comes up:
Database creation error: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.
Solution:
https://www.odoo.com/fr_FR/forum/aide-1/question/dataerror-new-encoding-utf8-is-incompatible-with-the-encoding-of-the-template-database-sql-ascii-52124
# just go to your server, and type the following commands, do line by line.
sudo -u postgres psql postgres
update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';
(press Ctrl-D to quit from psql)
### End of solution ###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment