├── README.md ├── nginx ├── odoo └── odoo-ssl ├── odoo_11_install.sh ├── odoo_12_install.sh ├── odoo_13_install.sh ├── odoo_14_install.sh ├── odoo_15_install.sh ├── odoo_16_and_17_install.sh ├── odoo_8_OR_10_install.sh ├── wkhtmltox-0.12.1_linux-trusty-amd64.deb ├── wkhtmltox_0.12.5-1.bionic_amd64.deb └── wkhtmltox_0.12.5-1.bionic_amd64.deb.1 /README.md: -------------------------------------------------------------------------------- 1 | # Odoo-install From version 8.0 to 17.0 2 | 3 | ## For Dockers : take a look at [Odoo dockers based on git repositories](https://github.com/elhamdaoui/odoo_docker/tree/arm64_v8) 4 | 5 | Bash script to install odoo 8.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 and 17.0 6 | 7 | - After executing this script, Try to use Terminal and: 8 | - sudo su - postgres -c "createuser -s odoo" 2> /dev/null || true 9 | 10 | - Connect to postgres user: $ sudo su postgres 11 | 12 | - Using psql: $ psql 13 | 14 | - Listing the psq roles: $ \du 15 | 16 | - Update Password for OE_USER (ex: "odoo13") role: $ alter role odoo13 with password 'odoo13' 17 | 18 | - exit postgres: $ \q 19 | - The new password must be copied on 'db_password=' in 'odooXX-server.conf' (XX in 8,10,11,12,13,14...) 20 | 21 | 22 | 23 | For Centos/Redhat, see the link below (odoo 13) 24 | https://www.tecmint.com/install-odoo-in-centos-8/ 25 | -------------------------------------------------------------------------------- /nginx/odoo: -------------------------------------------------------------------------------- 1 | #odoo server (require nginx > 1.19) 2 | upstream odoo { 3 | server 127.0.0.1:8017; 4 | } 5 | upstream odoochat { 6 | server 127.0.0.1:8072; 7 | } 8 | #---- ADD this block in nginx.conf 9 | map $http_upgrade $connection_upgrade { 10 | default upgrade; 11 | '' close; 12 | } 13 | #----- 14 | 15 | server { 16 | listen 80; 17 | server_name 192.168.40.8 erp.mjidsit.com; 18 | 19 | proxy_buffers 16 64k; 20 | proxy_buffer_size 128k; 21 | client_max_body_size 4000M; 22 | 23 | proxy_read_timeout 720s; 24 | proxy_connect_timeout 720s; 25 | proxy_send_timeout 720s; 26 | 27 | ## SSL parameters 28 | # ssl_certificate /etc/ssl/nginx/server.crt; 29 | # ssl_certificate_key /etc/ssl/nginx/server.key; 30 | # ssl_session_timeout 30m; 31 | # ssl_protocols TLSv1.2; 32 | # ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; 33 | # ssl_prefer_server_ciphers off; 34 | 35 | # log 36 | access_log /var/log/nginx/odoo.access.log; 37 | error_log /var/log/nginx/odoo.error.log; 38 | 39 | # Redirect websocket requests to odoo gevent port 40 | location /websocket { 41 | proxy_pass http://odoochat; 42 | proxy_set_header Upgrade $http_upgrade; 43 | proxy_set_header Connection $connection_upgrade; 44 | proxy_set_header X-Forwarded-Host $http_host; 45 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 46 | proxy_set_header X-Forwarded-Proto $scheme; 47 | proxy_set_header X-Real-IP $remote_addr; 48 | } 49 | 50 | # Redirect requests to odoo backend server 51 | location / { 52 | # Add Headers for odoo proxy mode 53 | proxy_set_header X-Forwarded-Host $http_host; 54 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 55 | proxy_set_header X-Forwarded-Proto $scheme; 56 | proxy_set_header X-Real-IP $remote_addr; 57 | proxy_redirect off; 58 | proxy_pass http://odoo; 59 | 60 | # Enable HSTS 61 | add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; 62 | # requires nginx 1.19.8 63 | # proxy_cookie_flags session_id samesite=lax secure; 64 | } 65 | 66 | # common gzip 67 | gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript; 68 | gzip on; 69 | } 70 | -------------------------------------------------------------------------------- /nginx/odoo-ssl: -------------------------------------------------------------------------------- 1 | upstream odoo { 2 | server 127.0.0.1:8017; 3 | } 4 | upstream odoochat { 5 | server 127.0.0.1:8072; 6 | } 7 | 8 | server { 9 | server_name morocco.africa.com; 10 | 11 | proxy_buffers 16 64k; 12 | proxy_buffer_size 128k; 13 | client_max_body_size 4000M; 14 | 15 | proxy_read_timeout 720s; 16 | proxy_connect_timeout 720s; 17 | proxy_send_timeout 720s; 18 | 19 | ## SSL parameters 20 | listen 443 ssl; # managed by Certbot 21 | ssl_certificate /etc/letsencrypt/live/morocco.africa.com/fullchain.pem; # managed by Certbot 22 | ssl_certificate_key /etc/letsencrypt/live/morocco.africa.com/privkey.pem; # managed by Certbot 23 | include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot 24 | ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot 25 | #ssl_certificate /etc/letsencrypt/live/morocco.africa.com/fullchain.pem; 26 | #ssl_certificate_key /etc/letsencrypt/live/morocco.africa.com/privkey.pem; 27 | #ssl_session_timeout 90m; 28 | #ssl_protocols TLSv1.2; 29 | #ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; 30 | #ssl_prefer_server_ciphers off; 31 | # log 32 | access_log /var/log/nginx/odoo.access.log; 33 | error_log /var/log/nginx/odoo.error.log; 34 | 35 | # Redirect websocket requests to odoo gevent port 36 | location /websocket { 37 | proxy_pass http://odoochat; 38 | proxy_set_header Upgrade $http_upgrade; 39 | proxy_set_header Connection $connection_upgrade; 40 | proxy_set_header X-Forwarded-Host $http_host; 41 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 42 | proxy_set_header X-Forwarded-Proto $scheme; 43 | proxy_set_header X-Real-IP $remote_addr; 44 | } 45 | 46 | # Redirect requests to odoo backend server 47 | location / { 48 | # Add Headers for odoo proxy mode 49 | proxy_set_header X-Forwarded-Host $http_host; 50 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 51 | proxy_set_header X-Forwarded-Proto $scheme; 52 | proxy_set_header X-Real-IP $remote_addr; 53 | proxy_redirect off; 54 | proxy_pass http://odoo; 55 | 56 | # Enable HSTS 57 | add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; 58 | # requires nginx 1.19.8 59 | # proxy_cookie_flags session_id samesite=lax secure; 60 | } 61 | 62 | # common gzip 63 | gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript; 64 | gzip on; 65 | 66 | #listen 443 ssl; # managed by Certbot 67 | #ssl_certificate /etc/letsencrypt/live/pos.itam-tech.com/fullchain.pem; # managed by Certbot 68 | #ssl_certificate_key /etc/letsencrypt/live/pos.itam-tech.com/privkey.pem; # managed by Certbot 69 | #include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot 70 | #ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot 71 | 72 | } 73 | 74 | 75 | server { 76 | if ($host = morocco.africa.com) { 77 | return 301 https://$host$request_uri; 78 | } # managed by Certbot 79 | 80 | 81 | listen 80; 82 | server_name morocco.africa.com; 83 | return 404; # managed by Certbot 84 | 85 | 86 | } -------------------------------------------------------------------------------- /odoo_11_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui. Refrence: Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | OE_USER="odoo11" 9 | OE_HOME="/opt/$OE_USER" 10 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 11 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 12 | #Set to true if you want to install it, false if you don't need it or have it already installed. 13 | INSTALL_WKHTMLTOPDF="True" 14 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 15 | INSTALL_POSTGRESQL="False" 16 | CREATE_USER_POSTGRESQL="True" 17 | 18 | OE_PORT="8011" 19 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 20 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 21 | OE_VERSION="11.0" 22 | # Set this to True if you want to install Odoo 10 Enterprise! 23 | IS_ENTERPRISE="True" 24 | #set the superadmin password 25 | OE_SUPERADMIN="superadminpass" 26 | OE_CONFIG="${OE_USER}-server" 27 | 28 | #Set the database config 29 | DB_HOST="127.0.0.1" 30 | DB_PORT="5432" 31 | DB_PASSWORD="odoo" 32 | 33 | # OCA Modules 34 | REP_OCA_WEB="https://github.com/OCA/web.git" 35 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 36 | REP_OCA_SERVER_UX="https://github.com/OCA/server-ux.git" 37 | 38 | CUSTOM_1="https://github.com/OCA/web.git" 39 | CUSTOM_1_name = "bigdata" 40 | ## 41 | ### WKHTMLTOPDF download links 42 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 43 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 44 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 45 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 46 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 47 | #-------------------------------------------------- 48 | # Update Server 49 | #-------------------------------------------------- 50 | echo -e "\n---- Update Server ----" 51 | sudo apt-get update 52 | sudo apt-get upgrade -y 53 | 54 | #-------------------------------------------------- 55 | # Install PostgreSQL Server 56 | #-------------------------------------------------- 57 | if [ $INSTALL_POSTGRESQL = "True" ]; then 58 | echo -e "\n---- Install PostgreSQL Server ----" 59 | sudo apt-get install postgresql -y 60 | 61 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 62 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 63 | else 64 | sudo apt install postgresql-client-common 65 | sudo apt-get install -y postgresql-client 66 | echo -e "\n POSTGRESQL isn't installed due to the choice of the user! and no postgresql user have been created" 67 | fi 68 | 69 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 70 | #-------------------------------------------------- 71 | # Install Dependencies 72 | #-------------------------------------------------- 73 | echo -e "\n---- Install/upgrade Python 3 Pip" 74 | sudo apt-get install python3-pip -y 75 | sudo pip3 install --upgrade pip 76 | echo -e "\n---- Pip current version ---" && pip3 --version 77 | 78 | echo -e "\n---- Install tool packages ----" 79 | sudo apt-get install wget git python3-pip gdebi-core -y 80 | 81 | echo -e "\n---- Install python packages/librairies ----" 82 | sudo pip3 install Babel decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject Werkzeug XlsxWriter xlwt xlrd gdata 83 | 84 | echo -e "\n--- Install other required packages" 85 | sudo apt-get install node-clean-css -y 86 | sudo apt-get install node-less -y 87 | sudo apt-get install python3-gevent -y 88 | sudo apt-get install python3-psycopg2 -y 89 | #-------------------------------------------------- 90 | # Install Wkhtmltopdf if needed 91 | #-------------------------------------------------- 92 | if [ $INSTALL_WKHTMLTOPDF = "True" ]; then 93 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 94 | #pick up correct one from x64 & x32 versions: 95 | if [ "`getconf LONG_BIT`" == "64" ];then 96 | _url=$WKHTMLTOX_X64 97 | else 98 | _url=$WKHTMLTOX_X32 99 | fi 100 | sudo wget $_url 101 | sudo gdebi --n `basename $_url` 102 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 103 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 104 | else 105 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 106 | fi 107 | 108 | echo -e "\n---- Create ODOO system user ----" 109 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 110 | #The user should also be added to the sudo'ers group. 111 | sudo adduser $OE_USER sudo 112 | 113 | echo -e "\n---- Create Log directory ----" 114 | sudo mkdir /var/log/$OE_USER 115 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 116 | 117 | #-------------------------------------------------- 118 | # Install ODOO 119 | #-------------------------------------------------- 120 | echo -e "\n==== Installing ODOO Server ====" 121 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 122 | 123 | if [ $IS_ENTERPRISE = "True" ]; then 124 | # Odoo Enterprise install! 125 | echo -e "\n--- Create symlink for node" 126 | sudo ln -s /usr/bin/nodejs /usr/bin/node 127 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 128 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 129 | 130 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 131 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 132 | echo "------------------------WARNING------------------------------" 133 | echo "Your authentication with Github has failed! Please try again." 134 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 135 | echo "TIP: Press ctrl+c to stop this script." 136 | echo "-------------------------------------------------------------" 137 | echo " " 138 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 139 | done 140 | 141 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 142 | echo -e "\n---- Installing Enterprise specific libraries ----" 143 | sudo apt-get install nodejs npm 144 | sudo npm install -g less 145 | sudo npm install -g less-plugin-clean-css 146 | fi 147 | 148 | echo -e "\n---------------------------OCA----------------------------" 149 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 150 | 151 | if [ $REP_OCA_WEB != "False" ]; then 152 | echo -e "\n==== Download OCA WEB ====" 153 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web/addons" 154 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web/addons 155 | fi 156 | 157 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 158 | echo -e "\n==== Download OCA Server-tools ====" 159 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 160 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools/addons" 161 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools/addons 162 | fi 163 | 164 | if [ $REP_OCA_SERVER_UX != "False" ]; then 165 | echo -e "\n==== Download OCA Server-ux ====" 166 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux" 167 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux/addons" 168 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_UX $OE_HOME/OCA/server-ux/addons 169 | fi 170 | 171 | 172 | 173 | 174 | echo -e "\n---- Create custom module directory ----" 175 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 176 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 177 | 178 | if [ $CUSTOM_1 != "False" ]; then 179 | echo -e "\n==== Download OCA CUSTOM_1_name ====" 180 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/$CUSTOM_1_name" 181 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/$CUSTOM_1_name" 182 | sudo git clone --depth 1 --branch $OE_VERSION $CUSTOM_1 $OE_HOME/custom/$CUSTOM_1_name 183 | fi 184 | 185 | 186 | echo -e "\n---- Setting permissions on home folder ----" 187 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 188 | 189 | 190 | echo -e "* Create server config file" 191 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 192 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 193 | sudo chmod 640 /etc/${OE_CONFIG}.conf 194 | 195 | echo -e "* Change server config file" 196 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 197 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 198 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 199 | sudo su root -c "echo 'db_user = $OE_USER' >> /etc/${OE_CONFIG}.conf" 200 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 201 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 202 | if [ $IS_ENTERPRISE = "True" ]; then 203 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 204 | else 205 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 206 | fi 207 | 208 | if [ $REP_OCA_WEB != "False" ]; then 209 | sudo su root -c "echo -n ',$OE_HOME/OCA/web/addons' >> /etc/${OE_CONFIG}.conf" 210 | fi 211 | 212 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 213 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools/addons' >> /etc/${OE_CONFIG}.conf" 214 | fi 215 | 216 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 217 | 218 | 219 | #logfile 220 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 221 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 222 | 223 | echo -e "* Change default xmlrpc port" 224 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 225 | 226 | echo -e "* Create startup file" 227 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 228 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 229 | sudo chmod 755 $OE_HOME_EXT/start.sh 230 | 231 | #-------------------------------------------------- 232 | # Adding ODOO as a deamon (initscript) 233 | #-------------------------------------------------- 234 | 235 | echo -e "* Create init file" 236 | cat < ~/$OE_CONFIG 237 | #!/bin/sh 238 | ### BEGIN INIT INFO 239 | # Provides: $OE_CONFIG 240 | # Required-Start: \$remote_fs \$syslog 241 | # Required-Stop: \$remote_fs \$syslog 242 | # Should-Start: \$network 243 | # Should-Stop: \$network 244 | # Default-Start: 2 3 4 5 245 | # Default-Stop: 0 1 6 246 | # Short-Description: Enterprise Business Applications 247 | # Description: ODOO Business Applications 248 | ### END INIT INFO 249 | PATH=/bin:/sbin:/usr/bin 250 | DAEMON=$OE_HOME_EXT/odoo-bin 251 | NAME=$OE_CONFIG 252 | DESC=$OE_CONFIG 253 | 254 | # Specify the user name (Default: odoo). 255 | USER=$OE_USER 256 | 257 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 258 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 259 | 260 | # pidfile 261 | PIDFILE=/var/run/\${NAME}.pid 262 | 263 | # Additional options that are passed to the Daemon. 264 | DAEMON_OPTS="-c \$CONFIGFILE" 265 | [ -x \$DAEMON ] || exit 0 266 | [ -f \$CONFIGFILE ] || exit 0 267 | checkpid() { 268 | [ -f \$PIDFILE ] || return 1 269 | pid=\`cat \$PIDFILE\` 270 | [ -d /proc/\$pid ] && return 0 271 | return 1 272 | } 273 | 274 | case "\${1}" in 275 | start) 276 | echo -n "Starting \${DESC}: " 277 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 278 | --chuid \$USER --background --make-pidfile \ 279 | --exec \$DAEMON -- \$DAEMON_OPTS 280 | echo "\${NAME}." 281 | ;; 282 | stop) 283 | echo -n "Stopping \${DESC}: " 284 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 285 | --oknodo 286 | echo "\${NAME}." 287 | ;; 288 | 289 | restart|force-reload) 290 | echo -n "Restarting \${DESC}: " 291 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 292 | --oknodo 293 | sleep 1 294 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 295 | --chuid \$USER --background --make-pidfile \ 296 | --exec \$DAEMON -- \$DAEMON_OPTS 297 | echo "\${NAME}." 298 | ;; 299 | *) 300 | N=/etc/init.d/\$NAME 301 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 302 | exit 1 303 | ;; 304 | 305 | esac 306 | exit 0 307 | EOF 308 | 309 | echo -e "* Security Init File" 310 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 311 | sudo chmod 755 /etc/init.d/$OE_CONFIG 312 | sudo chown root: /etc/init.d/$OE_CONFIG 313 | 314 | 315 | 316 | echo -e "* Start ODOO on Startup" 317 | sudo update-rc.d $OE_CONFIG defaults 318 | 319 | echo -e "* Starting Odoo Service" 320 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 321 | echo "-----------------------------------------------------------" 322 | echo "Done! The Odoo server is up and running. Specifications:" 323 | echo "Port: $OE_PORT" 324 | echo "User service: $OE_USER" 325 | echo "User PostgreSQL: $OE_USER" 326 | echo "Code location: $OE_USER" 327 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 328 | echo "Start Odoo service: sudo service $OE_CONFIG start" 329 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 330 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 331 | -------------------------------------------------------------------------------- /odoo_12_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui. Refrence: Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | OE_USER="odoo12" 9 | OE_HOME="/opt/$OE_USER" 10 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 11 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 12 | #Set to true if you want to install it, false if you don't need it or have it already installed. 13 | INSTALL_WKHTMLTOPDF="True" 14 | #Set to true if you want to install it, false if you don't need it or have it already installed. 15 | INSTALL_POSTGRESQL="True" 16 | CREATE_USER_POSTGRESQL="True" 17 | INSALL_NGINX = "False" 18 | ADD_SSL = "False" 19 | SSL_PEM_KEY = "False" 20 | SSL_PRV_KEY = "False" 21 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 22 | OE_PORT="8012" 23 | SERVER_NAME = "localhost" # rosa.karizma.com || 189.17.16.15 24 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 25 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 26 | OE_VERSION="12.0" 27 | # Set this to True if you want to install Odoo 10 Enterprise! 28 | IS_ENTERPRISE="True" 29 | #set the superadmin password 30 | OE_SUPERADMIN="MJID@ADMIN" 31 | OE_CONFIG="${OE_USER}-server" 32 | 33 | #Set the database config 34 | DB_HOST="127.0.0.1" 35 | DB_PORT="5432" 36 | DB_USER=$OE_USER 37 | DB_PASSWORD="odoo12" 38 | 39 | 40 | # OCA Modules 41 | REP_OCA_WEB="https://github.com/OCA/web.git" 42 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 43 | REP_OCA_SERVER_UX="https://github.com/OCA/server-ux.git" 44 | REP_OCA_REPORT_ENGINE="https://github.com/OCA/reporting-engine.git" 45 | REP_OCA_ACC_FIN_TOOLS="https://github.com/OCA/account-financial-tools.git" 46 | REP_QUEUE="https://github.com/OCA/queue.git" 47 | REP_CUSTOM_1="False" 48 | REP_CUSTOM_1_NAME="" 49 | REP_CUSTOM_1_BRANCH=$OE_VERSION 50 | 51 | ## 52 | ### WKHTMLTOPDF download links 53 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 54 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 55 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 56 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 57 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 58 | 59 | #-------------------------------------------------- 60 | # Update Server 61 | #-------------------------------------------------- 62 | echo -e "\n---- Update Server ----" 63 | sudo apt-get update 64 | sudo apt-get upgrade -y 65 | 66 | #-------------------------------------------------- 67 | # Install PostgreSQL Server 68 | #-------------------------------------------------- 69 | 70 | if [ $INSTALL_POSTGRESQL = "True" ]; then 71 | echo -e "\n---- Install PostgreSQL Server ----" 72 | sudo apt-get install postgresql -y 73 | 74 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 75 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 76 | else 77 | sudo apt install postgresql-client-common -y 78 | sudo apt-get install postgresql-client -y 79 | echo -e "\n POSTGRESQL isn't installed due to the choice of the user! and no postgresql user have been created" 80 | fi 81 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 82 | #-------------------------------------------------- 83 | # Install Dependencies 84 | #-------------------------------------------------- 85 | echo -e "\n---- Install/upgrade Python 3 Pip and other depends" 86 | 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 87 | sudo python3 -m pip install --upgrade pip 88 | echo -e "\n---- Pip current version ---" && pip3 --version 89 | 90 | echo -e "\n---- Install tool packages ----" 91 | sudo apt-get install wget git python3-pip gdebi-core -y 92 | 93 | echo -e "\n---- Install python packages/librairies ----" 94 | sudo python3 -m pip install Babel decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject Werkzeug XlsxWriter xlwt xlrd gdata 95 | sudo python3 -m pip install libsass==0.12.3 96 | echo -e "\n--- Install other required packages" 97 | sudo apt-get install node-clean-css -y 98 | sudo apt-get install node-less -y 99 | sudo apt-get install python3-gevent -y 100 | sudo apt-get install python3-psycopg2 -y 101 | 102 | 103 | 104 | # after last update in Ubuntu 18.04 LTS 105 | sudo python3 -m pip install babel PyPDF2 passlib werkzeug lxml decorator Pillow psutil html2text docutils suds-jurko -y 106 | sudo python3 -m pip install matplotlib -y 107 | sudo apt-get install python3-reportlab -y 108 | sudo apt-get install python3-dateutil python3-psycopg2 -y 109 | ##### 110 | 111 | 112 | 113 | #-------------------------------------------------- 114 | # Install Wkhtmltopdf if needed 115 | #-------------------------------------------------- 116 | if [ $INSTALL_WKHTMLTOPDF = "True" ]; then 117 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 118 | #pick up correct one from x64 & x32 versions: 119 | if [ "`getconf LONG_BIT`" == "64" ]; then 120 | _url=$WKHTMLTOX_X64 121 | else 122 | _url=$WKHTMLTOX_X32 123 | fi 124 | sudo wget $_url 125 | sudo dpkg -i `basename $_url` 126 | sudo apt install -f 127 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 128 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 129 | else 130 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 131 | fi 132 | 133 | echo -e "\n---- Create ODOO system user ----" 134 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 135 | #The user should also be added to the sudo'ers group. 136 | sudo adduser $OE_USER sudo 137 | 138 | echo -e "\n---- Create Log directory ----" 139 | sudo mkdir /var/log/$OE_USER 140 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 141 | 142 | #-------------------------------------------------- 143 | # Install ODOO 144 | #-------------------------------------------------- 145 | echo -e "\n==== Installing ODOO Server ====" 146 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 147 | 148 | # --- install requirements odoo 12 149 | 150 | sudo pip3 install wheel 151 | sudo pip3 install -r $OE_HOME_EXT/requirements.txt 152 | 153 | if [ $IS_ENTERPRISE = "True" ]; then 154 | # Odoo Enterprise install! 155 | echo -e "\n--- Create symlink for node" 156 | sudo ln -s /usr/bin/nodejs /usr/bin/node 157 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 158 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 159 | 160 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 161 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 162 | echo "------------------------WARNING------------------------------" 163 | echo "Your authentication with Github has failed! Please try again." 164 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 165 | echo "TIP: Press ctrl+c to stop this script." 166 | echo "-------------------------------------------------------------" 167 | echo " " 168 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 169 | done 170 | 171 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 172 | echo -e "\n---- Installing Enterprise specific libraries ----" 173 | sudo apt-get install nodejs npm -y 174 | sudo npm install -g less 175 | sudo npm install -g less-plugin-clean-css 176 | fi 177 | 178 | echo -e "\n---------------------------OCA----------------------------" 179 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 180 | 181 | if [ $REP_OCA_WEB != "False" ]; then 182 | echo -e "\n==== Download OCA WEB ====" 183 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web" 184 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web 185 | fi 186 | 187 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 188 | echo -e "\n==== Download OCA Server-tools ====" 189 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 190 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools 191 | fi 192 | 193 | if [ $REP_OCA_SERVER_UX != "False" ]; then 194 | echo -e "\n==== Download OCA SERVER-UX ====" 195 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux" 196 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_UX $OE_HOME/OCA/server-ux 197 | fi 198 | 199 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 200 | echo -e "\n==== Download OCA Report-engine ====" 201 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/report-engine" 202 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_REPORT_ENGINE $OE_HOME/OCA/report-engine 203 | echo -e "\n==== Download OCA QUEUE ====" 204 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/queue" 205 | sudo git clone --depth 1 --branch $OE_VERSION $REP_QUEUE $OE_HOME/OCA/queue 206 | fi 207 | 208 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 209 | echo -e "\n==== Download OCA Report-engine ====" 210 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/account-financial-tools" 211 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_ACC_FIN_TOOLS $OE_HOME/OCA/account-financial-tools 212 | fi 213 | 214 | echo -e "\n---- Create custom module directory ----" 215 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 216 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 217 | 218 | if [ $REP_CUSTOM_1 != "False" ]; then 219 | echo -e "\n==== Download REP_CUSTOM_1 custom ====" 220 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/$REP_CUSTOM_1_NAME" 221 | sudo git clone --depth 1 --branch $REP_CUSTOM_1_BRANCH $REP_CUSTOM_1 $OE_HOME/custom/$REP_CUSTOM_1_NAME 222 | fi 223 | 224 | echo -e "\n---- Setting permissions on home folder ----" 225 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 226 | 227 | 228 | echo -e "* Create server config file" 229 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 230 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 231 | sudo chmod 640 /etc/${OE_CONFIG}.conf 232 | 233 | echo -e "* Change server config file" 234 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 235 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 236 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 237 | sudo su root -c "echo 'db_user = $DB_USER' >> /etc/${OE_CONFIG}.conf" 238 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 239 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 240 | if [ $IS_ENTERPRISE = "True" ]; then 241 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 242 | else 243 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 244 | fi 245 | 246 | if [ $REP_OCA_WEB != "False" ]; then 247 | sudo su root -c "echo -n ',$OE_HOME/OCA/web' >> /etc/${OE_CONFIG}.conf" 248 | fi 249 | 250 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 251 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools' >> /etc/${OE_CONFIG}.conf" 252 | fi 253 | 254 | if [ $REP_OCA_SERVER_UX != "False" ]; then 255 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-ux' >> /etc/${OE_CONFIG}.conf" 256 | fi 257 | 258 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 259 | sudo su root -c "echo -n ',$OE_HOME/OCA/report-engine' >> /etc/${OE_CONFIG}.conf" 260 | sudo su root -c "echo -n ',$OE_HOME/OCA/queue' >> /etc/${OE_CONFIG}.conf" 261 | fi 262 | 263 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 264 | sudo su root -c "echo -n ',$OE_HOME/OCA/account-financial-tools' >> /etc/${OE_CONFIG}.conf" 265 | fi 266 | 267 | 268 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 269 | 270 | 271 | #logfile 272 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 273 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 274 | 275 | echo -e "* Change default xmlrpc port" 276 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 277 | 278 | echo -e "* Create startup file" 279 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 280 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 281 | sudo chmod 755 $OE_HOME_EXT/start.sh 282 | 283 | #-------------------------------------------------- 284 | # Adding ODOO as a deamon (initscript) 285 | #-------------------------------------------------- 286 | 287 | echo -e "* Create init file" 288 | cat < ~/$OE_CONFIG 289 | #!/bin/sh 290 | ### BEGIN INIT INFO 291 | # Provides: $OE_CONFIG 292 | # Required-Start: \$remote_fs \$syslog 293 | # Required-Stop: \$remote_fs \$syslog 294 | # Should-Start: \$network 295 | # Should-Stop: \$network 296 | # Default-Start: 2 3 4 5 297 | # Default-Stop: 0 1 6 298 | # Short-Description: Enterprise Business Applications 299 | # Description: ODOO Business Applications 300 | ### END INIT INFO 301 | PATH=/bin:/sbin:/usr/bin 302 | DAEMON=$OE_HOME_EXT/odoo-bin 303 | NAME=$OE_CONFIG 304 | DESC=$OE_CONFIG 305 | 306 | # Specify the user name (Default: odoo). 307 | USER=$OE_USER 308 | 309 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 310 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 311 | 312 | # pidfile 313 | PIDFILE=/var/run/\${NAME}.pid 314 | 315 | # Additional options that are passed to the Daemon. 316 | DAEMON_OPTS="-c \$CONFIGFILE" 317 | [ -x \$DAEMON ] || exit 0 318 | [ -f \$CONFIGFILE ] || exit 0 319 | checkpid() { 320 | [ -f \$PIDFILE ] || return 1 321 | pid=\`cat \$PIDFILE\` 322 | [ -d /proc/\$pid ] && return 0 323 | return 1 324 | } 325 | 326 | case "\${1}" in 327 | start) 328 | echo -n "Starting \${DESC}: " 329 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 330 | --chuid \$USER --background --make-pidfile \ 331 | --exec \$DAEMON -- \$DAEMON_OPTS 332 | echo "\${NAME}." 333 | ;; 334 | stop) 335 | echo -n "Stopping \${DESC}: " 336 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 337 | --oknodo 338 | echo "\${NAME}." 339 | ;; 340 | 341 | restart|force-reload) 342 | echo -n "Restarting \${DESC}: " 343 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 344 | --oknodo 345 | sleep 1 346 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 347 | --chuid \$USER --background --make-pidfile \ 348 | --exec \$DAEMON -- \$DAEMON_OPTS 349 | echo "\${NAME}." 350 | ;; 351 | *) 352 | N=/etc/init.d/\$NAME 353 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 354 | exit 1 355 | ;; 356 | 357 | esac 358 | exit 0 359 | EOF 360 | 361 | echo -e "* Security Init File" 362 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 363 | sudo chmod 755 /etc/init.d/$OE_CONFIG 364 | sudo chown root: /etc/init.d/$OE_CONFIG 365 | CONTENT_NGINX = "upstream rosa {\n 366 | server 127.0.0.1:8090;\n 367 | }\n 368 | 369 | server {\n 370 | listen 80;\n 371 | server_name $SERVER_NAME;\n 372 | ssl on; 373 | ssl_certificate /etc/nginx/ssl/certificate.admin-serv.net.crt; 374 | ssl_certificate_key /etc/nginx/ssl/admin-serv.net.deprotected.key; 375 | 376 | access_log /var/log/nginx/rosa.access.log;\n 377 | error_log /var/log/nginx/rosa.error.log;\n 378 | 379 | proxy_buffers 16 64k;\n 380 | proxy_buffer_size 128k;\n 381 | 382 | location / {\n 383 | proxy_pass http://localhost:$OE_PORT;\n 384 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;\n 385 | proxy_redirect off;\n 386 | 387 | proxy_set_header Host $host;\n 388 | proxy_set_header X-Real-IP $remote_addr;\n 389 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n 390 | proxy_set_header X-Forwarded-Proto https;\n 391 | }\n 392 | 393 | location ~* /web/static/ {\n 394 | proxy_cache_valid 200 60m;\n 395 | proxy_buffering on;\n 396 | expires 864000;\n 397 | proxy_pass http://localhost:$OE_PORT;\n 398 | }\n 399 | 400 | location /longpolling {\n 401 | proxy_pass http://127.0.0.1:8072;\n 402 | }\n 403 | }\n 404 | " 405 | if [ $INSTALL_NGINX = "True" ]; then 406 | echo -e "* Install, config Nginx and SSL" 407 | sudo apt install nginx 408 | 409 | if [ $ADD_SSL = "True" ] && [ $SSL_PEM_KEY != "False" ] && [ $SSL_PRV_KEY != "False" ]; then 410 | sudo su root -c "echo '$CONTENT_NGINX' > /etc/nginx/sites-available/$OE_USER" 411 | sudo ln -s /etc/nginx/sites-available/$OE_USER /etc/nginx/sites-enabled/$OE_USER 412 | sudo chown root:root /etc/nginx/sites-available/$OE_USER 413 | sudo chmod 775 /etc/nginx/sites-available/$OE_USER 414 | 415 | sudo chown root:root /etc/nginx/sites-enabled/$OE_USER 416 | sudo chmod 775 /etc/nginx/sites-enabled/$OE_USER 417 | fi 418 | 419 | fi 420 | 421 | echo -e "* Start ODOO on Startup" 422 | sudo update-rc.d $OE_CONFIG defaults 423 | 424 | echo -e "* Starting Odoo Service" 425 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 426 | echo "-----------------------------------------------------------" 427 | echo "Done! The Odoo server is up and running. Specifications:" 428 | echo "Port: $OE_PORT" 429 | echo "User service: $OE_USER" 430 | echo "User PostgreSQL: $OE_USER" 431 | echo "Code location: $OE_USER" 432 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 433 | echo "Start Odoo service: sudo service $OE_CONFIG start" 434 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 435 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 436 | -------------------------------------------------------------------------------- /odoo_13_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui. Refrence: Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | OE_USER="odoo13" 9 | OE_HOME="/opt/$OE_USER" 10 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 11 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 12 | #Set to true if you want to install it, false if you don't need it or have it already installed. 13 | INSTALL_WKHTMLTOPDF="True" 14 | #Set to true if you want to install it, false if you don't need it or have it already installed. 15 | INSTALL_POSTGRESQL="False" 16 | CREATE_USER_POSTGRESQL="True" 17 | INSALL_NGINX = "False" 18 | ADD_SSL = "False" 19 | SSL_PEM_KEY = "False" 20 | SSL_PRV_KEY = "False" 21 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 22 | OE_PORT="8013" 23 | SERVER_NAME = "localhost" # rosa.karizma.com || 189.17.16.15 24 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 25 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 26 | OE_VERSION="13.0" 27 | # Set this to True if you want to install Odoo 10 Enterprise! 28 | IS_ENTERPRISE="True" 29 | #set the superadmin password 30 | OE_SUPERADMIN="ODOO@ADMIN" 31 | OE_CONFIG="${OE_USER}-server" 32 | 33 | #Set the database config 34 | DB_HOST="127.0.0.1" 35 | DB_PORT="5432" 36 | DB_USER=$OE_USER 37 | DB_PASSWORD="LEGEND" 38 | 39 | 40 | # OCA Modules 41 | REP_OCA_WEB="https://github.com/OCA/web.git" 42 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 43 | REP_OCA_SERVER_UX="https://github.com/OCA/server-ux.git" 44 | REP_OCA_REPORT_ENGINE="https://github.com/OCA/reporting-engine.git" 45 | REP_OCA_ACC_FIN_TOOLS="https://github.com/OCA/account-financial-tools.git" 46 | REP_QUEUE="https://github.com/OCA/queue.git" 47 | REP_CUSTOM_1="False" 48 | REP_CUSTOM_1_NAME="" 49 | REP_CUSTOM_1_BRANCH=$OE_VERSION 50 | 51 | ## 52 | ### WKHTMLTOPDF download links 53 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 54 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 55 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 56 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 57 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 58 | 59 | #-------------------------------------------------- 60 | # Update Server 61 | #-------------------------------------------------- 62 | echo -e "\n---- Update Server ----" 63 | sudo apt-get update 64 | sudo apt-get upgrade -y 65 | 66 | #-------------------------------------------------- 67 | # Install PostgreSQL Server 68 | #-------------------------------------------------- 69 | 70 | if [ $INSTALL_POSTGRESQL = "True" ]; then 71 | echo -e "\n---- Install PostgreSQL Server ----" 72 | sudo apt-get install postgresql -y 73 | 74 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 75 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 76 | else 77 | sudo apt install postgresql-client-common 78 | sudo apt-get install -y postgresql-client 79 | echo -e "\n POSTGRESQL isn't installed due to the choice of the user! and no postgresql user have been created" 80 | fi 81 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 82 | #-------------------------------------------------- 83 | # Install Dependencies 84 | #-------------------------------------------------- 85 | echo -e "\n---- Install/upgrade Python 3 Pip and other depends" 86 | 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 87 | sudo pip3 install --upgrade pip 88 | echo -e "\n---- Pip current version ---" && pip3 --version 89 | 90 | echo -e "\n---- Install tool packages ----" 91 | sudo apt-get install wget git python3-pip gdebi-core -y 92 | 93 | echo -e "\n---- Install python packages/librairies ----" 94 | sudo pip3 install Babel decorator docutils ebaysdk feedparser gevent greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject XlsxWriter xlwt xlrd gdata 95 | sudo pip3 install libsass==0.12.3 96 | sudo pip3 install Werkzeug==0.14.1 97 | sudo pip3 install polib 98 | echo -e "\n--- Install other required packages" 99 | sudo apt-get install node-clean-css -y 100 | sudo apt-get install node-less -y 101 | sudo apt-get install python3-gevent -y 102 | sudo apt-get install python3-psycopg2 -y 103 | 104 | 105 | 106 | # after last update in Ubuntu 18.04 LTS 107 | sudo pip3 install babel PyPDF2 passlib werkzeug lxml decorator Pillow psutil html2text docutils suds-jurko 108 | sudo pip3 install matplotlib 109 | sudo apt-get install python3-reportlab 110 | sudo apt-get install python3-dateutil python3-psycopg2 111 | ##### 112 | 113 | 114 | 115 | #-------------------------------------------------- 116 | # Install Wkhtmltopdf if needed 117 | #-------------------------------------------------- 118 | if [ $INSTALL_WKHTMLTOPDF = "True" ]; then 119 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 120 | #pick up correct one from x64 & x32 versions: 121 | if [ "`getconf LONG_BIT`" == "64" ]; then 122 | _url=$WKHTMLTOX_X64 123 | else 124 | _url=$WKHTMLTOX_X32 125 | fi 126 | sudo wget $_url 127 | sudo dpkg -i `basename $_url` 128 | sudo apt install -f 129 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 130 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 131 | else 132 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 133 | fi 134 | 135 | echo -e "\n---- Create ODOO system user ----" 136 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 137 | #The user should also be added to the sudo'ers group. 138 | sudo adduser $OE_USER sudo 139 | 140 | echo -e "\n---- Create Log directory ----" 141 | sudo mkdir /var/log/$OE_USER 142 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 143 | 144 | #-------------------------------------------------- 145 | # Install ODOO 146 | #-------------------------------------------------- 147 | echo -e "\n==== Installing ODOO Server ====" 148 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 149 | 150 | # --- install requirements odoo 12 151 | sudo pip3 install wheel 152 | sudo pip3 install -r $OE_HOME_EXT/requirements.txt 153 | 154 | if [ $IS_ENTERPRISE = "True" ]; then 155 | # Odoo Enterprise install! 156 | echo -e "\n--- Create symlink for node" 157 | sudo ln -s /usr/bin/nodejs /usr/bin/node 158 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 159 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 160 | 161 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 162 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 163 | echo "------------------------WARNING------------------------------" 164 | echo "Your authentication with Github has failed! Please try again." 165 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 166 | echo "TIP: Press ctrl+c to stop this script." 167 | echo "-------------------------------------------------------------" 168 | echo " " 169 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 170 | done 171 | 172 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 173 | echo -e "\n---- Installing Enterprise specific libraries ----" 174 | sudo apt-get install nodejs npm 175 | sudo npm install -g less 176 | sudo npm install -g less-plugin-clean-css 177 | fi 178 | 179 | echo -e "\n---------------------------OCA----------------------------" 180 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 181 | 182 | if [ $REP_OCA_WEB != "False" ]; then 183 | echo -e "\n==== Download OCA WEB ====" 184 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web" 185 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web 186 | fi 187 | 188 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 189 | echo -e "\n==== Download OCA Server-tools ====" 190 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 191 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools 192 | fi 193 | 194 | if [ $REP_OCA_SERVER_UX != "False" ]; then 195 | echo -e "\n==== Download OCA SERVER-UX ====" 196 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux" 197 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_UX $OE_HOME/OCA/server-ux 198 | fi 199 | 200 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 201 | echo -e "\n==== Download OCA Report-engine ====" 202 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/report-engine" 203 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_REPORT_ENGINE $OE_HOME/OCA/report-engine 204 | echo -e "\n==== Download OCA QUEUE ====" 205 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/queue" 206 | sudo git clone --depth 1 --branch $OE_VERSION $REP_QUEUE $OE_HOME/OCA/queue 207 | fi 208 | 209 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 210 | echo -e "\n==== Download OCA Report-engine ====" 211 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/account-financial-tools" 212 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_ACC_FIN_TOOLS $OE_HOME/OCA/account-financial-tools 213 | fi 214 | 215 | echo -e "\n---- Create custom module directory ----" 216 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 217 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 218 | 219 | if [ $REP_CUSTOM_1 != "False" ]; then 220 | echo -e "\n==== Download REP_CUSTOM_1 custom ====" 221 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/$REP_CUSTOM_1_NAME" 222 | sudo git clone --depth 1 --branch $REP_CUSTOM_1_BRANCH $REP_CUSTOM_1 $OE_HOME/custom/$REP_CUSTOM_1_NAME 223 | fi 224 | 225 | echo -e "\n---- Setting permissions on home folder ----" 226 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 227 | 228 | 229 | echo -e "* Create server config file" 230 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 231 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 232 | sudo chmod 640 /etc/${OE_CONFIG}.conf 233 | 234 | echo -e "* Change server config file" 235 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 236 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 237 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 238 | sudo su root -c "echo 'db_user = $DB_USER' >> /etc/${OE_CONFIG}.conf" 239 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 240 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 241 | if [ $IS_ENTERPRISE = "True" ]; then 242 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 243 | else 244 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 245 | fi 246 | 247 | if [ $REP_OCA_WEB != "False" ]; then 248 | sudo su root -c "echo -n ',$OE_HOME/OCA/web' >> /etc/${OE_CONFIG}.conf" 249 | fi 250 | 251 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 252 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools' >> /etc/${OE_CONFIG}.conf" 253 | fi 254 | 255 | if [ $REP_OCA_SERVER_UX != "False" ]; then 256 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-ux' >> /etc/${OE_CONFIG}.conf" 257 | fi 258 | 259 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 260 | sudo su root -c "echo -n ',$OE_HOME/OCA/report-engine' >> /etc/${OE_CONFIG}.conf" 261 | sudo su root -c "echo -n ',$OE_HOME/OCA/queue' >> /etc/${OE_CONFIG}.conf" 262 | fi 263 | 264 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 265 | sudo su root -c "echo -n ',$OE_HOME/OCA/account-financial-tools' >> /etc/${OE_CONFIG}.conf" 266 | fi 267 | 268 | 269 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 270 | 271 | 272 | #logfile 273 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 274 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 275 | 276 | echo -e "* Change default xmlrpc port" 277 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 278 | 279 | echo -e "* Create startup file" 280 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 281 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 282 | sudo chmod 755 $OE_HOME_EXT/start.sh 283 | 284 | #-------------------------------------------------- 285 | # Adding ODOO as a deamon (initscript) 286 | #-------------------------------------------------- 287 | 288 | echo -e "* Create init file" 289 | cat < ~/$OE_CONFIG 290 | #!/bin/sh 291 | ### BEGIN INIT INFO 292 | # Provides: $OE_CONFIG 293 | # Required-Start: \$remote_fs \$syslog 294 | # Required-Stop: \$remote_fs \$syslog 295 | # Should-Start: \$network 296 | # Should-Stop: \$network 297 | # Default-Start: 2 3 4 5 298 | # Default-Stop: 0 1 6 299 | # Short-Description: Enterprise Business Applications 300 | # Description: ODOO Business Applications 301 | ### END INIT INFO 302 | PATH=/bin:/sbin:/usr/bin 303 | DAEMON=$OE_HOME_EXT/odoo-bin 304 | NAME=$OE_CONFIG 305 | DESC=$OE_CONFIG 306 | # Specify the user name (Default: odoo). 307 | USER=$OE_USER 308 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 309 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 310 | # pidfile 311 | PIDFILE=/var/run/\${NAME}.pid 312 | # Additional options that are passed to the Daemon. 313 | DAEMON_OPTS="-c \$CONFIGFILE" 314 | [ -x \$DAEMON ] || exit 0 315 | [ -f \$CONFIGFILE ] || exit 0 316 | checkpid() { 317 | [ -f \$PIDFILE ] || return 1 318 | pid=\`cat \$PIDFILE\` 319 | [ -d /proc/\$pid ] && return 0 320 | return 1 321 | } 322 | case "\${1}" in 323 | start) 324 | echo -n "Starting \${DESC}: " 325 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 326 | --chuid \$USER --background --make-pidfile \ 327 | --exec \$DAEMON -- \$DAEMON_OPTS 328 | echo "\${NAME}." 329 | ;; 330 | stop) 331 | echo -n "Stopping \${DESC}: " 332 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 333 | --oknodo 334 | echo "\${NAME}." 335 | ;; 336 | restart|force-reload) 337 | echo -n "Restarting \${DESC}: " 338 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 339 | --oknodo 340 | sleep 1 341 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 342 | --chuid \$USER --background --make-pidfile \ 343 | --exec \$DAEMON -- \$DAEMON_OPTS 344 | echo "\${NAME}." 345 | ;; 346 | *) 347 | N=/etc/init.d/\$NAME 348 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 349 | exit 1 350 | ;; 351 | esac 352 | exit 0 353 | EOF 354 | 355 | echo -e "* Security Init File" 356 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 357 | sudo chmod 755 /etc/init.d/$OE_CONFIG 358 | sudo chown root: /etc/init.d/$OE_CONFIG 359 | CONTENT_NGINX = "upstream rosa {\n 360 | server 127.0.0.1:8090;\n 361 | }\n 362 | server {\n 363 | listen 80;\n 364 | server_name $SERVER_NAME;\n 365 | ssl on; 366 | ssl_certificate /etc/nginx/ssl/certificate.admin-serv.net.crt; 367 | ssl_certificate_key /etc/nginx/ssl/admin-serv.net.deprotected.key; 368 | access_log /var/log/nginx/rosa.access.log;\n 369 | error_log /var/log/nginx/rosa.error.log;\n 370 | proxy_buffers 16 64k;\n 371 | proxy_buffer_size 128k;\n 372 | location / {\n 373 | proxy_pass http://localhost:$OE_PORT;\n 374 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;\n 375 | proxy_redirect off;\n 376 | proxy_set_header Host $host;\n 377 | proxy_set_header X-Real-IP $remote_addr;\n 378 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n 379 | proxy_set_header X-Forwarded-Proto https;\n 380 | }\n 381 | location ~* /web/static/ {\n 382 | proxy_cache_valid 200 60m;\n 383 | proxy_buffering on;\n 384 | expires 864000;\n 385 | proxy_pass http://localhost:$OE_PORT;\n 386 | }\n 387 | location /longpolling {\n 388 | proxy_pass http://127.0.0.1:8072;\n 389 | }\n 390 | }\n 391 | " 392 | if [ $INSTALL_NGINX = "True" ]; then 393 | echo -e "* Install, config Nginx and SSL" 394 | sudo apt install nginx 395 | 396 | if [ $ADD_SSL = "True" ] && [ $SSL_PEM_KEY != "False" ] && [ $SSL_PRV_KEY != "False" ]; then 397 | sudo su root -c "echo '$CONTENT_NGINX' > /etc/nginx/sites-available/$OE_USER" 398 | sudo ln -s /etc/nginx/sites-available/$OE_USER /etc/nginx/sites-enabled/$OE_USER 399 | sudo chown root:root /etc/nginx/sites-available/$OE_USER 400 | sudo chmod 775 /etc/nginx/sites-available/$OE_USER 401 | 402 | sudo chown root:root /etc/nginx/sites-enabled/$OE_USER 403 | sudo chmod 775 /etc/nginx/sites-enabled/$OE_USER 404 | fi 405 | 406 | fi 407 | 408 | echo -e "* Start ODOO on Startup" 409 | sudo update-rc.d $OE_CONFIG defaults 410 | 411 | echo -e "* Starting Odoo Service" 412 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 413 | echo "-----------------------------------------------------------" 414 | echo "Done! The Odoo server is up and running. Specifications:" 415 | echo "Port: $OE_PORT" 416 | echo "User service: $OE_USER" 417 | echo "User PostgreSQL: $OE_USER" 418 | echo "Code location: $OE_USER" 419 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 420 | echo "Start Odoo service: sudo service $OE_CONFIG start" 421 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 422 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 423 | -------------------------------------------------------------------------------- /odoo_14_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui. Refrence: Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | PY_VERSION="3.10" 9 | OE_USER="odoo14" 10 | OE_HOME="/opt/$OE_USER" 11 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 12 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 13 | #Set to true if you want to install it, false if you don't need it or have it already installed. 14 | INSTALL_WKHTMLTOPDF="True" 15 | #Set to true if you want to install it, false if you don't need it or have it already installed. 16 | INSTALL_POSTGRESQL="False" 17 | CREATE_USER_POSTGRESQL="True" 18 | INSTALL_NGINX="False" 19 | ADD_SSL="False" 20 | SSL_PEM_KEY="False" 21 | SSL_PRV_KEY="False" 22 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 23 | OE_PORT="8014" 24 | SERVER_NAME = "localhost" # test.odoo.com || 50.17.16.15 25 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 26 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 27 | OE_VERSION="14.0" 28 | # Set this to True if you want to install Odoo 10 Enterprise! 29 | IS_ENTERPRISE="True" 30 | #set the superadmin password 31 | OE_SUPERADMIN="ODOO@ADMIN" 32 | OE_CONFIG="${OE_USER}-server" 33 | 34 | #Set the database config 35 | DB_HOST="127.0.0.1" 36 | DB_PORT="5432" 37 | DB_USER=$OE_USER 38 | DB_PASSWORD="LEGEND" 39 | 40 | 41 | # OCA Modules 42 | REP_OCA_WEB="https://github.com/OCA/web.git" 43 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 44 | REP_OCA_SERVER_UX="https://github.com/OCA/server-ux.git" 45 | REP_OCA_REPORT_ENGINE="https://github.com/OCA/reporting-engine.git" 46 | REP_OCA_ACC_FIN_TOOLS="https://github.com/OCA/account-financial-tools.git" 47 | REP_QUEUE="https://github.com/OCA/queue.git" 48 | REP_CUSTOM_1="False" 49 | REP_CUSTOM_1_NAME="" 50 | REP_CUSTOM_1_BRANCH=$OE_VERSION 51 | 52 | ## 53 | ### WKHTMLTOPDF download links 54 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 55 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 56 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 57 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 58 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 59 | 60 | #-------------------------------------------------- 61 | # Update Server 62 | #-------------------------------------------------- 63 | echo -e "\n---- Update Server ----" 64 | sudo apt-get update 65 | sudo apt-get upgrade -y 66 | sudo apt-get install python3-pip libpq-dev libldap2-dev libsasl2-dev libssl-dev libffi-dev build-essential 67 | sudo apt-get install python3.10-dev 68 | #sudo apt-get install python-dev # if version is less than 10 69 | 70 | #-------------------------------------------------- 71 | # Install PostgreSQL Server 72 | #-------------------------------------------------- 73 | 74 | if [ $INSTALL_POSTGRESQL = "True" ]; then 75 | echo -e "\n---- Install PostgreSQL Server ----" 76 | sudo apt-get install postgresql -y 77 | 78 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 79 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 80 | else 81 | sudo apt install postgresql-client-common 82 | sudo apt-get install -y postgresql-client 83 | echo -e "\n POSTGRESQL isn't installed due to the choice of the user! and no postgresql user have been created" 84 | fi 85 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 86 | #-------------------------------------------------- 87 | # Install Dependencies 88 | #-------------------------------------------------- 89 | echo -e "\n---- Install/upgrade Python 3 Pip and other depends" 90 | 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 91 | sudo pip3 install --upgrade pip 92 | sudo pip3 install Werkzeug==0.11.15 93 | echo -e "\n---- Pip current version ---" && pip3 --version 94 | 95 | echo -e "\n---- Install tool packages ----" 96 | sudo apt-get install wget git python3-pip gdebi-core -y 97 | 98 | echo -e "\n---- Install python packages/librairies ----" 99 | sudo pip3 install Babel decorator docutils ebaysdk feedparser gevent html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject XlsxWriter xlwt xlrd gdata 100 | sudo pip3 install greenlet==1.1.0 101 | 102 | #0.12.3 for Python 3.8 103 | sudo pip3 install libsass==0.17.0 104 | 105 | sudo pip3 install Werkzeug==0.14.1 106 | echo -e "\n--- Install other required packages" 107 | sudo apt-get install node-clean-css -y 108 | sudo apt-get install node-less -y 109 | sudo apt-get install python3-gevent -y 110 | sudo apt-get install python3-psycopg2 -y 111 | 112 | 113 | 114 | # after last update in Ubuntu 18.04 LTS 115 | sudo pip3 install babel PyPDF2 passlib werkzeug lxml decorator Pillow psutil html2text docutils suds-jurko 116 | sudo pip3 install matplotlib 117 | sudo apt-get install python3-reportlab 118 | sudo apt-get install python3-dateutil python3-psycopg2 119 | ##### 120 | 121 | 122 | 123 | #-------------------------------------------------- 124 | # Install Wkhtmltopdf if needed 125 | #-------------------------------------------------- 126 | if [ $INSTALL_WKHTMLTOPDF = "True" ]; then 127 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 128 | #pick up correct one from x64 & x32 versions: 129 | if [ "`getconf LONG_BIT`" == "64" ]; then 130 | _url=$WKHTMLTOX_X64 131 | else 132 | _url=$WKHTMLTOX_X32 133 | fi 134 | sudo wget $_url 135 | sudo dpkg -i `basename $_url` 136 | sudo apt install -f 137 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 138 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 139 | else 140 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 141 | fi 142 | 143 | echo -e "\n---- Create ODOO system user ----" 144 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 145 | #The user should also be added to the sudo'ers group. 146 | sudo adduser $OE_USER sudo 147 | 148 | echo -e "\n---- Create Log directory ----" 149 | sudo mkdir /var/log/$OE_USER 150 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 151 | 152 | #-------------------------------------------------- 153 | # Install ODOO 154 | #-------------------------------------------------- 155 | echo -e "\n==== Installing ODOO Server ====" 156 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 157 | 158 | # --- install requirements odoo 12 159 | sudo pip3 install wheel 160 | sudo pip3 install -r $OE_HOME_EXT/requirements.txt 161 | 162 | if [ $IS_ENTERPRISE = "True" ]; then 163 | # Odoo Enterprise install! 164 | echo -e "\n--- Create symlink for node" 165 | sudo ln -s /usr/bin/nodejs /usr/bin/node 166 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 167 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 168 | 169 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 170 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 171 | echo "------------------------WARNING------------------------------" 172 | echo "Your authentication with Github has failed! Please try again." 173 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 174 | echo "TIP: Press ctrl+c to stop this script." 175 | echo "-------------------------------------------------------------" 176 | echo " " 177 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 178 | done 179 | 180 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 181 | echo -e "\n---- Installing Enterprise specific libraries ----" 182 | sudo apt-get install nodejs npm 183 | sudo npm install -g less 184 | sudo npm install -g less-plugin-clean-css 185 | fi 186 | 187 | echo -e "\n---------------------------OCA----------------------------" 188 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 189 | 190 | if [ $REP_OCA_WEB != "False" ]; then 191 | echo -e "\n==== Download OCA WEB ====" 192 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web" 193 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web 194 | fi 195 | 196 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 197 | echo -e "\n==== Download OCA Server-tools ====" 198 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 199 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools 200 | fi 201 | 202 | if [ $REP_OCA_SERVER_UX != "False" ]; then 203 | echo -e "\n==== Download OCA SERVER-UX ====" 204 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux" 205 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_UX $OE_HOME/OCA/server-ux 206 | fi 207 | 208 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 209 | echo -e "\n==== Download OCA Report-engine ====" 210 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/report-engine" 211 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_REPORT_ENGINE $OE_HOME/OCA/report-engine 212 | echo -e "\n==== Download OCA QUEUE ====" 213 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/queue" 214 | sudo git clone --depth 1 --branch $OE_VERSION $REP_QUEUE $OE_HOME/OCA/queue 215 | fi 216 | 217 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 218 | echo -e "\n==== Download OCA Report-engine ====" 219 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/account-financial-tools" 220 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_ACC_FIN_TOOLS $OE_HOME/OCA/account-financial-tools 221 | fi 222 | 223 | echo -e "\n---- Create custom module directory ----" 224 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 225 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 226 | 227 | if [ $REP_CUSTOM_1 != "False" ]; then 228 | echo -e "\n==== Download REP_CUSTOM_1 custom ====" 229 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/$REP_CUSTOM_1_NAME" 230 | sudo git clone --depth 1 --branch $REP_CUSTOM_1_BRANCH $REP_CUSTOM_1 $OE_HOME/custom/$REP_CUSTOM_1_NAME 231 | fi 232 | 233 | echo -e "\n---- Setting permissions on home folder ----" 234 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 235 | 236 | 237 | echo -e "* Create server config file" 238 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 239 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 240 | sudo chmod 640 /etc/${OE_CONFIG}.conf 241 | 242 | echo -e "* Change server config file" 243 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 244 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 245 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 246 | sudo su root -c "echo 'db_user = $DB_USER' >> /etc/${OE_CONFIG}.conf" 247 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 248 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 249 | if [ $IS_ENTERPRISE = "True" ]; then 250 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 251 | else 252 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 253 | fi 254 | 255 | if [ $REP_OCA_WEB != "False" ]; then 256 | sudo su root -c "echo -n ',$OE_HOME/OCA/web' >> /etc/${OE_CONFIG}.conf" 257 | fi 258 | 259 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 260 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools' >> /etc/${OE_CONFIG}.conf" 261 | fi 262 | 263 | if [ $REP_OCA_SERVER_UX != "False" ]; then 264 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-ux' >> /etc/${OE_CONFIG}.conf" 265 | fi 266 | 267 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 268 | sudo su root -c "echo -n ',$OE_HOME/OCA/report-engine' >> /etc/${OE_CONFIG}.conf" 269 | sudo su root -c "echo -n ',$OE_HOME/OCA/queue' >> /etc/${OE_CONFIG}.conf" 270 | fi 271 | 272 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 273 | sudo su root -c "echo -n ',$OE_HOME/OCA/account-financial-tools' >> /etc/${OE_CONFIG}.conf" 274 | fi 275 | 276 | 277 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 278 | 279 | 280 | #logfile 281 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 282 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 283 | 284 | echo -e "* Change default xmlrpc port" 285 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 286 | 287 | echo -e "* Create startup file" 288 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 289 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 290 | sudo chmod 755 $OE_HOME_EXT/start.sh 291 | 292 | #-------------------------------------------------- 293 | # Adding ODOO as a deamon (initscript) 294 | #-------------------------------------------------- 295 | 296 | echo -e "* Create init file" 297 | cat < ~/$OE_CONFIG 298 | #!/bin/sh 299 | ### BEGIN INIT INFO 300 | # Provides: $OE_CONFIG 301 | # Required-Start: \$remote_fs \$syslog 302 | # Required-Stop: \$remote_fs \$syslog 303 | # Should-Start: \$network 304 | # Should-Stop: \$network 305 | # Default-Start: 2 3 4 5 306 | # Default-Stop: 0 1 6 307 | # Short-Description: Enterprise Business Applications 308 | # Description: ODOO Business Applications 309 | ### END INIT INFO 310 | PATH=/bin:/sbin:/usr/bin 311 | DAEMON=$OE_HOME_EXT/odoo-bin 312 | NAME=$OE_CONFIG 313 | DESC=$OE_CONFIG 314 | # Specify the user name (Default: odoo). 315 | USER=$OE_USER 316 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 317 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 318 | # pidfile 319 | PIDFILE=/var/run/\${NAME}.pid 320 | # Additional options that are passed to the Daemon. 321 | DAEMON_OPTS="-c \$CONFIGFILE" 322 | [ -x \$DAEMON ] || exit 0 323 | [ -f \$CONFIGFILE ] || exit 0 324 | checkpid() { 325 | [ -f \$PIDFILE ] || return 1 326 | pid=\`cat \$PIDFILE\` 327 | [ -d /proc/\$pid ] && return 0 328 | return 1 329 | } 330 | case "\${1}" in 331 | start) 332 | echo -n "Starting \${DESC}: " 333 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 334 | --chuid \$USER --background --make-pidfile \ 335 | --exec \$DAEMON -- \$DAEMON_OPTS 336 | echo "\${NAME}." 337 | ;; 338 | stop) 339 | echo -n "Stopping \${DESC}: " 340 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 341 | --oknodo 342 | echo "\${NAME}." 343 | ;; 344 | restart|force-reload) 345 | echo -n "Restarting \${DESC}: " 346 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 347 | --oknodo 348 | sleep 1 349 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 350 | --chuid \$USER --background --make-pidfile \ 351 | --exec \$DAEMON -- \$DAEMON_OPTS 352 | echo "\${NAME}." 353 | ;; 354 | *) 355 | N=/etc/init.d/\$NAME 356 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 357 | exit 1 358 | ;; 359 | esac 360 | exit 0 361 | EOF 362 | 363 | echo -e "* Security Init File" 364 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 365 | sudo chmod 755 /etc/init.d/$OE_CONFIG 366 | sudo chown root: /etc/init.d/$OE_CONFIG 367 | CONTENT_NGINX="upstream odoo {\n 368 | server 127.0.0.1:$OE_PORT;\n 369 | }\n 370 | server {\n 371 | listen 80;\n 372 | server_name $SERVER_NAME;\n 373 | ssl on; 374 | ssl_certificate /etc/nginx/ssl/certificate.admin-serv.net.crt; 375 | ssl_certificate_key /etc/nginx/ssl/admin-serv.net.deprotected.key; 376 | access_log /var/log/nginx/odoo.access.log;\n 377 | error_log /var/log/nginx/odoo.error.log;\n 378 | proxy_buffers 16 64k;\n 379 | proxy_buffer_size 128k;\n 380 | location / {\n 381 | proxy_pass http://localhost:$OE_PORT;\n 382 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;\n 383 | proxy_redirect off;\n 384 | proxy_set_header Host $host;\n 385 | proxy_set_header X-Real-IP $remote_addr;\n 386 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n 387 | proxy_set_header X-Forwarded-Proto https;\n 388 | }\n 389 | location ~* /web/static/ {\n 390 | proxy_cache_valid 200 60m;\n 391 | proxy_buffering on;\n 392 | expires 864000;\n 393 | proxy_pass http://localhost:$OE_PORT;\n 394 | }\n 395 | location /longpolling {\n 396 | proxy_pass http://127.0.0.1:8072;\n 397 | }\n 398 | }\n 399 | " 400 | if [ $INSTALL_NGINX = "True" ]; then 401 | echo -e "* Install, config Nginx and SSL" 402 | sudo apt install nginx 403 | 404 | if [ $ADD_SSL = "True" ] && [ $SSL_PEM_KEY != "False" ] && [ $SSL_PRV_KEY != "False" ]; then 405 | sudo su root -c "echo '$CONTENT_NGINX' > /etc/nginx/sites-available/$OE_USER" 406 | sudo ln -s /etc/nginx/sites-available/$OE_USER /etc/nginx/sites-enabled/$OE_USER 407 | sudo chown root:root /etc/nginx/sites-available/$OE_USER 408 | sudo chmod 775 /etc/nginx/sites-available/$OE_USER 409 | 410 | sudo chown root:root /etc/nginx/sites-enabled/$OE_USER 411 | sudo chmod 775 /etc/nginx/sites-enabled/$OE_USER 412 | fi 413 | sudo service nginx restart 414 | 415 | fi 416 | 417 | echo -e "* Start ODOO on Startup" 418 | sudo update-rc.d $OE_CONFIG defaults 419 | 420 | echo -e "* Starting Odoo Service" 421 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 422 | echo "-----------------------------------------------------------" 423 | echo "Done! The Odoo server is up and running. Specifications:" 424 | echo "Port: $OE_PORT" 425 | echo "User service: $OE_USER" 426 | echo "User PostgreSQL: $OE_USER" 427 | echo "Code location: $OE_USER" 428 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 429 | echo "Start Odoo service: sudo service $OE_CONFIG start" 430 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 431 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 432 | -------------------------------------------------------------------------------- /odoo_15_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui. Refrence: Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | OE_USER="odoo15" 9 | OE_HOME="/opt/$OE_USER" 10 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 11 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 12 | #Set to true if you want to install it, false if you don't need it or have it already installed. 13 | INSTALL_WKHTMLTOPDF="True" 14 | #Set to true if you want to install it, false if you don't need it or have it already installed. 15 | INSTALL_POSTGRESQL="False" 16 | CREATE_USER_POSTGRESQL="True" 17 | INSTALL_NGINX = "True" 18 | ADD_SSL = "False" 19 | SSL_PEM_KEY = "False" 20 | SSL_PRV_KEY = "False" 21 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 22 | OE_PORT="8014" 23 | SERVER_NAME = "localhost" # test.odoo.com || 13.17.16.15 24 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 25 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 26 | OE_VERSION="15.0" 27 | # Set this to True if you want to install Odoo 10 Enterprise! 28 | IS_ENTERPRISE="False" 29 | #set the superadmin password 30 | OE_SUPERADMIN="ODOO@ADMIN" 31 | OE_CONFIG="${OE_USER}-server" 32 | 33 | #Set the database config 34 | DB_HOST="127.0.0.1" 35 | DB_PORT="5432" 36 | DB_USER=$OE_USER 37 | DB_PASSWORD="LEGEND" 38 | 39 | 40 | # OCA Modules 41 | REP_OCA_WEB="https://github.com/OCA/web.git" 42 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 43 | REP_OCA_SERVER_UX="https://github.com/OCA/server-ux.git" 44 | REP_OCA_REPORT_ENGINE="https://github.com/OCA/reporting-engine.git" 45 | REP_OCA_ACC_FIN_TOOLS="https://github.com/OCA/account-financial-tools.git" 46 | REP_QUEUE="https://github.com/OCA/queue.git" 47 | REP_CUSTOM_1="False" 48 | REP_CUSTOM_1_NAME="" 49 | REP_CUSTOM_1_BRANCH=$OE_VERSION 50 | 51 | ## 52 | ### WKHTMLTOPDF download links 53 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 54 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 55 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 56 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 57 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 58 | 59 | #-------------------------------------------------- 60 | # Update Server 61 | #-------------------------------------------------- 62 | echo -e "\n---- Update Server ----" 63 | sudo apt-get update 64 | sudo apt-get upgrade -y 65 | sudo apt-get install python3-pip libpq-dev libldap2-dev libsasl2-dev libssl-dev libffi-dev build-essential 66 | sudo apt-get install python3.10-dev 67 | #sudo apt-get install python-dev # if version is less than 10 68 | 69 | #-------------------------------------------------- 70 | # Install PostgreSQL Server 71 | #-------------------------------------------------- 72 | 73 | if [ $INSTALL_POSTGRESQL = "True" ]; then 74 | echo -e "\n---- Install PostgreSQL Server ----" 75 | sudo apt-get install postgresql -y 76 | 77 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 78 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 79 | else 80 | sudo apt install postgresql-client-common 81 | sudo apt-get install -y postgresql-client 82 | echo -e "\n POSTGRESQL isn't installed due to the choice of the user! and no postgresql user have been created" 83 | fi 84 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 85 | #-------------------------------------------------- 86 | # Install Dependencies 87 | #-------------------------------------------------- 88 | echo -e "\n---- Install/upgrade Python 3 Pip and other depends" 89 | 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 90 | sudo pip3 install --upgrade pip 91 | sudo pip3 install Werkzeug==0.11.15 92 | echo -e "\n---- Pip current version ---" && pip3 --version 93 | 94 | echo -e "\n---- Install tool packages ----" 95 | sudo apt-get install wget git python3-pip gdebi-core -y 96 | 97 | echo -e "\n---- Install python packages/librairies ----" 98 | sudo pip3 install Babel decorator docutils ebaysdk feedparser gevent html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject XlsxWriter xlwt xlrd gdata 99 | sudo pip3 install greenlet==1.1.0 100 | sudo pip3 install libsass==0.17.0 101 | sudo pip3 install Werkzeug==0.14.1 102 | echo -e "\n--- Install other required packages" 103 | sudo apt-get install node-clean-css -y 104 | sudo apt-get install node-less -y 105 | sudo apt-get install python3-gevent -y 106 | sudo apt-get install python3-psycopg2 -y 107 | 108 | 109 | 110 | # after last update in Ubuntu 18.04 LTS 111 | sudo pip3 install babel PyPDF2 passlib werkzeug lxml decorator Pillow psutil html2text docutils suds-jurko 112 | sudo pip3 install matplotlib 113 | sudo apt-get install python3-reportlab 114 | sudo apt-get install python3-dateutil python3-psycopg2 115 | ##### 116 | 117 | 118 | 119 | #-------------------------------------------------- 120 | # Install Wkhtmltopdf if needed 121 | #-------------------------------------------------- 122 | if [ $INSTALL_WKHTMLTOPDF = "True" ]; then 123 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 124 | #pick up correct one from x64 & x32 versions: 125 | if [ "`getconf LONG_BIT`" == "64" ]; then 126 | _url=$WKHTMLTOX_X64 127 | else 128 | _url=$WKHTMLTOX_X32 129 | fi 130 | sudo wget $_url 131 | sudo dpkg -i `basename $_url` 132 | sudo apt install -f 133 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 134 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 135 | else 136 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 137 | fi 138 | 139 | echo -e "\n---- Create ODOO system user ----" 140 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 141 | #The user should also be added to the sudo'ers group. 142 | sudo adduser $OE_USER sudo 143 | 144 | echo -e "\n---- Create Log directory ----" 145 | sudo mkdir /var/log/$OE_USER 146 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 147 | 148 | #-------------------------------------------------- 149 | # Install ODOO 150 | #-------------------------------------------------- 151 | echo -e "\n==== Installing ODOO Server ====" 152 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 153 | 154 | # --- install requirements odoo 12 155 | sudo pip3 install wheel 156 | sudo pip3 install -r $OE_HOME_EXT/requirements.txt 157 | 158 | if [ $IS_ENTERPRISE = "True" ]; then 159 | # Odoo Enterprise install! 160 | echo -e "\n--- Create symlink for node" 161 | sudo ln -s /usr/bin/nodejs /usr/bin/node 162 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 163 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 164 | 165 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 166 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 167 | echo "------------------------WARNING------------------------------" 168 | echo "Your authentication with Github has failed! Please try again." 169 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 170 | echo "TIP: Press ctrl+c to stop this script." 171 | echo "-------------------------------------------------------------" 172 | echo " " 173 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 174 | done 175 | 176 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 177 | echo -e "\n---- Installing Enterprise specific libraries ----" 178 | sudo apt-get install nodejs npm 179 | sudo npm install -g less 180 | sudo npm install -g less-plugin-clean-css 181 | fi 182 | 183 | echo -e "\n---------------------------OCA----------------------------" 184 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 185 | 186 | if [ $REP_OCA_WEB != "False" ]; then 187 | echo -e "\n==== Download OCA WEB ====" 188 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web" 189 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web 190 | fi 191 | 192 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 193 | echo -e "\n==== Download OCA Server-tools ====" 194 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 195 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools 196 | fi 197 | 198 | if [ $REP_OCA_SERVER_UX != "False" ]; then 199 | echo -e "\n==== Download OCA SERVER-UX ====" 200 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux" 201 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_UX $OE_HOME/OCA/server-ux 202 | fi 203 | 204 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 205 | echo -e "\n==== Download OCA Report-engine ====" 206 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/report-engine" 207 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_REPORT_ENGINE $OE_HOME/OCA/report-engine 208 | echo -e "\n==== Download OCA QUEUE ====" 209 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/queue" 210 | sudo git clone --depth 1 --branch $OE_VERSION $REP_QUEUE $OE_HOME/OCA/queue 211 | fi 212 | 213 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 214 | echo -e "\n==== Download OCA Report-engine ====" 215 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/account-financial-tools" 216 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_ACC_FIN_TOOLS $OE_HOME/OCA/account-financial-tools 217 | fi 218 | 219 | echo -e "\n---- Create custom module directory ----" 220 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 221 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 222 | 223 | if [ $REP_CUSTOM_1 != "False" ]; then 224 | echo -e "\n==== Download REP_CUSTOM_1 custom ====" 225 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/$REP_CUSTOM_1_NAME" 226 | sudo git clone --depth 1 --branch $REP_CUSTOM_1_BRANCH $REP_CUSTOM_1 $OE_HOME/custom/$REP_CUSTOM_1_NAME 227 | fi 228 | 229 | echo -e "\n---- Setting permissions on home folder ----" 230 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 231 | 232 | 233 | echo -e "* Create server config file" 234 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 235 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 236 | sudo chmod 640 /etc/${OE_CONFIG}.conf 237 | 238 | echo -e "* Change server config file" 239 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 240 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 241 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 242 | sudo su root -c "echo 'db_user = $DB_USER' >> /etc/${OE_CONFIG}.conf" 243 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 244 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 245 | if [ $IS_ENTERPRISE = "True" ]; then 246 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 247 | else 248 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 249 | fi 250 | 251 | if [ $REP_OCA_WEB != "False" ]; then 252 | sudo su root -c "echo -n ',$OE_HOME/OCA/web' >> /etc/${OE_CONFIG}.conf" 253 | fi 254 | 255 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 256 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools' >> /etc/${OE_CONFIG}.conf" 257 | fi 258 | 259 | if [ $REP_OCA_SERVER_UX != "False" ]; then 260 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-ux' >> /etc/${OE_CONFIG}.conf" 261 | fi 262 | 263 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 264 | sudo su root -c "echo -n ',$OE_HOME/OCA/report-engine' >> /etc/${OE_CONFIG}.conf" 265 | sudo su root -c "echo -n ',$OE_HOME/OCA/queue' >> /etc/${OE_CONFIG}.conf" 266 | fi 267 | 268 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 269 | sudo su root -c "echo -n ',$OE_HOME/OCA/account-financial-tools' >> /etc/${OE_CONFIG}.conf" 270 | fi 271 | 272 | 273 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 274 | 275 | 276 | #logfile 277 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 278 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 279 | 280 | echo -e "* Change default xmlrpc port" 281 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 282 | 283 | echo -e "* Create startup file" 284 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 285 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 286 | sudo chmod 755 $OE_HOME_EXT/start.sh 287 | 288 | #-------------------------------------------------- 289 | # Adding ODOO as a deamon (initscript) 290 | #-------------------------------------------------- 291 | 292 | echo -e "* Create init file" 293 | cat < ~/$OE_CONFIG 294 | #!/bin/sh 295 | ### BEGIN INIT INFO 296 | # Provides: $OE_CONFIG 297 | # Required-Start: \$remote_fs \$syslog 298 | # Required-Stop: \$remote_fs \$syslog 299 | # Should-Start: \$network 300 | # Should-Stop: \$network 301 | # Default-Start: 2 3 4 5 302 | # Default-Stop: 0 1 6 303 | # Short-Description: Enterprise Business Applications 304 | # Description: ODOO Business Applications 305 | ### END INIT INFO 306 | PATH=/bin:/sbin:/usr/bin 307 | DAEMON=$OE_HOME_EXT/odoo-bin 308 | NAME=$OE_CONFIG 309 | DESC=$OE_CONFIG 310 | # Specify the user name (Default: odoo). 311 | USER=$OE_USER 312 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 313 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 314 | # pidfile 315 | PIDFILE=/var/run/\${NAME}.pid 316 | # Additional options that are passed to the Daemon. 317 | DAEMON_OPTS="-c \$CONFIGFILE" 318 | [ -x \$DAEMON ] || exit 0 319 | [ -f \$CONFIGFILE ] || exit 0 320 | checkpid() { 321 | [ -f \$PIDFILE ] || return 1 322 | pid=\`cat \$PIDFILE\` 323 | [ -d /proc/\$pid ] && return 0 324 | return 1 325 | } 326 | case "\${1}" in 327 | start) 328 | echo -n "Starting \${DESC}: " 329 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 330 | --chuid \$USER --background --make-pidfile \ 331 | --exec \$DAEMON -- \$DAEMON_OPTS 332 | echo "\${NAME}." 333 | ;; 334 | stop) 335 | echo -n "Stopping \${DESC}: " 336 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 337 | --oknodo 338 | echo "\${NAME}." 339 | ;; 340 | restart|force-reload) 341 | echo -n "Restarting \${DESC}: " 342 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 343 | --oknodo 344 | sleep 1 345 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 346 | --chuid \$USER --background --make-pidfile \ 347 | --exec \$DAEMON -- \$DAEMON_OPTS 348 | echo "\${NAME}." 349 | ;; 350 | *) 351 | N=/etc/init.d/\$NAME 352 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 353 | exit 1 354 | ;; 355 | esac 356 | exit 0 357 | EOF 358 | 359 | echo -e "* Security Init File" 360 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 361 | sudo chmod 755 /etc/init.d/$OE_CONFIG 362 | sudo chown root: /etc/init.d/$OE_CONFIG 363 | 364 | CONTENT_NGINX="upstream odoo {\n 365 | server 127.0.0.1:8090;\n 366 | }\n 367 | server {\n 368 | listen 80;\n 369 | server_name $SERVER_NAME;\n 370 | ssl on; 371 | ssl_certificate /etc/nginx/ssl/certificate.admin-serv.net.crt; 372 | ssl_certificate_key /etc/nginx/ssl/admin-serv.net.deprotected.key; 373 | access_log /var/log/nginx/odoo.access.log;\n 374 | error_log /var/log/nginx/odoo.error.log;\n 375 | proxy_buffers 16 64k;\n 376 | proxy_buffer_size 128k;\n 377 | location / {\n 378 | proxy_pass http://localhost:$OE_PORT;\n 379 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;\n 380 | proxy_redirect off;\n 381 | proxy_set_header Host $host;\n 382 | proxy_set_header X-Real-IP $remote_addr;\n 383 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n 384 | proxy_set_header X-Forwarded-Proto https;\n 385 | }\n 386 | location ~* /web/static/ {\n 387 | proxy_cache_valid 200 60m;\n 388 | proxy_buffering on;\n 389 | expires 864000;\n 390 | proxy_pass http://localhost:$OE_PORT;\n 391 | }\n 392 | location /longpolling {\n 393 | proxy_pass http://127.0.0.1:8072;\n 394 | }\n 395 | }\n 396 | " 397 | if [ $INSTALL_NGINX = "True" ]; then 398 | echo -e "* Install, config Nginx and SSL" 399 | sudo apt install nginx 400 | 401 | if [ $ADD_SSL = "True" ] && [ $SSL_PEM_KEY != "False" ] && [ $SSL_PRV_KEY != "False" ]; then 402 | sudo su root -c "echo '$CONTENT_NGINX' > /etc/nginx/sites-available/$OE_USER" 403 | sudo ln -s /etc/nginx/sites-available/$OE_USER /etc/nginx/sites-enabled/$OE_USER 404 | sudo chown root:root /etc/nginx/sites-available/$OE_USER 405 | sudo chmod 775 /etc/nginx/sites-available/$OE_USER 406 | 407 | sudo chown root:root /etc/nginx/sites-enabled/$OE_USER 408 | sudo chmod 775 /etc/nginx/sites-enabled/$OE_USER 409 | fi 410 | 411 | fi 412 | 413 | echo -e "* Start ODOO on Startup" 414 | sudo update-rc.d $OE_CONFIG defaults 415 | 416 | echo -e "* Starting Odoo Service" 417 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 418 | echo "-----------------------------------------------------------" 419 | echo "Done! The Odoo server is up and running. Specifications:" 420 | echo "Port: $OE_PORT" 421 | echo "User service: $OE_USER" 422 | echo "User PostgreSQL: $OE_USER" 423 | echo "Code location: $OE_USER" 424 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 425 | echo "Start Odoo service: sudo service $OE_CONFIG start" 426 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 427 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 428 | -------------------------------------------------------------------------------- /odoo_16_and_17_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui. Refrence: Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | OE_USER="odoo" 9 | OE_HOME="/opt/$OE_USER" 10 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 11 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 12 | #Set to true if you want to install it, false if you don't need it or have it already installed. 13 | INSTALL_WKHTMLTOPDF="True" 14 | #Set to true if you want to install it, false if you don't need it or have it already installed. 15 | INSTALL_POSTGRESQL="False" 16 | CREATE_USER_POSTGRESQL="True" 17 | INSTALL_NGINX = "False" 18 | ADD_SSL = "False" 19 | SSL_PEM_KEY = "False" 20 | SSL_PRV_KEY = "False" 21 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 22 | OE_PORT="8017" 23 | WEBSOCKET_PORT="8072" 24 | SERVER_NAME = "localhost" # test.odoo.com || 50.17.16.15 25 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 26 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 27 | OE_VERSION="17.0"#OR 16.0 28 | # Set this to True if you want to install Odoo 10 Enterprise! 29 | IS_ENTERPRISE="False" 30 | #set the superadmin password 31 | OE_SUPERADMIN="ODOO@ADMIN" 32 | OE_CONFIG="${OE_USER}-server" 33 | 34 | #Set the database config 35 | DB_HOST="127.0.0.1" 36 | DB_PORT="5432" 37 | DB_USER=$OE_USER 38 | DB_PASSWORD="Odoo17@Legend/mjid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" 39 | 40 | 41 | # OCA Modules 42 | REP_OCA_WEB="https://github.com/OCA/web.git" 43 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 44 | REP_OCA_SERVER_UX="https://github.com/OCA/server-ux.git" 45 | REP_OCA_REPORT_ENGINE="https://github.com/OCA/reporting-engine.git" 46 | REP_OCA_ACC_FIN_TOOLS="https://github.com/OCA/account-financial-tools.git" 47 | REP_QUEUE="https://github.com/OCA/queue.git" 48 | REP_CUSTOM_1="False" 49 | REP_CUSTOM_1_NAME="" 50 | REP_CUSTOM_1_BRANCH=$OE_VERSION 51 | 52 | ## 53 | ### WKHTMLTOPDF download links 54 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 55 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 56 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 57 | # FOR UBUNTU Jammy (22.04), you can change the link (take a look at : https://github.com/wkhtmltopdf/packaging/releases/tag/0.12.6.1-3) 58 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb 59 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 60 | 61 | #-------------------------------------------------- 62 | # Update Server 63 | #-------------------------------------------------- 64 | echo -e "\n---- Update Server ----" 65 | sudo apt-get update 66 | sudo apt-get upgrade -y 67 | 68 | #-------------------------------------------------- 69 | # Install PostgreSQL Server 70 | #-------------------------------------------------- 71 | 72 | if [ $INSTALL_POSTGRESQL = "True" ]; then 73 | echo -e "\n---- Install PostgreSQL Server ----" 74 | sudo apt-get install postgresql -y 75 | 76 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 77 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 78 | else 79 | sudo apt install postgresql-client-common 80 | sudo apt-get install -y postgresql-client 81 | echo -e "\n POSTGRESQL isn't installed due to the choice of the user! and no postgresql user have been created" 82 | fi 83 | 84 | sudo apt install postgresql-client 85 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 86 | #-------------------------------------------------- 87 | # Install Dependencies 88 | #-------------------------------------------------- 89 | sudo pip3 install --upgrade pip 90 | sudo apt install npm 91 | sudo npm install -g rtlcss 92 | sudo apt-get install python3-pip libpq-dev libldap2-dev libsasl2-dev libssl-dev libffi-dev build-essential 93 | sudo apt-get install python3.10-dev 94 | 95 | echo -e "\n---- Install/upgrade Python 3 Pip and other depends" 96 | #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 97 | 98 | 99 | #sudo pip3 install Werkzeug==0.11.15 100 | #echo -e "\n---- Pip current version ---" && pip3 --version 101 | 102 | echo -e "\n---- Install tool packages ----" 103 | #sudo apt-get install wget git python3-pip gdebi-core -y 104 | 105 | echo -e "\n---- Install python packages/librairies ----" 106 | #sudo pip3 install Babel decorator docutils ebaysdk feedparser gevent html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse passlib Pillow psutil psycogreen pydot pyparsing PyPDF2 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode reportlab requests six suds-jurko vatnumber vobject XlsxWriter xlwt xlrd gdata 107 | #sudo pip3 install greenlet==1.1.0 108 | #sudo pip3 install libsass==0.17.0 109 | #sudo pip3 install Werkzeug==0.14.1 110 | echo -e "\n--- Install other required packages" 111 | #sudo apt-get install node-clean-css -y 112 | #sudo apt-get install node-less -y 113 | #sudo apt-get install python3-gevent -y 114 | #sudo apt-get install python3-psycopg2 -y 115 | 116 | 117 | 118 | # after last update in Ubuntu 18.04 LTS 119 | #sudo pip3 install babel PyPDF2 passlib werkzeug lxml decorator Pillow psutil html2text docutils suds-jurko 120 | #sudo pip3 install matplotlib 121 | #sudo apt-get install python3-reportlab 122 | #sudo apt-get install python3-dateutil python3-psycopg2 123 | ##### 124 | 125 | 126 | 127 | #-------------------------------------------------- 128 | # Install Wkhtmltopdf if needed 129 | #-------------------------------------------------- 130 | if [ "$INSTALL_WKHTMLTOPDF" = "True" ]; then 131 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 132 | #pick up correct one from x64 & x32 versions: 133 | if [ "`getconf LONG_BIT`" == "64" ]; then 134 | _url=$WKHTMLTOX_X64 135 | else 136 | _url=$WKHTMLTOX_X32 137 | fi 138 | sudo wget $_url 139 | sudo dpkg -i `basename $_url` 140 | sudo apt install -f 141 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 142 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 143 | else 144 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 145 | fi 146 | 147 | echo -e "\n---- Create ODOO system user ----" 148 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 149 | #The user should also be added to the sudo'ers group. 150 | sudo adduser $OE_USER sudo 151 | 152 | echo -e "\n---- Create Log directory ----" 153 | sudo mkdir /var/log/$OE_USER 154 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 155 | 156 | #-------------------------------------------------- 157 | # Install ODOO 158 | #-------------------------------------------------- 159 | echo -e "\n==== Installing ODOO Server ====" 160 | sudo apt install git -y 161 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 162 | 163 | # --- install requirements odoo 164 | sudo pip3 install wheel 165 | pip3 install --upgrade pip 166 | sudo pip3 install -r $OE_HOME_EXT/requirements.txt 167 | 168 | if [ $IS_ENTERPRISE = "True" ]; then 169 | # Odoo Enterprise install! 170 | echo -e "\n--- Create symlink for node" 171 | sudo ln -s /usr/bin/nodejs /usr/bin/node 172 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 173 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 174 | 175 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 176 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 177 | echo "------------------------WARNING------------------------------" 178 | echo "Your authentication with Github has failed! Please try again." 179 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 180 | echo "TIP: Press ctrl+c to stop this script." 181 | echo "-------------------------------------------------------------" 182 | echo " " 183 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 184 | done 185 | 186 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 187 | echo -e "\n---- Installing Enterprise specific libraries ----" 188 | sudo apt-get install nodejs npm 189 | sudo npm install -g less 190 | sudo npm install -g less-plugin-clean-css 191 | fi 192 | 193 | echo -e "\n---------------------------OCA----------------------------" 194 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 195 | 196 | if [ "$REP_OCA_WEB" != "False" ]; then 197 | echo -e "\n==== Download OCA WEB ====" 198 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web" 199 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web 200 | fi 201 | 202 | if [ "$REP_OCA_SERVER_TOOLS" != "False" ]; then 203 | echo -e "\n==== Download OCA Server-tools ====" 204 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 205 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools 206 | fi 207 | 208 | if [ "$REP_OCA_SERVER_UX" != "False" ]; then 209 | echo -e "\n==== Download OCA SERVER-UX ====" 210 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-ux" 211 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_UX $OE_HOME/OCA/server-ux 212 | fi 213 | 214 | if [ "$REP_OCA_REPORT_ENGINE" != "False" ]; then 215 | echo -e "\n==== Download OCA Report-engine ====" 216 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/report-engine" 217 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_REPORT_ENGINE $OE_HOME/OCA/report-engine 218 | echo -e "\n==== Download OCA QUEUE ====" 219 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/queue" 220 | sudo git clone --depth 1 --branch $OE_VERSION $REP_QUEUE $OE_HOME/OCA/queue 221 | fi 222 | 223 | if [ "$REP_OCA_ACC_FIN_TOOLS" != "False" ]; then 224 | echo -e "\n==== Download OCA Report-engine ====" 225 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/account-financial-tools" 226 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_ACC_FIN_TOOLS $OE_HOME/OCA/account-financial-tools 227 | fi 228 | 229 | echo -e "\n---- Create custom module directory ----" 230 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 231 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 232 | 233 | if [ $REP_CUSTOM_1 != "False" ]; then 234 | echo -e "\n==== Download REP_CUSTOM_1 custom ====" 235 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/$REP_CUSTOM_1_NAME" 236 | sudo git clone --depth 1 --branch $REP_CUSTOM_1_BRANCH $REP_CUSTOM_1 $OE_HOME/custom/$REP_CUSTOM_1_NAME 237 | fi 238 | 239 | echo -e "\n---- Setting permissions on home folder ----" 240 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 241 | 242 | # ---- INSTALL GEOIP database --- 243 | sudo apt-get install geoip-database -y 244 | # download mnaually the files GeoLite2-City.mmdb and GeoLite2-Country.mmdb from https://dev.maxmind.com/geoip/geolite2-free-geolocation-data 245 | # mv ~/Downloads/GeoLite2-City.mmdb /usr/share/GeoIP/ 246 | # mv ~/Downloads/GeoLite2-Country.mmdb /usr/share/GeoIP/ 247 | # Test it in your odoo website :

