Ricerca nel sito web

Come installare ERPNext su Ubuntu 22.04


Questo tutorial esiste per queste versioni del sistema operativo

  • Ubuntu 22.04 (Jammy Jellyfish)
  • Ubuntu 18.04 (Bionic Beaver)

Su questa pagina

  1. Prerequisiti
  2. Per iniziare
  3. Installa e configura il database MariaDB
  4. Installa ERPNext su Ubuntu 22.04
  5. Configura ERPNext per l'ambiente di produzione
  6. Accedi all'interfaccia utente web di ERPNext
  7. Proteggi ERPNext con Lets Encrypt SSL
  8. Conclusione

ERPNext è un software ERP gratuito e open source utilizzato da produttori, distributori e servizi. È costruito con Python, JavaScript e Frappe Framework. È moderno, facile da usare, gratuito e progettato per le piccole e medie imprese che aiutano le aziende a gestire tutti gli aspetti delle loro operazioni commerciali. Migliaia di aziende in tutto il mondo lo utilizzano per gestire i propri processi ERP. È uno dei migliori sistemi ERP che supporta la produzione, la distribuzione, la vendita al dettaglio, il commercio, i servizi, l'istruzione, le organizzazioni non profit e altro ancora.

In questo tutorial ti mostreremo come installare il software ERPNext sul server Ubuntu 22.04.

Prerequisiti

  • Un server che esegue Ubuntu 22.04.
  • Un dominio valido è indirizzato al tuo server.
  • Una password di root è configurata sul tuo server.

Iniziare

Innanzitutto, dovrai installare alcune dipendenze Python sul tuo sistema. Puoi installarli tutti con il seguente comando:

apt-get install python3-dev libffi-dev git python3-pip python3-testresources libssl-dev wkhtmltopdf gcc g++ make python3.10-venv -y

Una volta installate tutte le dipendenze Python, dovrai installare Node.js sul tuo server.

Innanzitutto, aggiungi il repository Node.js con il seguente comando:

curl -sL https://deb.nodesource.com/setup_16.x | bash -

Successivamente, installa Node.js e il server Redis con il seguente comando:

apt-get install nodejs redis-server -y

Una volta installati entrambi i pacchetti, installa il pacchetto Yarn eseguendo il seguente comando:

npm install -g yarn

Una volta terminato, puoi procedere al passaggio successivo.

Installa e configura il database MariaDB

Per impostazione predefinita, MariaDB è disponibile nel repository predefinito di Ubuntu 22.04. Puoi installarlo con il seguente comando:

apt-get install mariadb-server -y

Una volta installato, proteggi MariaDB e imposta la password root di MariaDB con il seguente comando:

mysql_secure_installation

Rispondi a tutte le domande come mostrato di seguito per impostare la password di root di MariaDB e proteggere l'installazione:

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Una volta che MariaDB è protetto, accedi alla console MariaDB con il seguente comando:

mysql -u root -p

Successivamente, dovrai cambiare il formato del file MariaDB Innodb in Barracuda. Puoi farlo modificando il file /etc/mysql/mariadb.conf.d/50-server.cnf:

nano /etc/mysql/mariadb.conf.d/50-server.cnf

Aggiungi/Modifica le seguenti righe:

