debian11 install python3.10 frappe erpnext
2 min read前言:
之前有记录过docker和工控机的安装方式,python的版本是3.9以下,新的frappe使用了新的python3.10版本,3.10以下的版本安装会失败。
系统环境:
VPS:6CPU 16RAM 操作系统:DEBIAN11
升级系统
#apt-get update -y ; apt-get upgrade -y
python3.10安装 请阅读此文章 《How to install Python 3.10 on Debian 11》
python3安装
#apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev libffi-dev libsqlite3-dev wget axel libbz2-dev -y
#wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
#tar xvf Python-3.10.6.tgz
#cd Python-3.10.6
#sudo ./configure --enable-optimizations
#sudo make install
#update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 1
#reboot
#apt-get install git python2-dev python3-dev python3-setuptools python3-pip python3-distutils redis-server -y
#apt install python3-venv -y
frappe-bench 安装
注意#root用户,$普通用户
#sudo usermod -aG sudo frappe
#sudo su - frappe
#apt install libssl-dev dirmngr xvfb libfontconfig wkhtmltopdf -y
$curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$sudo apt-get install nodejs -y
$sudo npm install -g yarn
$sudo pip3 install frappe-bench
$sudo pip install frappe-bench
$sudo apt-get update
#apt install redis-server
#systemctl enable –now redis-server.service
#apt install mariadb-server
#vim /etc/mysql/my.cnf //And add this configuration
[mysqld] port = 3706
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
#service mariadb restart
#mysql_secure_installation //初始化数据库,设置ROOT密码
#apt-get install mariadb-client
#apt install cron install nginx
#apt install libxrender1 libxext6 xfonts-75dpi xfonts-base fontconfig
#mkdier -p /work/frappe/
#chown -R username /work/frappe
$cd /work/frappe
$bench init frappe-bench
//安装ERPNEXT应用//
安装步骤
- bench init erpnext
初始化frappe基础应用目录,erpnext需要基于frappe框架,所以在安装erpnext应用时,必须现进行frappe框架的初始化。
-
cd erpnext
-
bench new-site erp.hyeos.net // 创建一个site,用于容纳erpnext应用。
or
bench new-site erp.hyeos.net --db-host hyeos.net --db-name erp --db-port 3706 -
编辑Procfile及sites/common_site_config.json文件更改端口(如不需默认端口或被占用)
-
sudo bench setup production username;//设置产品上线模式,启用生产环境
-
bench use erp.hyoes.net 设置默认网站目录
bench setup nginx //生成nginx配置文件
bench set-nginx-port erp.hyeos.net 443; //设置网站nginx访问端口
bench set-ssl-certificate erp.hyeos.net /etc/nginx/conf.d/ssl/certificate_bundle.crt //设置证书
bench set-ssl-key erp.hyeos.net /etc/nginx/conf.d/ssl/private.key //设置证书
或编辑sites/erp.hyeos.net/site_config.json
"ssl_certificate": "/etc/letsencrypt/live/example.com/fullchain.pem",
"ssl_certificate_key": "/etc/letsencrypt/live/example.com/privkey.pem" -
bench get-app payments; bench get-app erpnext https://github.com/frappe/erpnext.git //注意要先下载payments,否则在下载安装erpnext时会提示找不到payments
-
bench install-app erpnext //将erpnext应用安装道site下
-
bench --site erp.hyeos.net add-to-hosts 将erpnext.text域名绑定到本地。
10.screen -S bench
11.bench start //启动应用。
12.bench setup nginx; bench setup supervisor //设置修改config目录下的nginx为自己所需的,如证书端口号等,然后设置supervisor接管erpnext的启动
13./etc/init.d/supervisor restart
//末//
bench config dns_multitenant on`
汉化
bench get-app https://gitee.com/yuzelin/erpnext_chinese.git
bench install-app erpnext_chinese
bench migrate
sudo /etc/init.dsupervisor restart