概述
部署环境
系统:Debian 8 最小化安装
内存:4G
硬盘:40G
参考官方论坛:Debian\ubuntu上源码安装GoodERP
GoodERP 需要准备 由于 GoodERP 是基于 Odoo 做的二次开发,故此可以参考 Odoo 的源码搭建文档。
Python 2.7
PostgreSQL
Nodejs
切换国内163源 1 2 3 4 5 6 7 8 9 10 11 cat <<EOF | sudo tee /etc/apt/sources.list deb http://mirrors.163.com/debian/ jessie main non-free contrib deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib deb-src http://mirrors.163.com/debian/ jessie main non-free contrib deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib EOF sudo apt update && sudo apt -y upgrade
安装必要的软件
注意:由于使用了 nodesource.com 的安装脚本,建议搭建翻墙环境运行以下命令
1 2 3 4 5 6 7 8 9 10 11 12 13 sudo apt install -y curl wget git vim unzip python python-setuptools\ && curl -sL https://bootstrap.pypa.io/get-pip.py | sudo -E python - \ && curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - \ && sudo apt-get install -y nodejs \ && sudo npm config set registry https://registry.npm.taobao.org \ && sudo npm install -g less \ && sudo apt-get -y build-dep python-lxml \ && sudo apt-get -y install libldap2-dev libsasl2-dev \ && curl -o wkhtmltox.deb -SL http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb \ && echo '40e8b906de658a2221b15e4e8cd82565a47d7ee8 wkhtmltox.deb' | sha1sum -c - \ && sudo dpkg --force-depends -i wkhtmltox.deb \ && sudo apt-get -y install -f --no-install-recommends
PostgreSQL 安装 通过 apt-get 安装 PostgreSQL 1 sudo apt-get install -y postgresql postgresql-server-dev-9.4
配置 PostgreSQL 1 sudo -u postgres createuser --createdb --no-createrole --no-superuser --pwprompt good #创建数据库用户good,输入两次密码good
GoodERP 安装 步骤1:新建 good 用户 1 2 3 sudo adduser good sudo su good cd ~
步骤2:从 Github 中下载 GoodERP 源代码 1 2 3 git clone http://github.com/osbzr/gooderp_addons git clone http://github.com/osbzr/base exit
步骤3:修改 pip 源为国内源(豆瓣) 1 2 3 4 5 sudo mkdir ~/.pip cat <<EOF | sudo tee ~/.pip/pip.conf [global] index-url = https://pypi.douban.com/simple EOF
步骤4:使用 pip 安装 GoodERP 的 Python 模块(这里的过程会很漫长) 1 2 sudo pip install -r base/requirements.txt -i https://pypi.douban.com/simple \ && sudo pip install simplejson httplib2 -i https://pypi.douban.com/simple
配置 GoodERP 编辑 ~/gooderp.conf 1 2 3 4 5 6 7 cat <<EOF | tee ~/gooderp.conf [options] db_user = good db_password = good addons_path = /home/good/gooderp_addons logfile = /home/good/gooderp.log EOF
开机启动 1. 创建服务文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 cat <<EOF | sudo tee /etc/systemd/system/gooderp.service [Unit] Description=GoodERP Documentation=http://www.gooderp.org/ After=network.target postgresql.service [Service] # Ubuntu/Debian convention: Type=simple User=good ExecStart=/usr/bin/python /home/good/base/odoo-bin -c /home/good/gooderp.conf [Install] WantedBy=multi-user.target EOF
2. 让配置文件生效 1 sudo systemctl daemon-reload
3.设置开机启动 1 2 3 sudo systemctl enable gooderp.service sudo systemctl enable postgresql.service sudo systemctl start gooderp.service