[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

Salva e chiudi il file, quindi riavvia il servizio MariaDB per implementare le modifiche:

systemctl restart mariadb

Installa ERPNext su Ubuntu 22.04

Innanzitutto, crea un nuovo utente per eseguire ERPNext utilizzando il seguente comando:

useradd -m -s /bin/bash erpnext

Successivamente, imposta la password per ERPNext con il seguente comando:

passwd erpnext

Successivamente, aggiungi l'utente ERPNext al gruppo sudo con il seguente comando:

usermod -aG sudo erpnext

Successivamente, accedi all'utente ERPNext e imposta la variabile di ambiente con il seguente comando:

su - erpnext
nano ~/.bashrc

Aggiungi la seguente riga:

PATH=$PATH:~/.local/bin/

Salvare il file quindi attivare la variabile d'ambiente con il seguente comando:

source ~/.bashrc

Quindi, crea una directory per ERPNext con il seguente comando:

sudo mkdir /opt/bench

Successivamente, imposta la proprietà sull'utente erpnext:

sudo chown -R erpnext:erpnext /opt/bench

Successivamente, modifica la directory in /opt/bench e clona il repository bench da Git Hub:

cd /opt/bench
git clone https://github.com/frappe/bench bench-repo

Successivamente, installa il repository bench usando il comando pip3:

pip3 install -e bench-repo

Una volta installato, inizializza la directory bench con il framework frappe usando il seguente comando:

bench init erpnext

Dovresti ottenere il seguente output:

? Built js/checkout.min.js
? Built js/dialog.min.js
? Built js/social.min.js
? Built js/web_form.min.js
? Built js/list.min.js
? Built js/chat.js
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
? Built css/frappe-rtl.css
? Built css/printview.css
? Built js/bootstrap-4-web.min.js
? Built js/barcode_scanner.min.js
? Built css/list.min.css
? Built css/report.min.css
? Built frappe/css/email.css
? Built js/frappe-recorder.min.js
? Built js/desk.min.js
? Built css/frappe-chat-web.css
? Built js/frappe-web.min.js
? Built css/form.min.css
? Built css/web_form.css
? Built css/desk.min.css
? Built css/frappe-web-b4.css
? Built js/control.min.js
? Built js/form.min.js
? Built js/data_import_tools.min.js
? Built js/report.min.js
?  Done in 111.35s
Done in 113.33s.
SUCCESS: Bench erpnext initialized

Successivamente, modifica la directory in erpnext e crea un nuovo sito ERPNext con il seguente comando:

cd /opt/bench/erpnext
bench new-site erp.example.com

Ti verrà chiesto di fornire la tua password di root MariaDB e la password di amministratore come mostrato di seguito:

MySQL root password: 

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Updating country info               : [========================================] 100%
Set Administrator password: 
Re-enter Administrator password: 
*** Scheduler is disabled ***
Current Site set to erp.example.com

A questo punto, ERPNext è installato nel tuo sistema.

Configurare ERPNext per l'ambiente di produzione

Successivamente, dovrai installare Supervisor per gestire il processo ERPNext e configurare Nginx come proxy inverso.

Innanzitutto, passa l'utente a ERPNext, quindi installa Supervisor e Nginx con il seguente comando:

su - erpnext
sudo apt-get install supervisor nginx -y

Quindi, installa frappe-bench con il seguente comando:

sudo pip3 install frappe-bench

Successivamente, modifica la directory in /opt/bench/erpnext e imposta ERPNext per l'ambiente di produzione con il seguente comando:

cd /opt/bench/erpnext
sudo /home/erpnext/.local/bin/bench setup production erpnext

Una volta configurato ERPNext, dovresti vedere il seguente output:

PLAY RECAP ************************************************************************************************************************************
localhost                  : ok=8    changed=4    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   

$ sudo systemctl restart supervisor
Port configuration list:

Site erp.example.com assigned port: 80
$ /usr/bin/supervisorctl reread
No config updates to processes
$ /usr/bin/supervisorctl update
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

A questo punto, ERPNext è configurato con Nginx per l'ambiente di produzione.

Accedi all'interfaccia utente web di ERPNext

Ora, apri il tuo browser web e digita l'URL http://erp.example.com. Verrai reindirizzato alla pagina di accesso di ERPNext:

Fornisci il nome utente come amministratore e una password che hai impostato in precedenza e fai clic sul pulsante Accedi. Dovresti vedere la seguente pagina:

Seleziona la lingua, il Paese, il fuso orario e la valuta desiderati e fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Fornisci il tuo nome, e-mail, password e fai clic sul pulsante Completa configurazione. Dovresti vedere la dashboard di ERPNext nella pagina seguente:

Proteggi ERPNext con Lets Encrypt SSL

Innanzitutto, dovrai installare il client Certbot per installare e gestire Lets Encrypt SSL. Puoi installarlo con il seguente comando:

sudo apt-get install certbot python3-certbot-nginx -y

Una volta installato, esegui il seguente comando per installare e configurare Lets Encrypt SSL per il tuo dominio:

sudo certbot --nginx -d erp.example.com

Ti verrà chiesto di fornire la tua email e di accettare i termini di servizio come mostrato di seguito:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for erp.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/erpnext.conf

Successivamente, seleziona se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Digita 2 e premi Invio per completare il processo. Dovresti vedere il seguente output:

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/erpnext.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://erp.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=erp.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/erp.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/erp.example.com/privkey.pem
   Your cert will expire on 2022-09-11. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot 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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

A questo punto, il tuo sito Web ERPNext è protetto con Lets Encrypt SSL. Ora puoi accedere al tuo sito Web in modo sicuro con il protocollo HTTPS.

Conclusione

Congratulazioni! hai installato con successo ERPNext con Nginx e Lets Encrypt SSL su Ubuntu 22.04. Non esitate a chiedermi se avete domande. Puoi visitare la pagina della documentazione ERPNext per ulteriori informazioni.