248 | 249 | 250 | echo -e "* Create server config file" 251 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 252 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 253 | sudo chmod 640 /etc/${OE_CONFIG}.conf 254 | 255 | echo -e "* Change server config file" 256 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 257 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 258 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 259 | sudo su root -c "echo 'db_user = $DB_USER' >> /etc/${OE_CONFIG}.conf" 260 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 261 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 262 | if [ $IS_ENTERPRISE = "True" ]; then 263 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 264 | else 265 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 266 | fi 267 | 268 | if [ $REP_OCA_WEB != "False" ]; then 269 | sudo su root -c "echo -n ',$OE_HOME/OCA/web' >> /etc/${OE_CONFIG}.conf" 270 | fi 271 | 272 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 273 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools' >> /etc/${OE_CONFIG}.conf" 274 | fi 275 | 276 | if [ $REP_OCA_SERVER_UX != "False" ]; then 277 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-ux' >> /etc/${OE_CONFIG}.conf" 278 | fi 279 | 280 | if [ $REP_OCA_REPORT_ENGINE != "False" ]; then 281 | sudo su root -c "echo -n ',$OE_HOME/OCA/report-engine' >> /etc/${OE_CONFIG}.conf" 282 | sudo su root -c "echo -n ',$OE_HOME/OCA/queue' >> /etc/${OE_CONFIG}.conf" 283 | fi 284 | 285 | if [ $REP_OCA_ACC_FIN_TOOLS != "False" ]; then 286 | sudo su root -c "echo -n ',$OE_HOME/OCA/account-financial-tools' >> /etc/${OE_CONFIG}.conf" 287 | fi 288 | 289 | 290 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 291 | 292 | 293 | #logfile 294 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 295 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 296 | 297 | echo -e "* Change default xmlrpc port" 298 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 299 | sudo su root -c "echo 'gevent_port = 8072' >> /etc/${OE_CONFIG}.conf" 300 | sudo su root -c "echo 'proxy_mode = True' >> /etc/${OE_CONFIG}.conf" 301 | 302 | echo -e "* Create startup file" 303 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 304 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 305 | sudo chmod 755 $OE_HOME_EXT/start.sh 306 | 307 | sudo apt install nginx 308 | sudo apt install certbot python3-certbot-nginx 309 | 310 | #-------------------------------------------------- 311 | # Adding ODOO as a deamon (initscript) 312 | #-------------------------------------------------- 313 | 314 | echo -e "* Create init file" 315 | cat < ~/$OE_CONFIG 316 | #!/bin/sh 317 | ### BEGIN INIT INFO 318 | # Provides: $OE_CONFIG 319 | # Required-Start: \$remote_fs \$syslog 320 | # Required-Stop: \$remote_fs \$syslog 321 | # Should-Start: \$network 322 | # Should-Stop: \$network 323 | # Default-Start: 2 3 4 5 324 | # Default-Stop: 0 1 6 325 | # Short-Description: Enterprise Business Applications 326 | # Description: ODOO Business Applications 327 | ### END INIT INFO 328 | PATH=/bin:/sbin:/usr/bin 329 | DAEMON=$OE_HOME_EXT/odoo-bin 330 | NAME=$OE_CONFIG 331 | DESC=$OE_CONFIG 332 | # Specify the user name (Default: odoo). 333 | USER=$OE_USER 334 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 335 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 336 | # pidfile 337 | PIDFILE=/var/run/\${NAME}.pid 338 | # Additional options that are passed to the Daemon. 339 | DAEMON_OPTS="-c \$CONFIGFILE" 340 | [ -x \$DAEMON ] || exit 0 341 | [ -f \$CONFIGFILE ] || exit 0 342 | checkpid() { 343 | [ -f \$PIDFILE ] || return 1 344 | pid=\`cat \$PIDFILE\` 345 | [ -d /proc/\$pid ] && return 0 346 | return 1 347 | } 348 | case "\${1}" in 349 | start) 350 | echo -n "Starting \${DESC}: " 351 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 352 | --chuid \$USER --background --make-pidfile \ 353 | --exec \$DAEMON -- \$DAEMON_OPTS 354 | echo "\${NAME}." 355 | ;; 356 | stop) 357 | echo -n "Stopping \${DESC}: " 358 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 359 | --oknodo 360 | echo "\${NAME}." 361 | ;; 362 | restart|force-reload) 363 | echo -n "Restarting \${DESC}: " 364 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 365 | --oknodo 366 | sleep 1 367 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 368 | --chuid \$USER --background --make-pidfile \ 369 | --exec \$DAEMON -- \$DAEMON_OPTS 370 | echo "\${NAME}." 371 | ;; 372 | *) 373 | N=/etc/init.d/\$NAME 374 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 375 | exit 1 376 | ;; 377 | esac 378 | exit 0 379 | EOF 380 | 381 | echo -e "* Security Init File" 382 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 383 | sudo chmod 755 /etc/init.d/$OE_CONFIG 384 | sudo chown root: /etc/init.d/$OE_CONFIG 385 | CONTENT_NGINX="upstream odoo {\n 386 | server 127.0.0.1:$OE_PORT;\n 387 | }\n 388 | upstream odoochat {\n 389 | server 127.0.0.1:$WEBSOCKET_PORT;\n 390 | }\n 391 | server {\n 392 | listen 80;\n 393 | server_name $SERVER_NAME;\n 394 | ssl on; 395 | ssl_certificate /etc/nginx/ssl/certificate.admin-serv.net.crt; 396 | ssl_certificate_key /etc/nginx/ssl/admin-serv.net.deprotected.key; 397 | access_log /var/log/nginx/odoo.access.log;\n 398 | error_log /var/log/nginx/odoo.error.log;\n 399 | proxy_buffers 16 64k;\n 400 | proxy_buffer_size 128k;\n 401 | location / {\n 402 | proxy_pass http://localhost:$OE_PORT;\n 403 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;\n 404 | proxy_redirect off;\n 405 | proxy_set_header Host $host;\n 406 | proxy_set_header X-Real-IP $remote_addr;\n 407 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n 408 | proxy_set_header X-Forwarded-Proto https;\n 409 | }\n 410 | location ~* /web/static/ {\n 411 | proxy_cache_valid 200 60m;\n 412 | proxy_buffering on;\n 413 | expires 864000;\n 414 | proxy_pass http://localhost:$OE_PORT;\n 415 | }\n 416 | location /websocket { 417 | proxy_pass http://odoochat; 418 | proxy_set_header X-Real-IP $remote_addr; 419 | proxy_set_header Upgrade $http_upgrade; 420 | proxy_set_header Connection $connection_upgrade; 421 | proxy_set_header X-Forwarded-Host $host; 422 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 423 | proxy_set_header X-Forwarded-Proto $scheme; 424 | } 425 | }\n 426 | " 427 | if [ $INSTALL_NGINX = "True" ]; then 428 | echo -e "* Install, config Nginx and SSL" 429 | sudo apt install nginx 430 | 431 | if [ $ADD_SSL = "True" ] && [ $SSL_PEM_KEY != "False" ] && [ $SSL_PRV_KEY != "False" ]; then 432 | sudo su root -c "echo '$CONTENT_NGINX' > /etc/nginx/sites-available/$OE_USER" 433 | sudo ln -s /etc/nginx/sites-available/$OE_USER /etc/nginx/sites-enabled/$OE_USER 434 | sudo chown root:root /etc/nginx/sites-available/$OE_USER 435 | sudo chmod 775 /etc/nginx/sites-available/$OE_USER 436 | 437 | sudo chown root:root /etc/nginx/sites-enabled/$OE_USER 438 | sudo chmod 775 /etc/nginx/sites-enabled/$OE_USER 439 | fi 440 | sudo service nginx restart 441 | 442 | fi 443 | 444 | echo -e "* Start ODOO on Startup" 445 | sudo update-rc.d $OE_CONFIG defaults 446 | 447 | echo -e "* Starting Odoo Service" 448 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 449 | echo "-----------------------------------------------------------" 450 | echo "Done! The Odoo server is up and running. Specifications:" 451 | echo "Port: $OE_PORT" 452 | echo "User service: $OE_USER" 453 | echo "User PostgreSQL: $OE_USER" 454 | echo "Code location: $OE_USER" 455 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 456 | echo "Start Odoo service: sudo service $OE_CONFIG start" 457 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 458 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 459 | -------------------------------------------------------------------------------- /odoo_8_OR_10_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################################################################ 3 | # Author: Abdelmajid Elhamdaoui, Reference : Yenthe Van Ginneken 4 | ################################################################################ 5 | 6 | ##fixed parameters 7 | #odoo 8 | OE_USER="odoo" 9 | OE_HOME="/opt/$OE_USER" 10 | OE_HOME_EXT="/opt/$OE_USER/odoo-server" 11 | #The default port where this Odoo instance will run under (provided you use the command -c in the terminal) 12 | #Set to true if you want to install it, false if you don't need it or have it already installed. 13 | INSTALL_WKHTMLTOPDF="False" 14 | #Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.) 15 | OE_PORT="8055" 16 | #Choose the Odoo version which you want to install. For example: 10.0, 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed. 17 | #IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 10.0 18 | OE_VERSION="10.0" 19 | #OE_VERSION="8.0" 20 | # Set this to True if you want to install Odoo 10 Enterprise! 21 | IS_ENTERPRISE="False" 22 | #set the superadmin password 23 | OE_SUPERADMIN="superadminpass" 24 | OE_CONFIG="${OE_USER}-server" 25 | 26 | #Set the database config 27 | DB_HOST="127.0.0.1" 28 | DB_PORT="5432" 29 | DB_PASSWORD="False" 30 | 31 | # OCA Modules 32 | REP_OCA_WEB="https://github.com/OCA/web.git" 33 | REP_OCA_SERVER_TOOLS="https://github.com/OCA/server-tools.git" 34 | 35 | ## 36 | ### WKHTMLTOPDF download links 37 | ## === Ubuntu Trusty x64 & x32 === (for other distributions please replace these two links, 38 | ## in order to have correct version of wkhtmltox installed, for a danger note refer to 39 | ## https://www.odoo.com/documentation/8.0/setup/install.html#deb ): 40 | WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 41 | WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_i386.deb 42 | 43 | #-------------------------------------------------- 44 | # Update Server 45 | #-------------------------------------------------- 46 | echo -e "\n---- Update Server ----" 47 | sudo apt-get update 48 | sudo apt-get upgrade -y 49 | 50 | #-------------------------------------------------- 51 | # Install Python2 (added for ubuntu 20.04) 52 | #-------------------------------------------------- 53 | 54 | sudo apt install python-dev 55 | sudo apt install libldap2-dev 56 | sudo apt install libsasl2-dev gcc 57 | 58 | #-------------------------------------------------- 59 | # Install PostgreSQL Server 60 | #-------------------------------------------------- 61 | echo -e "\n---- Install PostgreSQL Server ----" 62 | sudo apt-get install postgresql -y 63 | 64 | echo -e "\n---- Creating the ODOO PostgreSQL User ----" 65 | sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true 66 | 67 | #psql -U postgres -c "ALTER USER $OE_USER WITH PASSWORD '$DB_PASSWORD'" 68 | #-------------------------------------------------- 69 | # Install Dependencies 70 | #-------------------------------------------------- 71 | echo -e "\n---- Install/upgrade Python 2 Pip" 72 | sudo apt-get install python2-pip -y 73 | sudo pip install --upgrade pip 74 | echo -e "\n---- Pip current version ---" && pip --version 75 | 76 | echo -e "\n---- Install tool packages ----" 77 | sudo apt-get install wget git python-pip gdebi-core -y 78 | 79 | echo -e "\n---- Install python packages/librairies ----" 80 | 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 -y python-suds 81 | 82 | sudo pip install gdata psycogreen ofxparse XlsxWriter xlrd 83 | sudo apt-get install python-matplotlib 84 | 85 | echo -e "\n--- Install other required packages" 86 | sudo apt-get install node-clean-css -y 87 | sudo apt-get install node-less -y 88 | sudo apt-get install python-gevent -y 89 | 90 | #-------------------------------------------------- 91 | # Install Wkhtmltopdf if needed 92 | #-------------------------------------------------- 93 | if [ $INSTALL_WKHTMLTOPDF = "True" ]; then 94 | echo -e "\n---- Install wkhtml and place shortcuts on correct place for ODOO 10 ----" 95 | #pick up correct one from x64 & x32 versions: 96 | if [ "`getconf LONG_BIT`" == "64" ];then 97 | _url=$WKHTMLTOX_X64 98 | else 99 | _url=$WKHTMLTOX_X32 100 | fi 101 | sudo wget $_url 102 | sudo gdebi --n `basename $_url` 103 | sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 104 | sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin 105 | else 106 | echo "Wkhtmltopdf isn't installed due to the choice of the user!" 107 | fi 108 | 109 | echo -e "\n---- Create ODOO system user ----" 110 | sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER 111 | #The user should also be added to the sudo'ers group. 112 | sudo adduser $OE_USER sudo 113 | 114 | echo -e "\n---- Create Log directory ----" 115 | sudo mkdir /var/log/$OE_USER 116 | sudo chown $OE_USER:$OE_USER /var/log/$OE_USER 117 | 118 | #-------------------------------------------------- 119 | # Install ODOO 120 | #-------------------------------------------------- 121 | echo -e "\n==== Installing ODOO Server ====" 122 | sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/ 123 | 124 | if [ $IS_ENTERPRISE = "True" ]; then 125 | # Odoo Enterprise install! 126 | echo -e "\n--- Create symlink for node" 127 | sudo ln -s /usr/bin/nodejs /usr/bin/node 128 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise" 129 | sudo su $OE_USER -c "mkdir $OE_HOME/enterprise/addons" 130 | 131 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 132 | while [[ $GITHUB_RESPONSE == *"Authentication"* ]]; do 133 | echo "------------------------WARNING------------------------------" 134 | echo "Your authentication with Github has failed! Please try again." 135 | printf "In order to clone and install the Odoo enterprise version you \nneed to be an offical Odoo partner and you need access to\nhttp://github.com/odoo/enterprise.\n" 136 | echo "TIP: Press ctrl+c to stop this script." 137 | echo "-------------------------------------------------------------" 138 | echo " " 139 | GITHUB_RESPONSE=$(sudo git clone --depth 1 --branch $OE_VERSION https://www.github.com/odoo/enterprise "$OE_HOME/enterprise/addons" 2>&1) 140 | done 141 | 142 | echo -e "\n---- Added Enterprise code under $OE_HOME/enterprise/addons ----" 143 | echo -e "\n---- Installing Enterprise specific libraries ----" 144 | sudo apt-get install nodejs npm 145 | sudo npm install -g less 146 | sudo npm install -g less-plugin-clean-css 147 | fi 148 | 149 | echo -e "\n---------------------------OCA----------------------------" 150 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA" 151 | 152 | if [ $REP_OCA_WEB != "False" ]; then 153 | echo -e "\n==== Download OCA WEB ====" 154 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/web/addons" 155 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_WEB $OE_HOME/OCA/web/addons 156 | fi 157 | 158 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 159 | echo -e "\n==== Download OCA Server-tools ====" 160 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools" 161 | sudo su $OE_USER -c "mkdir $OE_HOME/OCA/server-tools/addons" 162 | sudo git clone --depth 1 --branch $OE_VERSION $REP_OCA_SERVER_TOOLS $OE_HOME/OCA/server-tools/addons 163 | fi 164 | 165 | echo -e "\n---- Create custom module directory ----" 166 | sudo su $OE_USER -c "mkdir $OE_HOME/custom" 167 | sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons" 168 | 169 | echo -e "\n---- Setting permissions on home folder ----" 170 | sudo chown -R $OE_USER:$OE_USER $OE_HOME/* 171 | 172 | 173 | echo -e "* Create server config file" 174 | sudo su root -c "echo '[options]' > /etc/${OE_CONFIG}.conf" 175 | sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf 176 | sudo chmod 640 /etc/${OE_CONFIG}.conf 177 | 178 | echo -e "* Change server config file" 179 | sudo su root -c "echo 'admin_passwd = $OE_SUPERADMIN' >> /etc/${OE_CONFIG}.conf" 180 | sudo su root -c "echo 'db_host = $DB_HOST' >> /etc/${OE_CONFIG}.conf" 181 | sudo su root -c "echo 'db_port = $DB_PORT' >> /etc/${OE_CONFIG}.conf" 182 | sudo su root -c "echo 'db_user = $OE_USER' >> /etc/${OE_CONFIG}.conf" 183 | sudo su root -c "echo 'db_password = $DB_PASSWORD' >> /etc/${OE_CONFIG}.conf" 184 | sudo su root -c "echo -n 'addons_path = ' >> /etc/${OE_CONFIG}.conf" 185 | if [ $IS_ENTERPRISE = "True" ]; then 186 | sudo su root -c "echo -n '$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 187 | else 188 | sudo su root -c "echo -n '$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" 189 | fi 190 | 191 | if [ $REP_OCA_WEB != "False" ]; then 192 | sudo su root -c "echo -n ',$OE_HOME/OCA/web/addons' >> /etc/${OE_CONFIG}.conf" 193 | fi 194 | 195 | if [ $REP_OCA_SERVER_TOOLS != "False" ]; then 196 | sudo su root -c "echo -n ',$OE_HOME/OCA/server-tools/addons' >> /etc/${OE_CONFIG}.conf" 197 | fi 198 | 199 | sudo su root -c "echo ' ' >> /etc/${OE_CONFIG}.conf" 200 | 201 | #logfile 202 | sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" 203 | sudo su root -c "echo 'logrotate = True' >> /etc/${OE_CONFIG}.conf" 204 | 205 | 206 | echo -e "* Change default xmlrpc port" 207 | sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" 208 | 209 | echo -e "* Create startup file" 210 | sudo su root -c "echo '#!/bin/sh' > $OE_HOME_EXT/start.sh" 211 | sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" 212 | sudo chmod 755 $OE_HOME_EXT/start.sh 213 | 214 | #-------------------------------------------------- 215 | # Adding ODOO as a deamon (initscript) 216 | #-------------------------------------------------- 217 | 218 | echo -e "* Create init file" 219 | cat < ~/$OE_CONFIG 220 | #!/bin/sh 221 | ### BEGIN INIT INFO 222 | # Provides: $OE_CONFIG 223 | # Required-Start: \$remote_fs \$syslog 224 | # Required-Stop: \$remote_fs \$syslog 225 | # Should-Start: \$network 226 | # Should-Stop: \$network 227 | # Default-Start: 2 3 4 5 228 | # Default-Stop: 0 1 6 229 | # Short-Description: Enterprise Business Applications 230 | # Description: ODOO Business Applications 231 | ### END INIT INFO 232 | PATH=/bin:/sbin:/usr/bin 233 | DAEMON=$OE_HOME_EXT/odoo-bin 234 | NAME=$OE_CONFIG 235 | DESC=$OE_CONFIG 236 | 237 | # Specify the user name (Default: odoo). 238 | USER=$OE_USER 239 | 240 | # Specify an alternate config file (Default: /etc/openerp-server.conf). 241 | CONFIGFILE="/etc/${OE_CONFIG}.conf" 242 | 243 | # pidfile 244 | PIDFILE=/var/run/\${NAME}.pid 245 | 246 | # Additional options that are passed to the Daemon. 247 | DAEMON_OPTS="-c \$CONFIGFILE" 248 | [ -x \$DAEMON ] || exit 0 249 | [ -f \$CONFIGFILE ] || exit 0 250 | checkpid() { 251 | [ -f \$PIDFILE ] || return 1 252 | pid=\`cat \$PIDFILE\` 253 | [ -d /proc/\$pid ] && return 0 254 | return 1 255 | } 256 | 257 | case "\${1}" in 258 | start) 259 | echo -n "Starting \${DESC}: " 260 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 261 | --chuid \$USER --background --make-pidfile \ 262 | --exec \$DAEMON -- \$DAEMON_OPTS 263 | echo "\${NAME}." 264 | ;; 265 | stop) 266 | echo -n "Stopping \${DESC}: " 267 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 268 | --oknodo 269 | echo "\${NAME}." 270 | ;; 271 | 272 | restart|force-reload) 273 | echo -n "Restarting \${DESC}: " 274 | start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ 275 | --oknodo 276 | sleep 1 277 | start-stop-daemon --start --quiet --pidfile \$PIDFILE \ 278 | --chuid \$USER --background --make-pidfile \ 279 | --exec \$DAEMON -- \$DAEMON_OPTS 280 | echo "\${NAME}." 281 | ;; 282 | *) 283 | N=/etc/init.d/\$NAME 284 | echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 285 | exit 1 286 | ;; 287 | 288 | esac 289 | exit 0 290 | EOF 291 | 292 | echo -e "* Security Init File" 293 | sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG 294 | sudo chmod 755 /etc/init.d/$OE_CONFIG 295 | sudo chown root: /etc/init.d/$OE_CONFIG 296 | 297 | 298 | 299 | echo -e "* Start ODOO on Startup" 300 | sudo update-rc.d $OE_CONFIG defaults 301 | 302 | echo -e "* Starting Odoo Service" 303 | sudo su root -c "/etc/init.d/$OE_CONFIG start" 304 | echo "-----------------------------------------------------------" 305 | echo "Done! The Odoo server is up and running. Specifications:" 306 | echo "Port: $OE_PORT" 307 | echo "User service: $OE_USER" 308 | echo "User PostgreSQL: $OE_USER" 309 | echo "Code location: $OE_USER" 310 | echo "Addons folder: $OE_USER/$OE_CONFIG/addons/" 311 | echo "Start Odoo service: sudo service $OE_CONFIG start" 312 | echo "Stop Odoo service: sudo service $OE_CONFIG stop" 313 | echo "Restart Odoo service: sudo service $OE_CONFIG restart" 314 | -------------------------------------------------------------------------------- /wkhtmltox-0.12.1_linux-trusty-amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elhamdaoui/Odoo-install/024e31184178093f8c920f0e0d70663ae5a93880/wkhtmltox-0.12.1_linux-trusty-amd64.deb -------------------------------------------------------------------------------- /wkhtmltox_0.12.5-1.bionic_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elhamdaoui/Odoo-install/024e31184178093f8c920f0e0d70663ae5a93880/wkhtmltox_0.12.5-1.bionic_amd64.deb -------------------------------------------------------------------------------- /wkhtmltox_0.12.5-1.bionic_amd64.deb.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elhamdaoui/Odoo-install/024e31184178093f8c920f0e0d70663ae5a93880/wkhtmltox_0.12.5-1.bionic_amd64.deb.1 --------------------------------------------------------------------------------