人财事物信息化 - ERPNext安装指南

甲、【Server】安装Frappe/ERPNext

Ubuntu 24.04 server 64bit (2核 | 2GiB)

  1. 在Ubuntu上创建新用户
  2. #fr为[frappe-user]可自定义#
    sudo adduser fr
    sudo usermod -a -G sudo fr
    su fr
    cd
  3. 更新和升级包
  4. sudo apt-get update && sudo apt-get upgrade -y
  5. 安装python和setuptools以及开发环境
  6. sudo apt-get install git curl python3-dev python3-venv python3-setuptools python3-pip xvfb libfontconfig wkhtmltopdf libmysqlclient-dev redis-server mariadb-server mariadb-client software-properties-common python3-testresources cron nano -y
  7. 安装和设置MySql Server
  8. sudo mysql_secure_installation
    * Enter your current password for root (enter for none):
    * Switch to unix_socket authentication [Y/n] n
    * Change the root password? [Y/n] Y
    * 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

    Thanks for using MariaDB!
    创建新站点时需要输入root password
  9. 编辑 MySql 配置文件
  10. sudo nano /etc/mysql/my.cnf
    复制下面的部分并粘贴到您的配置文件中
    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_unicode_ci

    [mysql]
    default-character-set = utf8mb4
    按[ctrl]+[S]保存,再按[Ctrl]+[X]退出
  11. 设置pip加速镜像(可略过)
  12. pip config set global.index-url https://mirrors.huaweicloud.com/repository/pypi/simple
    pip config set install.trusted-host mirrors.huaweicloud.com
  13. 安装node
  14. sudo apt install nodejs
    node -v
    v18.19.1
    NOTE:如果报错,请参考文末doubao回复。
  15. 安装NPM
  16. sudo apt install npm
  17. 设置NPM加速镜像(可略过)
  18. sudo npm config set registry https://registry.npmmirror.com -g
  19. 安装 yarn
  20. sudo npm install -g yarn
  21. 设置yarn加速镜像(可略过)
  22. yarn config set registry https://registry.npmmirror.com --global
  23. 安装frappe-bench
  24. sudo pip3 install frappe-bench --break-system-packages
  25. 初始化frappe-bench
  26. bench init --frappe-branch version-15 french --frappe-path=https://gitee.com/feesow/frappe --verbose
  27. 将权限应用于用户目录
  28. cd french
    sudo chmod -R o+rx /home/fr
  29. 创建新站点
  30. bench new-site shudou
    #shudou为[site-name]可自定义#
    MySQL root password:

    Set Administrator password:
    #root password为第4步安装数据库时输入密码
    #初始化网站时管理员密码
  31. 设置默认站点
  32. bench use shudou
  33. 安装ERPNext
  34. bench get-app --branch version-15 erpnext https://gitee.com/feesow/erpnext
    bench install-app erpnext
  35. 设置生产环境
  36. sudo bench setup production fr
    #建议用户名手工输入#
    NOTE:如果报错,请参考文末doubao回复。
  37. 自定义会计科目表与多版本财务报表
  38. bench get-app accounting_cn https://gitee.com/feesow/ShudouCN
    bench install-app accounting_cn
  39. 如果需要可视化分析,可安装Frappe Insights
  40. bench get-app insights https://gitee.com/ShudouCN/insights
    bench install-app insights
    NOTE:如果报错,请参考文末doubao回复。

乙、【Browser】初始化配置

  1. 浏览器访问公网IP
  2. 登录网站管理员账号
  3. 用户名:administrator
    密码:(甲、15步)
  4. 切换语言为中文
  5. 创建用户
  6. 设置公司、会计科目表
  7. 设置您的系统……
  8. 设置完成,跳转主页

报错时的解决方法:

  • 甲、7

  • Expected version ">=18". Got "12.22.9"
    #如果版本报错,则按以下步骤重装:
    sudo apt remove nodejs
    sudo apt autoremove
    curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
    sudo apt-get install nodejs -y
    node -v
  • 甲、18

  • bench.exceptions.CommandFailedError: sudo /usr/bin/python3 -m pip install ansible
    1. 使用 apt 安装 ansible
    2. 要是你使用的是基于 Debian 或 Ubuntu 的系统,可借助 apt 来安装 ansible,这样能避免破坏系统的 Python 环境。

      sudo apt update && sudo apt install ansible

    3. 创建虚拟环境
    4. 你可以创建一个 Python 虚拟环境,然后在该环境中安装 ansible。

      • 创建虚拟环境
      • python3 -m venv myenv
      • 激活虚拟环境
      • source myenv/bin/activate
      • 在虚拟环境中安装 ansible
      • pip install ansible
      • 退出虚拟环境
      • deactivate
    5. 使用 pipx 安装 ansible
    6. pipx 能够在独立的虚拟环境中安装 Python 应用程序,防止破坏系统的 Python 环境。

      • 安装 pipx
      • sudo apt install pipx && pipx ensurepath
      • 使用 pipx 安装 ansible
      • pipx install ansible
  • 甲、20

  • 安装insights时如果内存不足可启用SWAP

    free -h && sudo swapon /swapfile

    1. 创建swap文件(推荐方案)
    2. 如果需要创建新的swap文件,请按以下步骤操作(以创建4GB swap为例):
      # 检查是否有足够的磁盘空间
      df -h /
      # 创建swap文件(4GB)
      sudo fallocate -l 4G /swapfile
      # 设置文件权限
      sudo chmod 600 /swapfile
      # 格式化为swap格式
      sudo mkswap /swapfile
      # 激活swap
      sudo swapon /swapfile
      # 验证是否成功
      swapon --show
      
    3. 永久启用swap(可选)
    4. 如果希望系统重启后自动启用swap,需要修改fstab文件:
      sudo nano /etc/fstab
      
      在文件末尾添加一行:
      /swapfile none swap sw 0 0
      
      保存并退出(按`Ctrl+X`,输入`Y`,回车)。
    5. 验证swap是否正常工作
    6. 创建并激活swap后,可以通过以下命令检查:
      # 查看swap使用情况
      free -h
      # 查看swap状态
      cat /proc/swaps
      
Discard
Save
Review Changes ← Back to Content
Message Status Space Raised By Last update on