|
1 | 1 | #!/bin/bash
|
2 | 2 | ################################################################################
|
3 |
| -# Script for installing Odoo on Ubuntu 16.04, 18.04 and 20.04 (could be used for other version too) |
| 3 | +# Script for installing Odoo on Ubuntu 16.04, 18.04, 20.04 and 22.04 (could be used for other version too) |
4 | 4 | # Author: Yenthe Van Ginneken
|
5 | 5 | #-------------------------------------------------------------------------------
|
6 |
| -# This script will install Odoo on your Ubuntu 16.04 server. It can install multiple Odoo instances |
| 6 | +# This script will install Odoo on your Ubuntu server. It can install multiple Odoo instances |
7 | 7 | # in one Ubuntu because of the different xmlrpc_ports
|
8 | 8 | #-------------------------------------------------------------------------------
|
9 | 9 | # Make a new file:
|
@@ -51,15 +51,24 @@ ADMIN_EMAIL="odoo@example.com"
|
51 | 51 | ## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
|
52 | 52 | ## https://www.odoo.com/documentation/16.0/administration/install.html
|
53 | 53 |
|
54 |
| -WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" |
55 |
| -WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb" |
| 54 | +# Check if the operating system is Ubuntu 22.04 |
| 55 | +if [[ $(lsb_release -r -s) == "22.04" ]]; then |
| 56 | + WKHTMLTOX_X64="https://packages.ubuntu.com/jammy/wkhtmltopdf" |
| 57 | + WKHTMLTOX_X32="https://packages.ubuntu.com/jammy/wkhtmltopdf" |
| 58 | + #No Same link works for both 64 and 32-bit on Ubuntu 22.04 |
| 59 | +else |
| 60 | + # For older versions of Ubuntu |
| 61 | + WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" |
| 62 | + WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb" |
| 63 | +fi |
| 64 | + |
56 | 65 | #--------------------------------------------------
|
57 | 66 | # Update Server
|
58 | 67 | #--------------------------------------------------
|
59 | 68 | echo -e "\n---- Update Server ----"
|
60 | 69 | # universe package is for Ubuntu 18.x
|
61 | 70 | sudo add-apt-repository universe
|
62 |
| -# libpng12-0 dependency for wkhtmltopdf |
| 71 | +# libpng12-0 dependency for wkhtmltopdf for older Ubuntu versions |
63 | 72 | sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main"
|
64 | 73 | sudo apt-get update
|
65 | 74 | sudo apt-get upgrade -y
|
@@ -110,7 +119,16 @@ if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
|
110 | 119 | _url=$WKHTMLTOX_X32
|
111 | 120 | fi
|
112 | 121 | sudo wget $_url
|
113 |
| - sudo gdebi --n `basename $_url` |
| 122 | + |
| 123 | + |
| 124 | + if [[ $(lsb_release -r -s) == "22.04" ]]; then |
| 125 | + # Ubuntu 22.04 LTS |
| 126 | + sudo apt install wkhtmltopdf -y |
| 127 | + else |
| 128 | + # For older versions of Ubuntu |
| 129 | + sudo gdebi --n `basename $_url` |
| 130 | + fi |
| 131 | + |
114 | 132 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
|
115 | 133 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
|
116 | 134 | else
|
|
371 | 389 | #--------------------------------------------------
|
372 | 390 |
|
373 | 391 | if [ $INSTALL_NGINX = "True" ] && [ $ENABLE_SSL = "True" ] && [ $ADMIN_EMAIL != "odoo@example.com" ] && [ $WEBSITE_NAME != "_" ];then
|
374 |
| - sudo add-apt-repository ppa:certbot/certbot -y && sudo apt-get update -y |
| 392 | + sudo apt-get update -y |
| 393 | + sudo apt install snapd -y |
| 394 | + sudo snap install core; snap refresh core |
| 395 | + sudo snap install --classic certbot |
375 | 396 | sudo apt-get install python3-certbot-nginx -y
|
376 | 397 | sudo certbot --nginx -d $WEBSITE_NAME --noninteractive --agree-tos --email $ADMIN_EMAIL --redirect
|
377 | 398 | sudo service nginx reload
|
378 | 399 | echo "SSL/HTTPS is enabled!"
|
379 | 400 | else
|
380 | 401 | echo "SSL/HTTPS isn't enabled due to choice of the user or because of a misconfiguration!"
|
| 402 | + if $ADMIN_EMAIL = "odoo@example.com" then |
| 403 | + echo "Certbot does not support registering odoo@example.com. You should use real e-mail address." |
| 404 | + fi |
| 405 | + if $WEBSITE_NAME = "_" then |
| 406 | + echo "Website name is set as _. Cannot obtain SSL Certificate for _. You should use real website address." |
| 407 | + fi |
381 | 408 | fi
|
382 | 409 |
|
383 | 410 | echo -e "* Starting Odoo Service"
|
|
0 commit comments