-
Notifications
You must be signed in to change notification settings - Fork 20
/
install
executable file
·105 lines (85 loc) · 5.09 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
################################################################################
# #
# Installation of Odootools - Tools to help manage an Odoo installation #
# #
# #
# #
################################################################################
echo "Performing basic prerequisite checks ..."
VERSION=16.0
#echo "Download common files..."
#wget -O- https://raw.githubusercontent.com/vertelab/odootools/common/install | bash > /tmp/tmpinstallcommon.sh
#bash /tmp/tmpinstallcommon.sh $VERSION
# User odoo shouldn't exist or should have been created by the Odoo installation
# procedures such as via the deb-package
grep --quiet -E '/home/odoo:' /etc/passwd # Indication odoo user have been
# created the wrong way.
if [ $? -eq 0 ]; then
echo "Warning! An odoo user seems to be present with the wrong home folder."
echo "This user might conflict with the Odoo 16 installation process."
echo "Exiting..."
exit 1
fi
# ---------------------------------------------------------------------------- #
# Odoo
echo "Installing Odoo"
if [ ! -d /etc/odoo ]; then # Install Odoo (only one time)
# this package is missing in 16.04
#wget https://launchpad.net/ubuntu/+archive/primary/+files/python-support_1.0.15_all.deb
#sudo dpkg -i python-support_1.0.15_all.deb
sudo add-apt-repository universe
sudo wget -O - https://nightly.odoo.com/odoo.key | sudo apt-key add -
echo "deb http://nightly.odoo.com/$VERSION/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list > /dev/null
# echo "deb http://nightly.odoo.com/master/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list > /dev/null # Change to $VERSION as soon its completed
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt -y install odoo
# Generate a good password
sudo sed -i "s|^.*admin_passwd = .*|admin_passwd = $(openssl rand -base64 32)|g" /etc/odoo/odoo.conf
sudo wget -O /etc/odoo/odoo.tools https://raw.githubusercontent.com/vertelab/odootools/common/odoo.tools
# Making odoo a more reqular user
# It can be useful when doing some operations.
echo "Enabling bash login for the odoo user..."
sudo sed -i 's|/var/lib/odoo:/usr/sbin/nologin|/var/lib/odoo:/bin/bash|g' /etc/passwd
if [ $? -eq 0 ]; then
echo "Bash login enabled for user 'odoo'"
else
echo "Failed to enable Bash login for user 'odoo'"
echo "Continuing installation." # Failure is not a dealbreaker for odootools
fi
# TODO: Add passwd or accept only sudo for switching user.
fi
if [ ! -d /usr/share/core-odoo ]; then
sudo ln -s /usr/lib/python3/dist-packages/odoo/ /usr/share/core-odoo
fi
# Additional packages
echo "Installing additional packages"
sudo DEBIAN_FRONTEND=noninteractive apt -y install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libjpeg-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libpq-dev
# Python with dependencies
echo "Installing Python modules"
sudo -H pip3 install wheel
wget -O /tmp/requirements.txt https://raw.githubusercontent.com/odoo/odoo/16.0/requirements.txt
sudo -H pip3 install -r /tmp/requirements.txt
# wkhtmltopdf
sudo -H pip3 install openpyxl
sudo DEBIAN_FRONTEND=noninteractive apt -y install xfonts-base xfonts-75dpi
wget -O /tmp/wkhtmltox_0.12.6.1-2.jammy_amd64.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo dpkg -i /tmp/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo rm -f /tmp/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
# sudo su postgres createuser odoo -s
# Odootools
sudo wget -O /etc/profile.d/odootools.sh https://raw.githubusercontent.com/vertelab/odootools/common/odootools.sh
sudo wget -O /etc/odoo/scaffold.tar.gz https://raw.githubusercontent.com/vertelab/odootools/common/scaffold.tar.gz
sudo wget -O /etc/bash_completion.d/odoo https://raw.githubusercontent.com/vertelab/odootools/common/bash_completion.odoo
sudo wget -O /usr/local/bin/odooextras.py https://raw.githubusercontent.com/vertelab/odootools/common/odooextras.py
# Extra tools
sudo wget -O /usr/local/bin/odoocheckdeps.py https://raw.githubusercontent.com/vertelab/odootools/common/scripts/odoocheckdeps.py
# 2023-10-11
# Error occurred: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
# https://www.odoo.com/forum/help-1/attributeerror-module-lib-has-no-attribute-x509-v-flag-cb-issuer-check-when-creating-new-staging-branch-202955
sudo pip uninstall -y pyopenssl && sudo pip install pyopenssl==22.0.0 && sudo pip uninstall -y cryptography && sudo pip install cryptography==37.0.0
# daily backup
sudo wget -O /etc/cron.daily/db_backup https://raw.githubusercontent.com/vertelab/odootools/common/db_backup
sudo chmod a+x /etc/cron.daily/db_backup
. /etc/profile.d/odootools.sh
. /etc/bash_completion