在 Ubuntu 24.04 LTS 中的安装ERPNext 笔记 Step by Step
ERPNext 在 Ubuntu 24.04 LTS 中的安装笔记 Step by Step
文章目录 | Table of Contents
- ERPnext 简介
- 先决条件
- 安装步骤
- 总结 & 引用
先决条件 | Prerequisites
系统环境要求
- Ubuntu 24.04
- A user with sudo privileges
- Python 3.11+
- pip 20+
- MariaDB 10.3.x
- Node.js 18
- Yarn 1.12+
硬件要求
- 2 Process 2 Core
- 4GB ram
- 40GB Storage
- Intenet
安装步骤 | Installtion Steps
包升级和创建新用户
Update and Upgrade Packages
sudo apt-get update -y && sudo apt-get upgrade -y
Create a New user
sudo adduser **Your-user-name** #Fill in the information as prompted sudo usemod -aG sudo **Your-user-name** su **Your-user-name** #Enter your password cd ~
安装环境需要的包
Install Git
sudo apt-get install git -y
Install Python Dependencies
sudo apt-get install python3-dev -y sudo apt-get install python3-setuptools -y sudo apt-get install python3-pip -y sudo apt install python3.12-venv -y
Install MariaDB and Configuration it
sudo apt-get install software-properties-common -y sudo apt install mariadb-server -y sudo mysql_secure_installtion
在执行
mysql_secure_installtion
之后请按以下步骤设置- 设置root密码
- 删除 anonymous users
- 允许root 远程登录
- 删除test database
Reload privilege tables
编辑 MariaDB 配置文件
sudo cp /etc/mysql/my.cnf /opt/my.cnf.back sudo nano /etc/mysql/my.cnf #ctrl +x y save sudo systemctl restart mariadb
在my.cnf最末行添加如下内容
[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 [mysql] default-character-set = utf8mb4
Install Redis Server
sudo apt-get install redis-server -y
Install CURL, Node.js, NPM, and Yarn and wkhtmltopdf
#CURL sudo apt install curl #Node js curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash source ~/.profile nvm install 18 #NPM sudo apt-get install npm -y #Yarn sudo npm install -g yarn -y #wkhtmltopdf sudo apt-get install xvfb libfontcofig wkhtmltopdf -y
Setting Up Frappe Bench
Install Frappe Bench
sudo -H pip3 install frappe-bench --break-system-packages sudo -H pip3 install ansible --break-system-packages
Initialize Frappe Bench
bench init frappe-bench --frappe-branch version-15 ls cd frappe-bench #change directory permissions chmod -R o+rx /home/**Your-erp-users**
Create a New site
bench new-site **site-name** #enter you database root password #setings Administrator password
Install ERPnext APPS
bench get-app payments bench get-app --branch version-15 erpnext bench --site **site-name** install-app erpnext bench use **site-name**
启用调度程序并禁用维护模式
bench --site [site-name] enable-scheduler
- 启用 ERPNext 站点的后台任务调度程序。
- ERPNext 依赖调度程序执行定时任务(如生成报告、发送邮件、处理队列任务等)。
- 如果不启用调度程序,某些功能可能无法正常工作。
bench --site [site-name] set-maintenance-mode off
- 将站点从维护模式切换到正常模式。
- 在维护模式下,站点对普通用户不可用,只有管理员可以访问。
- 关闭维护模式后,站点恢复正常运行,用户可以访问。
配置生产环境
sudo bench setup production **erp-user**
- 将 ERPNext 配置为生产模式。
该命令会:
- 配置 Gunicorn(用于处理 Python 请求的 WSGI 服务器)。
- 配置 Supervisor(用于管理后台进程)。
- 确保站点在生产环境中以最佳性能运行。
[**erp-user**]
是运行 Frappe/ERPNext 的系统用户(通常为frappe
)。
bench setup nginx
- 配置 Nginx 作为反向代理服务器。
- Nginx 负责处理外部请求并将其转发给 Gunicorn。
- 该命令会自动生成 Nginx 配置文件并启用站点。
sudo supervisorctl restart all
- 重启所有由 Supervisor 管理的进程。
- 确保所有服务(如 Gunicorn、后台工作进程等)使用最新的配置。
sudo bench setup production **erp-user**
(重复)- 再次运行以确保所有生产配置已正确应用。
访问站点
- 在生产模式下,ERPNext 通过 Nginx 提供服务,默认使用 HTTP(80 端口)或 HTTPS(443 端口)。
- 你可以直接通过服务器的 IP 地址或域名访问站点,无需指定端口号(如
http://your-server-ip
)。
总结 和 引用 | Conclusion & References
References:
How to Install ERPNext Version 15 on Ubuntu 24.04: A Step-by-Step Guide -
https://syncbricks.com/how-to-install-erpnext-version-15-on-ubuntu-24-04-a-step-by-step-guide/
Youtube - https://www.youtube.com/watch?v=Q9D2wbrC6i8
Chat GPT & DeepSeek