ERPNext是一个开源的企业资源规划(ERP)软件,它是使用Frappé框架构建的,该框架是用Python编写的。它是一个基于 Web 的应用程序,可用于管理各种业务运营,包括财务会计、库存管理和客户关系管理。ERPNext的设计易于使用且高度可定制,使其成为各种规模企业的热门选择。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 ERPNext
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
<span class="pln">sudo apt update sudo apt upgrade sudo apt install python3</span><span class="pun">-</span><span class="pln">dev libffi</span><span class="pun">-</span><span class="pln">dev git python3</span><span class="pun">-</span><span class="pln">pip python3</span><span class="pun">-</span><span class="pln">testresources libssl</span><span class="pun">-</span><span class="pln">dev wkhtmltopdf gcc g</span><span class="pun">++</span><span class="pln"> make python3</span><span class="pun">.</span><span class="lit">10</span><span class="pun">-</span><span class="pln">venv </span><span class="pun">-</span><span class="pln">y</span>
第 2 步。安装节点.js。
默认情况下,Node.js 在 Ubuntu 22.04 基本存储库中不可用。现在运行以下命令,将 NodeSource 存储库添加到您的 Ubuntu 系统中:
<span class="pln">wget </span><span class="pun">-</span><span class="pln">qO</span><span class="pun">-</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//deb.nodesource.com/setup_16.x | sudo -E bash</span>
将 NodeSource 存储库添加到系统后,使用 Apt 包管理器安装 Node.js 和 Redis:
<span class="pln">sudo apt install nodejs redis</span><span class="pun">-</span><span class="pln">server </span><span class="pun">-</span><span class="pln">y</span>
确认已安装最新的 LTS 版本并运行以下命令:
<span class="pln">node </span><span class="pun">-</span><span class="pln">v</span>
此外,您可以使用以下命令检查 NPM 的版本:
<span class="pln">npm </span><span class="pun">-</span><span class="pln">v</span>
安装两个包后,通过运行以下命令安装 Yarn 包:
<span class="pln">npm install </span><span class="pun">-</span><span class="pln">g yarn</span>
有关安装 Node.js 的其他资源,请阅读下面的帖子:
- 如何在 Ubuntu Linux √ 上安装 Node.js
第 3 步。安装 MariaDB。
默认情况下,MariaDB 在 Ubuntu 22.04 基本存储库上可用。现在运行以下命令将最新版本的MariaDB安装到您的Ubuntu系统中:
<span class="pln">sudo apt install mariadb</span><span class="pun">-</span><span class="pln">server mariadb</span><span class="pun">-</span><span class="pln">client</span>
成功安装后,启用 MariaDB(在系统启动时自动启动)、启动并使用以下命令验证状态:
<span class="pln">sudo systemctl enable mariadb sudo systemctl start mariadb sudo systemctl status mariadb</span>
确认安装并检查已安装的 MariaDB 构建版本:
<span class="pln">mariadb </span><span class="pun">--</span><span class="pln">version</span>
默认情况下,MariaDB 未强化。您可以使用脚本保护 MariaDB。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MariaDB的访问权限:mysql_secure_installation
<span class="pln">mysql_secure_installation</span>
像这样配置它:
<span class="pun">-</span> <span class="typ">Set</span><span class="pln"> root password</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> anonymous users</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Disallow</span><span class="pln"> root login remotely</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> test database </span><span class="kwd">and</span><span class="pln"> access to it</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y </span><span class="pun">-</span> <span class="typ">Reload</span><span class="pln"> privilege tables now</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y</span>
您现在可以使用新密码连接到 MariaDB 服务器:
<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>
接下来,您需要将MariaDB InnoDB文件格式更改为梭子鱼。您可以通过编辑文件来做到这一点:/etc/mysql/mariadb.conf.d/50-server.cnf
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">mariadb</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="lit">50</span><span class="pun">-</span><span class="pln">server</span><span class="pun">.</span><span class="pln">cnf</span>
添加以下行:
<span class="pun">[</span><span class="pln">mysqld</span><span class="pun">]</span><span class="pln"> innodb</span><span class="pun">-</span><span class="pln">file</span><span class="pun">-</span><span class="pln">format</span><span class="pun">=</span><span class="pln">barracuda innodb</span><span class="pun">-</span><span class="pln">file</span><span class="pun">-</span><span class="pln">per</span><span class="pun">-</span><span class="pln">table</span><span class="pun">=</span><span class="lit">1</span><span class="pln"> innodb</span><span class="pun">-</span><span class="pln">large</span><span class="pun">-</span><span class="pln">prefix</span><span class="pun">=</span><span class="lit">1</span><span class="pln"> character</span><span class="pun">-</span><span class="kwd">set</span><span class="pun">-</span><span class="pln">client</span><span class="pun">-</span><span class="pln">handshake </span><span class="pun">=</span><span class="pln"> FALSE character</span><span class="pun">-</span><span class="kwd">set</span><span class="pun">-</span><span class="pln">server </span><span class="pun">=</span><span class="pln"> utf8mb4 collation</span><span class="pun">-</span><span class="pln">server </span><span class="pun">=</span><span class="pln"> utf8mb4_unicode_ci</span>
保存并关闭文件,然后重新启动 MariaDB 服务以实现更改:
<span class="pln">sudo systemctl restart mariadb</span>
有关安装 MariaDB 的其他资源,请阅读以下帖子:
- 如何在 Ubuntu Linux √ 上安装 MariaDB
第 4 步。在 Ubuntu 22.04 上安装 ERPNext。
在安装之前,现在我们使用以下命令创建一个新用户来运行 ERPNext:
<span class="pln">useradd </span><span class="pun">-</span><span class="pln">m </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">bash erpnext</span>
接下来,使用以下命令设置 ERPNext 的密码:
<span class="pln">passwd erpnext usermod </span><span class="pun">-</span><span class="pln">aG sudo erpnext</span>
之后,登录到 ERPNext 用户并使用以下命令设置环境变量:
<span class="pln">su </span><span class="pun">-</span><span class="pln"> erpnext nano </span><span class="pun">~/.</span><span class="pln">bashrc</span>
添加以下行:
<span class="pln">PATH</span><span class="pun">=</span><span class="pln">$PATH</span><span class="pun">:~</span><span class="str">/.local/</span><span class="pln">bin</span><span class="pun">/</span>
保存文件,然后使用以下命令激活环境变量:
<span class="pln">source </span><span class="pun">~/.</span><span class="pln">bashrc</span>
接下来,使用以下命令为 ERPNext 创建一个目录:
<span class="pln">sudo mkdir </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">bench</span>
接下来,将所有权设置为 erpnext 用户:
<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R erpnext</span><span class="pun">:</span><span class="pln">erpnext </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">bench</span>
接下来,将目录更改为 GitHub 并从 GitHub 克隆工作台存储库:/opt/bench
<span class="pln">cd </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">bench git clone https</span><span class="pun">:</span><span class="com">//github.com/frappe/bench bench-repo</span>
接下来,使用 pip3 命令安装工作台存储库:
<span class="pln">pip3 install </span><span class="pun">-</span><span class="pln">e bench</span><span class="pun">-</span><span class="pln">repo</span>
安装后,使用以下命令使用 frappe 框架初始化工作台目录:
<span class="pln">bench init erpnext</span>
接下来,将目录更改为 erpnext,并使用以下命令创建一个新的 ERPNext 站点:
<span class="pln">cd </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">bench</span><span class="pun">/</span><span class="pln">erpnext bench </span><span class="kwd">new</span><span class="pun">-</span><span class="pln">site your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com</span>
系统将要求您提供MariaDB根密码和管理员密码,如下所示:
<span class="typ">MySQL</span><span class="pln"> root password</span><span class="pun">:</span> <span class="typ">Installing</span><span class="pln"> frappe</span><span class="pun">...</span> <span class="typ">Updating</span> <span class="typ">DocTypes</span> <span class="kwd">for</span><span class="pln"> frappe </span><span class="pun">:</span> <span class="pun">[========================================]</span> <span class="lit">100</span><span class="pun">%</span> <span class="typ">Updating</span><span class="pln"> country info </span><span class="pun">:</span> <span class="pun">[========================================]</span> <span class="lit">100</span><span class="pun">%</span> <span class="typ">Set</span> <span class="typ">Administrator</span><span class="pln"> password</span><span class="pun">:</span> <span class="typ">Re</span><span class="pun">-</span><span class="pln">enter </span><span class="typ">Administrator</span><span class="pln"> password</span><span class="pun">:</span> <span class="pun">***</span> <span class="typ">Scheduler</span> <span class="kwd">is</span><span class="pln"> disabled </span><span class="pun">***</span> <span class="typ">Current</span> <span class="typ">Site</span> <span class="kwd">set</span><span class="pln"> to your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com</span>
第5步。配置 ERPNext。
现在我们管理 ERPNext 流程并将 Nginx 配置为反向代理:
<span class="pln">su </span><span class="pun">-</span><span class="pln"> erpnext sudo apt</span><span class="pun">-</span><span class="kwd">get</span><span class="pln"> install supervisor nginx </span><span class="pun">-</span><span class="pln">y</span>
接下来,使用以下命令安装冰沙工作台:
<span class="pln">sudo pip3 install frappe</span><span class="pun">-</span><span class="pln">bench</span>
接下来,使用以下命令将目录更改为生产环境的 ERPNext 并设置 ERPNext:/opt/bench/erpnext
<span class="pln">cd </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">bench</span><span class="pun">/</span><span class="pln">erpnext sudo </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">erpnext</span><span class="pun">/.</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">bench setup production erpnext</span>
输出:
<span class="pln">PLAY RECAP </span><span class="pun">************************************************************************************************************************************</span><span class="pln"> localhost </span><span class="pun">:</span><span class="pln"> ok</span><span class="pun">=</span><span class="lit">8</span><span class="pln"> changed</span><span class="pun">=</span><span class="lit">4</span><span class="pln"> unreachable</span><span class="pun">=</span><span class="lit">0</span><span class="pln"> failed</span><span class="pun">=</span><span class="lit">0</span><span class="pln"> skipped</span><span class="pun">=</span><span class="lit">1</span><span class="pln"> rescued</span><span class="pun">=</span><span class="lit">0</span><span class="pln"> ignored</span><span class="pun">=</span><span class="lit">0</span><span class="pln"> $ sudo systemctl restart supervisor </span><span class="typ">Port</span><span class="pln"> configuration list</span><span class="pun">:</span> <span class="typ">Site</span><span class="pln"> your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com assigned port</span><span class="pun">:</span> <span class="lit">80</span><span class="pln"> $ </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">supervisorctl reread </span><span class="typ">No</span><span class="pln"> config updates to processes $ </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">supervisorctl update $ sudo </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nginx </span><span class="pun">-</span><span class="pln">t nginx</span><span class="pun">:</span><span class="pln"> the configuration file </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf syntax </span><span class="kwd">is</span><span class="pln"> ok nginx</span><span class="pun">:</span><span class="pln"> configuration file </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf test </span><span class="kwd">is</span><span class="pln"> successful $ sudo systemctl reload nginx</span>
第 6 步。配置防火墙。
现在我们使用 ERPNext 设置了一个简单防火墙 (UFW),以允许在默认 Web 端口 80 上进行公共访问:
<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln"> sudo ufw allow </span><span class="str">'Nginx Full'</span><span class="pln"> sudo ufw enable</span>
步骤 7.访问 ERPNext Web 界面。
成功安装后,打开您的 Web 浏览器并使用 URL 访问 ERPNext Web UI。您将被重定向到以下页面:http://your-domain.com
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 ERPNext。有关其他帮助或有用信息,我们建议您查看ERPNext官方网站。