Ubuntu20安装erpnext13的完全教程 100%安装成功
为了更好的安装erpnext13,我们先做好以下基础工作
第一步:更新host
主要原因是github国内很多地方访问比较慢,经常连接不上,根据自己服务器地理位置,选择最快的节点
sudo vi /etc/hosts #使用编辑器修改host文件,也可以使用nano、vim等其他编辑器 #添加以下内容 192.30.255.112 github.com 185.199.111.133 raw.githubusercontent.com
第二部:更新Ubuntu源
ubuntu源中增加国内的源一般多为阿里云的源
编辑源列表文件
命令如下:
sudo vi /etc/apt/sources.list #使用编辑器修改sources.list文件,也可以使用nano、vim等其他编辑器 #添加以下内容 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
执行以下两个更新源和软件 sudo apt-get update #更新源 sudo apt-get upgrade #更新软件
步骤如下
- 准备一台装好ubuntu20.04的服务器,本地虚拟机或者VPS皆可
- 通过ssh登录root用户,不会的度娘
- 最好替换源,阿里华为的都行,不会的度娘
- apt update && apt upgrade -y && shutdown -r now
更新并重启 - curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash –
下载node.js
- apt install -y nodejs mariadb-server redis-server python3-pip nginx python3-testresources wkhtmltopdf
安装操作系统级依赖
- adduser USERNAME
注:用户名USERNAME换成自己计划使用的用户名,如果直接使用已存在且有sudo权限的账号,这一步和下面这一步就可跳过
- usermod -aG sudo USERNAME
记得把命令行里的USERNAME改成自己刚设置的
- nano /etc/mysql/my.cnf
用nano编辑my.cnf文件,nano比vi好用,将光标移动到最后空白行,复制以下文本内容,ctrl + O,回车确认,ctrl + X返回命令行
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
- service mysql restart
重启sql
- mysql_secure_installation
mysql的安全配置,第一个输入数据库密码对话框出来的时候,直接敲回车代表没有密码,剩下的按照下图选择
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
- mysql -u root -p
输入上面新设置的数据库root账号密码,进入数据库命令行,并执行下面的语句
USE mysql;
UPDATE user SET plugin=' ' WHERE user ='root';
FLUSH PRIVILEGES;
exit;
- 【重要】关闭ssh终端,重新以自己“新创建的用户名”和密码登录
- sudo npm install -g yarn
安装yarn
- node -v && npm -v && python3 -V && pip3 -V && yarn -v
查看版本,对照一下,这一步不做也行
- pip3 install frappe-bench
安装bench,即erpnext系统的命令行管理工具,类似windows系统的程序管理器。
- sudo pip3 install frappe-bench
原文有,感觉和上一步重复了,论坛解释:安装bench框架中一部分依赖包需要root权限。
- sudo apt install git
这一步原文没有,不安装git下一步bench init会报错缺少git
- bench init –frappe-branch version-13 frappe –frappe-path=https://gitee.com/phipsoft/frappe
使用bench命令安装frappe框架,记得把myfrappe改成自己想要的名字,这一步时间比较长,别着急,常见问题是代码托管网站github下载速度慢不稳定,如果网络超时失败,可重新运行该命令,重新运行之前需使用命令
rm -r frappe
删除之前生成的目录,如果有国内码云的同步代码库,可改为由码云库安装,添加参数–frappe-path=https://gitee.com/xxxx/frappe, 将xxxx换成代码库名。更多其它命令参数可通过 –help选项查询,如 bench init –help - cd frappe
进入bench目录,同样记得改名
- bench new-site myerpsite
新建站点,名字自己取,安装时会提示输入数据库root账号, 新站点数据库及erp系统管理员账号administator 密码,其中数据库root账号密码须与上述数据库安装时密码一致,其它密码自己取 –db-password xxx 也可以命令行参数中直接输入好密码,–mariadb-root-password yyyy –admin-password zzzz
- bench get-app –branch version-13 erpnext
下载erpnext,这一步时间也长点 国内源bench get-app –branch version-13 erpnext https://gitee.com/phipsoft/erpnext
- bench install-app erpnext
安装erpnext
- sudo bench setup production USERNAME
设置为生产环境,即用supervisorctl管理所有进程,使用nginx做反向代表,USERNAME换成第7步新建的账号,大功告成
附注:安装ebclocal汉化APP
- bench get-app –branch master https://gitee.com/yuzelin/ebclocal.git
获取APP
- bench install-app ebclocal
安装APP
- 用浏览器(推荐 Chrome或Firefox)输入IP或域名,登录系统,用户名administrator,密码是第21步admin-password密码。
- bench get-app –branch master https://gitee.com/yuzelin/ebclocal.git
参考文档:
https://gitee.com/yuzelin/erpnext-chinese-docs/blob/master/%E5%AE%89%E8%A3%85%E6%96%87%E6%A1%A3/%E5%9F%BA%E4%BA%8Eubuntu20.04%E5%AE%89%E8%A3%85ERPNext%20Version-13%20%E6%96%B0%E6%89%8B%E7%89%88.md
https://erpgulf.com/blog/support-forum/installing-erpnext-version-13-on-ubuntu-2010-20