Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save inspiretk/11432e48c705fb5a9a9e34e10f284799 to your computer and use it in GitHub Desktop.
Save inspiretk/11432e48c705fb5a9a9e34e10f284799 to your computer and use it in GitHub Desktop.
sudo apt update && sudo apt upgrade -y
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
wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb
sudo apt install ./wkhtmltox_0.12.1.3-1~bionic_amd64.deb -y
# source go to https://github.com/Yenthe666/InstallScript
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/12.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
#### Misc stuff below ###
# Current default time zone: 'Etc/UTC'
Local time is now: Sat Nov 24 13:32:34 UTC 2018.
Universal Time is now: Sat Nov 24 13:32:34 UTC 2018.
Run 'dpkg-reconfigure tzdata' if you wish to change it.
-------------
Package python-pypdf is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-pybabel' has no installation candidate
E: Package 'python-pypdf' has no installation candidate
---------------
Dependency is not satisfiable: libpng12-0
------------------------------
Done! The Odoo server is up and running. Specifications:
Port: 8069
User service: odoo
User PostgreSQL: odoo
Code location: odoo
Addons folder: odoo/odoo-server/addons/
Start Odoo service: sudo service odoo-server start
Stop Odoo service: sudo service odoo-server stop
Restart Odoo service: sudo service odoo-server restart
----------- misc commands ----------
htop
kill python3
kill -9 python3
################ serverupdated ###############
sudo apt update && sudo apt upgrade -y
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
wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb
sudo apt install ./wkhtmltox_0.12.1.3-1~bionic_amd64.deb -y
#############################################
## https://linuxize.com/post/how-to-deploy-odoo-12-on-ubuntu-18-04/
sudo useradd -m -d /opt/odoo12 -U -r -s /bin/bash odoo12
sudo apt-get install postgresql -y
sudo su - postgres -c "createuser -s odoo12"
sudo su - odoo12
git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo12/odoo
cd /opt/odoo12
python3 -m venv odoo-venv
source odoo-venv/bin/activate
pip3 install wheel
pip3 install -r odoo/requirements.txt
deactivate
mkdir /opt/odoo12/odoo-custom-addons
exit
sudo cp /opt/odoo12/odoo/debian/odoo.conf /etc/odoo12.conf
sudo nano /etc/odoo12.conf
### edit below as follows:
[options]
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo12
db_password = False
addons_path = /opt/odoo12/odoo/addons,/opt/odoo12/odoo-custom-addons
######
sudo nano /etc/systemd/system/odoo12.service
#### copy paste this into your odoo12.service file
[Unit]
Description=Odoo12
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo12
PermissionsStartOnly=true
User=odoo12
Group=odoo12
ExecStart=/opt/odoo12/odoo-venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
################## end of file
sudo systemctl daemon-reload
sudo systemctl start odoo12
sudo systemctl status odoo12
q
sudo systemctl enable odoo12
## Open your browser and test your odoo 12 install, should have database screen http://<your_domain_or_IP_address>:8069
## install nginx https://linuxize.com/post/how-to-install-nginx-on-ubuntu-18-04/
sudo apt update
sudo apt install nginx -y
sudo systemctl status nginx
q
sudo ufw enable
sudo ufw allow 'Nginx Full'
sudo ufw allow 'OpenSSH'
sudo ufw status
## should see both active
## go to your browser, and put your ip, you'll see welcome to nginx page
## to stop nginx, command below
sudo systemctl stop nginx
## to start nginx, command below
sudo systemctl start nginx
## to restart nginx, command below
sudo systemctl restart nginx
## to reload nginx configuration after updating its settings
sudo systemctl reload nginx
#### By default Nginx service will start on boot. If you want to disable the Nginx service to start at boot: sudo systemctl disable nginx
#### And to re-enable it again: sudo systemctl enable nginx
## Creating server block https://linuxize.com/post/how-to-set-up-nginx-server-blocks-on-ubuntu-18-04/
nano /etc/nginx/sites-available/thuani.com
#### Copy/paste the below in
server {
listen 80;
listen [::]:80;
root /var/www/thuani.com/public_html;
index index.html;
server_name thuani.com www.thuani.com;
access_log /var/log/nginx/thuani.com.access.log;
error_log /var/log/nginx/thuani.com.error.log;
location / {
try_files $uri $uri/ =404;
}
}
############### end of copy/paste ##############
nano /etc/nginx/sites-available/cellardrop.com.au
#### Copy/paste the below in
server {
listen 80;
listen [::]:80;
root /var/www/cellardrop.com.au/public_html;
index index.html;
server_name cellardrop.com.au www.cellardrop.com.au;
access_log /var/log/nginx/cellardrop.com.au.access.log;
error_log /var/log/nginx/cellardrop.com.au.error.log;
location / {
try_files $uri $uri/ =404;
}
}
############### end of copy/paste ##############
sudo ln -s /etc/nginx/sites-available/thuani.com /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/cellardrop.com.au /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
## setup letsencrypt https://linuxize.com/post/secure-nginx-with-let-s-encrypt-on-ubuntu-18-04/
sudo apt update
sudo apt install certbot
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
mkdir -p /var/lib/letsencrypt/.well-known
chgrp www-data /var/lib/letsencrypt
chmod g+s /var/lib/letsencrypt
sudo nano /etc/nginx/snippets/letsencrypt.conf
#### Put below code into it copy/paste ####
location ^~ /.well-known/acme-challenge/ {
allow all;
root /var/lib/letsencrypt/;
default_type "text/plain";
try_files $uri =404;
}
############# end of copy/paste #############
sudo nano /etc/nginx/snippets/ssl.conf
### Copy/paste below code into it
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 30s;
add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload";
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
############# End of copy/paste #############
sudo nano /etc/nginx/sites-available/thuani.com
## add below line after server_name
include snippets/letsencrypt.conf;
sudo nano /etc/nginx/sites-available/cellardrop.com.au
## add below line after server_name
include snippets/letsencrypt.conf;
sudo systemctl reload nginx
sudo certbot certonly --agree-tos --email admin@zawro.com --webroot -w /var/lib/letsencrypt/ -d thuani.com -d www.thuani.com
sudo certbot certonly --agree-tos --email admin@zawro.com --webroot -w /var/lib/letsencrypt/ -d cellardrop.com.au -d www.cellardrop.com.au
sudo nano /etc/nginx/sites-available/thuani.com
### add this after include snippets/letsencrypt.conf;
return 301 https://$host$request_uri;
### Add following code at END of file
server {
listen 443 ssl http2;
server_name www.thuani.com;
ssl_certificate /etc/letsencrypt/live/thuani.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thuani.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/thuani.com/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
return 301 https://thuani.com$request_uri;
}
server {
listen 443 ssl http2;
server_name thuani.com;
ssl_certificate /etc/letsencrypt/live/thuani.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thuani.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/thuani.com/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
# . . . other code
}
############# end of copy/paste ##############
sudo nano /etc/nginx/sites-available/cellardrop.com.au
### add this after include snippets/letsencrypt.conf;
return 301 https://$host$request_uri;
### Add following code at END of file
server {
listen 443 ssl http2;
server_name www.cellardrop.com.au;
ssl_certificate /etc/letsencrypt/live/cellardrop.com.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cellardrop.com.au/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/cellardrop.com.au/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
return 301 https://cellardrop.com.au$request_uri;
}
server {
listen 443 ssl http2;
server_name cellardrop.com.au;
ssl_certificate /etc/letsencrypt/live/cellardrop.com.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cellardrop.com.au/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/cellardrop.com.au/chain.pem;
include snippets/ssl.conf;
include snippets/letsencrypt.conf;
# . . . other code
}
############# end of copy/paste ##############
sudo systemctl reload nginx
sudo nano /etc/cron.d/certbot
### Replace the certbot with the below line
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew --renew-hook "systemctl reload nginx"
#### end of line
sudo certbot renew --dry-run
### deploy odoo 12 https://linuxize.com/post/how-to-deploy-odoo-12-on-ubuntu-18-04/
sudo nano /etc/nginx/sites-enabled/thuani.com
###### Copy/paste following code into file ######
# Odoo servers
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
# HTTP -> HTTPS
server {
listen 80;
server_name www.thuani.com thuani.com;
include snippets/letsencrypt.conf;
return 301 https://thuani.com$request_uri;
}
# WWW -> NON WWW
server {
listen 443 ssl http2;
server_name www.thuani.com;
ssl_certificate /etc/letsencrypt/live/thuani.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thuani.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/thuani.com/chain.pem;
include snippets/ssl.conf;
return 301 https://thuani.com$request_uri;
}
server {
listen 443 ssl http2;
server_name thuani.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Proxy headers
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/thuani.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thuani.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/thuani.com/chain.pem;
include snippets/ssl.conf;
# log files
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# Handle longpoll requests
location /longpolling {
proxy_pass http://odoochat;
}
# Handle / requests
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
################## End of copy/paste
sudo nano /etc/nginx/sites-enabled/thuani.com
###### Copy/paste following code into file ######
# Odoo servers
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
# HTTP -> HTTPS
server {
listen 80;
server_name www.thuani.com thuani.com;
include snippets/letsencrypt.conf;
return 301 https://thuani.com$request_uri;
}
# WWW -> NON WWW
server {
listen 443 ssl http2;
server_name www.thuani.com;
ssl_certificate /etc/letsencrypt/live/thuani.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thuani.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/thuani.com/chain.pem;
include snippets/ssl.conf;
return 301 https://thuani.com$request_uri;
}
server {
listen 443 ssl http2;
server_name thuani.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Proxy headers
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/thuani.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thuani.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/thuani.com/chain.pem;
include snippets/ssl.conf;
# log files
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# Handle longpoll requests
location /longpolling {
proxy_pass http://odoochat;
}
# Handle / requests
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
################## End of copy/paste
sudo nano /etc/nginx/sites-enabled/cellardrop.com.au
###### Copy/paste following code into file ######
# Odoo servers
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
# HTTP -> HTTPS
server {
listen 80;
server_name www.cellardrop.com.au cellardrop.com.au;
include snippets/letsencrypt.conf;
return 301 https://cellardrop.com.au$request_uri;
}
# WWW -> NON WWW
server {
listen 443 ssl http2;
server_name www.cellardrop.com.au;
ssl_certificate /etc/letsencrypt/live/cellardrop.com.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cellardrop.com.au/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/cellardrop.com.au/chain.pem;
include snippets/ssl.conf;
return 301 https://cellardrop.com.au$request_uri;
}
server {
listen 443 ssl http2;
server_name cellardrop.com.au;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Proxy headers
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/cellardrop.com.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cellardrop.com.au/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/cellardrop.com.au/chain.pem;
include snippets/ssl.conf;
# log files
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# Handle longpoll requests
location /longpolling {
proxy_pass http://odoochat;
}
# Handle / requests
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
################## End of copy/paste
sudo systemctl restart nginx
### error, install gzip
sudo apt-get install zip -y
sudo apt-get install gzip
### I deleted the odoo servers in thuani.com nginx
nano /etc/odoo12.conf
### add this line at bottom
proxy_mode = True
#### end of add
sudo systemctl restart odoo12
nano /etc/odoo12.conf
#### add both these lines at bottom of file
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1
############ end of adding
sudo systemctl restart odoo12
****Errors not selecting database correctly on domain name
nano /etc/systemd/system/odoo12.service
ExecStart=/opt/odoo12/odoo-venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
nano /etc/systemd/system/odoo12.service
systemctl daemon-reload
service odoo12 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment