Cómo instalar Odoo 16 en Ubuntu 22.04/20.04/18.04 |
Odoo es un conjunto de aplicaciones empresariales basadas en web de código abierto gestionadas desde una única consola. Hay una variedad de aplicaciones comerciales disponibles en Odoo que incluyen CRM de código abierto, creador de sitios web, comercio electrónico, gestión de almacenes, gestión de proyectos, facturación y contabilidad, punto de venta, recursos humanos, marketing, fabricación, gestión de compras, entre otras. En este artículo profundizaremos en la instalación y configuración de Odoo en Ubuntu Linux con los certificados SSL Let's Encrypt.
Las aplicaciones empresariales de Odoo se pueden instalar y utilizar como aplicaciones independientes, pero también se integran perfectamente para que obtengas un ERP de código abierto con todas las funciones cuando instalas varias aplicaciones. Esta guía también cubrirá cómo configurar Nginx Proxy con el certificado SSL Let's Encrypt, pero se puede utilizar cualquier otro certificado SSL personalizado, autofirmado o firmado por una CA conocida.
Paso 1: actualice el sistema Ubuntu
Siempre comenzamos nuestras instalaciones con la actualización del sistema y la actualización de todos los paquetes instalados.
sudo apt update && sudo apt upgrade -y
Espere a que se actualicen todos los paquetes y luego reinicie el sistema. Esto es necesario cuando hay actualizaciones del kernel.
[ -f /var/run/reboot-required ] && sudo reboot -f
Paso 2: Instale el servidor de base de datos PostgreSQL
Odoo requiere un servidor de base de datos donde se almacenan los datos. Instalaremos la versión predeterminada del servidor PostgreSQL disponible en los repositorios ascendentes de Ubuntu.
Para instalar la versión predeterminada disponible en los repositorios de Ubuntu. correr:
sudo apt install postgresql postgresql-client -y
Después de la instalación, se inicia el servicio de base de datos.
$ systemctl status postgresql*
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Tue 2023-08-22 16:58:28 UTC; 1min 53s ago
Process: 2862 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 2862 (code=exited, status=0/SUCCESS)
CPU: 3ms
Aug 22 16:58:28 jammy systemd[1]: Starting PostgreSQL RDBMS...
Aug 22 16:58:28 jammy systemd[1]: Finished PostgreSQL RDBMS.
● [email - PostgreSQL Cluster 14-main
Loaded: loaded (/lib/systemd/system/[email ; enabled-runtime; vendor preset: enabled)
Active: active (running) since Tue 2023-08-22 16:58:28 UTC; 1min 53s ago
Process: 2839 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 14-main start (code=exited, status=0/SUCCESS)
Main PID: 2844 (postgres)
Tasks: 7 (limit: 18678)
Memory: 18.0M
CPU: 370ms
CGroup: /system.slice/system-postgresql.slice/[email
├─2844 /usr/lib/postgresql/14/bin/postgres -D /var/lib/postgresql/14/main -c config_file=/etc/postgresql/14/main/postgresql.conf
├─2846 "postgres: 14/main: checkpointer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
├─2847 "postgres: 14/main: background writer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
├─2848 "postgres: 14/main: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
├─2849 "postgres: 14/main: autovacuum launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
├─2850 "postgres: 14/main: stats collector " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
└─2851 "postgres: 14/main: logical replication launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
Aug 22 16:58:26 jammy systemd[1]: Starting PostgreSQL Cluster 14-main...
Aug 22 16:58:28 jammy systemd[1]: Started PostgreSQL Cluster 14-main.
Paso 3: instale wkhtmltopdf en Ubuntu
wkhtmltopdf es necesario para imprimir informes, ya que realiza la conversión de html a pdf. La versión de wkhtmltopdf disponible en los repositorios de Ubuntu no admite encabezados ni pies de página, por lo que no se utiliza como una dependencia directa.
- Instale wkhtmltopdf y wkhtmltoimage en Ubuntu/Linux
Paso 4: Instale Odoo 16 en Ubuntu
Importar clave GPG del repositorio APT
curl -fsSL https://nightly.odoo.com/odoo.key|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/odoo.gpg
Agregue el repositorio deb de Odoo para que pueda instalar Odoo en el sistema Ubuntu Linux.
echo "deb http://nightly.odoo.com/16.0/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list
Actualice el caché de Apt e instale Odoo en el sistema Ubuntu.
sudo apt update && sudo apt install odoo
Acepta iniciar la instalación:
...
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
bzip2 docutils-common file fonts-font-awesome fonts-inconsolata fonts-liberation fonts-roboto-unhinted fonts-urw-base35 graphviz gsfonts javascript-common libann0 libc-ares2
libcairo2 libcdt5 libcgraph6 libdatrie1 libdeflate0 libev4 libgd3 libgomp1 libgraphite2-3 libgts-0.7-5 libgts-bin libgvc6 libgvpr2 libharfbuzz0b libice6 libimagequant0
libjbig0 libjpeg8 libjs-jquery libjs-underscore liblab-gamut1 liblcms2-2 libltdl7 libopenjp2-7 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1
libpathplan4 libpixman-1-0 libraqm0 libsass1 libsm6 libthai-data libthai0 libtiff5 libwebp7 libwebpdemux2 libwebpmux3 libxaw7 libxcb-render0 libxcb-shm0 libxmu6 libxpm4
libxt6 mailcap mime-support python3-appdirs python3-bs4 python3-cached-property python3-dateutil python3-decorator python3-defusedxml python3-docopt python3-docutils
python3-freezegun python3-gevent python3-greenlet python3-html5lib python3-isodate python3-ldap python3-libsass python3-lxml python3-num2words python3-ofxparse
python3-olefile python3-passlib python3-pil python3-polib python3-psutil python3-psycopg2 python3-pydot python3-pygments python3-pyinotify python3-pypdf2 python3-qrcode
python3-renderpm python3-reportlab python3-reportlab-accel python3-requests-file python3-requests-toolbelt python3-roman python3-soupsieve python3-stdnum python3-usb
python3-vobject python3-webencodings python3-werkzeug python3-xlrd python3-xlsxwriter python3-xlwt python3-zeep python3-zope.event sgml-base xml-core
Suggested packages:
bzip2-doc fonts-freefont-otf | fonts-freefont-ttf fonts-texgyre graphviz-doc apache2 | lighttpd | httpd libgd-tools liblcms2-utils docutils-doc fonts-linuxlibertine
| ttf-linux-libertine texlive-lang-french texlive-latex-base texlive-latex-recommended python-gevent-doc python-greenlet-dev python-greenlet-doc python3-genshi
python-lxml-doc python-pil-doc python-polib-doc python-psutil-doc python-psycopg2-doc python-pygments-doc ttf-bitstream-vera python-pyinotify-doc pdf-viewer
python3-egenix-mxtexttools python-reportlab-doc python-stdnum-doc ipython3 python-werkzeug-doc python3-watchdog python-xlrt-doc sgml-base-doc debhelper
The following NEW packages will be installed:
bzip2 docutils-common file fonts-font-awesome fonts-inconsolata fonts-liberation fonts-roboto-unhinted fonts-urw-base35 graphviz gsfonts javascript-common libann0 libc-ares2
libcairo2 libcdt5 libcgraph6 libdatrie1 libdeflate0 libev4 libgd3 libgomp1 libgraphite2-3 libgts-0.7-5 libgts-bin libgvc6 libgvpr2 libharfbuzz0b libice6 libimagequant0
libjbig0 libjpeg8 libjs-jquery libjs-underscore liblab-gamut1 liblcms2-2 libltdl7 libopenjp2-7 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1
libpathplan4 libpixman-1-0 libraqm0 libsass1 libsm6 libthai-data libthai0 libtiff5 libwebp7 libwebpdemux2 libwebpmux3 libxaw7 libxcb-render0 libxcb-shm0 libxmu6 libxpm4
libxt6 mailcap mime-support odoo python3-appdirs python3-bs4 python3-cached-property python3-dateutil python3-decorator python3-defusedxml python3-docopt python3-docutils
python3-freezegun python3-gevent python3-greenlet python3-html5lib python3-isodate python3-ldap python3-libsass python3-lxml python3-num2words python3-ofxparse
python3-olefile python3-passlib python3-pil python3-polib python3-psutil python3-psycopg2 python3-pydot python3-pygments python3-pyinotify python3-pypdf2 python3-qrcode
python3-renderpm python3-reportlab python3-reportlab-accel python3-requests-file python3-requests-toolbelt python3-roman python3-soupsieve python3-stdnum python3-usb
python3-vobject python3-webencodings python3-werkzeug python3-xlrd python3-xlsxwriter python3-xlwt python3-zeep python3-zope.event sgml-base xml-core
0 upgraded, 110 newly installed, 0 to remove and 3 not upgraded.
Need to get 231 MB of archives.
After this operation, 1,065 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
El servicio se inicia automáticamente después de la instalación de Odoo en Ubuntu:
$ systemctl status odoo
● odoo.service - Odoo Open Source ERP and CRM
Loaded: loaded (/lib/systemd/system/odoo.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-08-22 17:06:40 UTC; 12s ago
Main PID: 5798 (odoo)
Tasks: 4 (limit: 18678)
Memory: 75.8M
CPU: 1.566s
CGroup: /system.slice/odoo.service
└─5798 /usr/bin/python3 /usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log
Aug 22 17:06:40 jammy systemd[1]: Started Odoo Open Source ERP and CRM.
Configure el servicio para que se inicie cada vez que reinicie el sistema.
$ sudo systemctl enable --now odoo
enabled
El servicio se inicia en el puerto 8069. Esto se puede confirmar usando el siguiente comando.
$ ss -tunelp | grep 8069
tcp LISTEN 0 128 0.0.0.0:8069 0.0.0.0:* uid:113 ino:1906251 sk:d <->
Paso 5: Configurar el proxy Nginx para Odoo
Instale el servidor web Nginx en su sistema Ubuntu:
sudo apt -y install vim nginx
Hay dos escenarios para la configuración del proxy Nginx: con HTTPS y cuando el tráfico no se sirve a través de una conexión segura. En esta sección, consideraremos ambas configuraciones.
Configurar el proxy HTTP Nginx para Odoo
Cree un nuevo archivo de configuración para odoo.
sudo vim /etc/nginx/conf.d/odoo.conf
Modifique este fragmento de configuración para que se ajuste a su configuración.
# Odoo Upstreams
upstream odooserver {
server 127.0.0.1:8069;
}
server {
listen 80;
server_name erp.computingforgeeks.com;
access_log /var/log/nginx/odoo_access.log;
error_log /var/log/nginx/odoo_error.log;
# Proxy settings
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# Request for root domain
location / {
proxy_redirect off;
proxy_pass http://odooserver;
}
# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odooserver;
}
# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
Mi dominio de servicio en este ejemplo es erp.computingforgeeks.com, reemplácelo con su dominio correcto para usar con Odoo. También se requiere un registro DNS válido para el acceso externo.
Verifique su sintaxis de configuración:
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Si la configuración se considera correcta, reinicie el servicio nginx.
sudo systemctl restart nginx
No debería aparecer ningún error al reiniciar.
$ systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-08-22 17:07:55 UTC; 50s ago
Docs: man:nginx(8)
Process: 6270 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 6271 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 6364 (nginx)
Tasks: 5 (limit: 18678)
Memory: 4.8M
CPU: 86ms
CGroup: /system.slice/nginx.service
├─6364 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─6366 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─6367 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
├─6368 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
└─6369 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Aug 22 17:07:54 jammy systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 22 17:07:55 jammy systemd[1]: Started A high performance web server and a reverse proxy server.
Usando el certificado SSL Let's Encrypt
Siempre se recomienda utilizar cifrado SSL para implementaciones de producción. Let's Encrypt es una oferta SSL gratuita que puede utilizar en su configuración.
Instalar la herramienta certbot:
sudo apt install certbot
Obtenga certificados SSL Let's Encrypt para su dominio.
sudo certbot --nginx
Si la ejecución se realizó, se imprimirán las rutas a los archivos certificado y cadena.
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/erp.computingforgeeks.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/erp.computingforgeeks.com/privkey.pem
Your cert will expire on 2020-01-17. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew *all* of your certificates, run
"certbot-auto renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
Cree cron para renovar el certificado.
$ sudo crontab -e
15 3 * * * /usr/bin/certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"
Después de esto, los certificados se agregarán automáticamente a su configuración de Nginx. Si ya tenía los certificados generados para su nombre de dominio, puede modificar su configuración y agregarlos como se muestra:
sudo vim /etc/nginx/conf.d/odoo.conf
Modifique a continuación y agréguelo al archivo.
# Odoo Upstreams
upstream odooserver {
server 127.0.0.1:8069;
}
# http to https redirection
server {
listen 80;
server_name erp.computingforgeeks.com;
return 301 https://erp.computingforgeeks.com$request_uri;
}
server {
listen 443 ssl;
server_name erp.computingforgeeks.com;
access_log /var/log/nginx/odoo_access.log;
error_log /var/log/nginx/odoo_error.log;
# SSL
ssl_certificate /etc/letsencrypt/live/erp.computingforgeeks.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/erp.computingforgeeks.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/erp.computingforgeeks.com/chain.pem;
# Proxy settings
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# Request for root domain
location / {
proxy_redirect off;
proxy_pass http://odooserver;
}
# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odooserver;
}
# Gzip Compression
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
No olvide sustituir erp.computingforgeeks.com por su nombre de dominio.
Reinicie Nginx.
sudo systemctl restart nginx
Paso 6: Acceda a la interfaz web de Odoo
Acceda a la página web de Odoo en su nombre de dominio desde un navegador web.
Ingrese los detalles requeridos para crear la base de datos. Después de hacer clic en "Crear base de datos", será redirigido a la página de Administración desde donde podrá instalar las aplicaciones comerciales de Odoo.
Si configuró https, la página debe cargarse a través de un túnel seguro.
Visite la página de documentación de Odoo para obtener más información.
Guías similares:
- Instale Odoo en CentOS 8 con Let's Encrypt SSL