1.安装Postgresql
root@runner:/home/sg-os# apt-get install postgresql
2 . 配置postgresql
拷贝/var/lib/postgresql/9.4/main到/opt目录下
root@runner:/home/sg-os# rsync -aHq /var/lib/postgresql/9.4/main /opt
使postgresql数据库的数据存储在/opt/main目录下,修改/etc/postgresql/9.4/main/postgresql.conf文件,修改如下
data_directory = '/var/lib/postgresql/9.4/main'
修改为:
data_directory = '/opt/main'
重启服务
root@runner:/home/sg-os# /etc/init.d/postgresql restart
3 .验证数据库的数据存储路径
登录postgres用户
root@runner:/home/sg-os# su - postgres
进入数据库
postgres@runner:~$ psql
查看数据存放的目录
postgres=# show data_directory;
data_directory
\----------------
/opt/main
(1 行记录)
1 . Odoo
Odoo 是一套开源的ERP系统,企业级的管理软件
下载地址:https://www.odoo.com/zh_CN/thanks/download
root@runner:/home/sg-os# dpkg -I odoo_8.0.0~d666e50_amd64.deb
新格式的 debian 软件包,格式版本 2.0。
大小 52940614 字节:主控包=415637 字节。
69 字节, 3 行 conffiles
1589 字节, 22 行 control
1608573 字节,14320 行 md5sums
1173 字节, 42 行 * postinst #!/bin/sh
866 字节, 43 行 * postrm #!/bin/sh
163 字节, 7 行 * prerm #!/bin/sh
Package: odoo
Version: 8.0.0~d666e50
Architecture: amd64
Maintainer: Odoo S.A.
Installed-Size: 320654
Depends: adduser, postgresql-client, python, python-dateutil, python-decorator, python-docutils, python-feedparser, python-imaging, python-jinja2, python-ldap, python-libxslt1, python-lxml, python-mako, python-mock, python-openid, python-passlib, python-psutil, python-psycopg2, python-pybabel, python-pychart, python-pydot, python-pyparsing, python-pypdf, python-reportlab, python-requests, python-simplejson, python-tz, python-unittest2, python-vatnumber, python-vobject, python-werkzeug, python-xlwt, python-yaml
Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils
Conflicts: openerp, openerp-server, openerp-web, tinyerp-server
Replaces: openerp, openerp-server, openerp-web, tinyerp-server
Section: net
Priority: optional
Homepage: http://www.odoo.com/
Description: Open Source Apps To Grow Your Business
Odoo, formerly known as OpenERP, is a suite of open-source business apps
written in Python and released under the AGPL license. This suite of
applications covers all business needs, from Website/Ecommerce down to
manufacturing, inventory and accounting, all seamlessly integrated. Odoo's
technical features include a distributed server, flexible workflows, an object
database, a dynamic GUI, customizable reports, and an XML-RPC interface. Odoo
is the most installed business software in the world. It is used by 2.000.000
users worldwide ranging from very small companies (1 user) to very large ones
(300 000 users).
root@runner:/home/sg-os# apt-get install `echo "adduser, postgresql-client, python, python-dateutil, python-decorator, python-docutils, python-feedparser, python-imaging, python-jinja2, python-ldap, python-libxslt1, python-lxml, python-mako, python-mock, python-openid, python-passlib, python-psutil, python-psycopg2, python-pybabel, python-pychart, python-pydot, python-pyparsing, python-pypdf, python-reportlab, python-requests, python-simplejson, python-tz, python-unittest2, python-vatnumber, python-vobject, python-werkzeug, python-xlwt, python-yaml, antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils" | tr -d , `
root@runner:/home/sg-os# dpkg -i odoo_8.0.0~d666e50_amd64.deb
2 .Pysftp 和pip的安装
root@runner:/home/sg-os# apt-get install python-pip python-dev
:zap: 在Odoo中Database Auto-backup
这个模块中,其中连接外部的SFTP服务器时,使用到了pysftp
root@runner:/home/sg-os# pip install pysftp
wkhtmltopdf是一个通过webkit浏览器把网页生成pdf的开源组件,把HTML文档转成PDF文档的工具,可以跟多种脚本语言进行集成来转换文档。
root@runner:/home/sg-os# wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
root@runner:/home/sg-os# dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
qrtools是生成二维码的工具。
root@runner:/home/sg-os# apt-get install python-qrtools
root@runner:/home/sg-os# /etc/init.d/postgresql restart
root@runner:/home/sg-os# /etc/init.d/odoo restart
root@本地:/home/sg-os# netstat -tnpla
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8069 0.0.0.0:* LISTEN 7410/python
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2775/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 977/cupsd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 5819/postgres
tcp 0 0 127.0.0.1:44677 127.0.0.1:8069 ESTABLISHED 1126/iceweasel
tcp 1 0 172.16.0.148:8069
tcp 0 0 127.0.0.1:8069
root@linx:/home/sg-os# vi /etc/postgresql/9.4/main/pg_hba.conf
#修改文件中USER为postgres的METHOD为trust,把peer改为trust,修改为下面的样子:
local all postgres trust
#重启服务
root@linx:/home/sg-os# /etc/init.d/postgresql restart
root@linx:/home/sg-os# su - postgres
postgres@linx:~$ createdb linxerp
postgres@linx:~$ psql
postgres=# alter datebase linxerp owner to odoo;
postgres=# \q
导出服务器上的数据库:
jjli@Linx:~$ ssh sg-os@erp.rd.in.linx -lroot
root@runner:/home/sg-os# pg_dump -U postgres linxerp >/home/sg-os/linxerp.bak
导入服务器上的数据库到本地数据库中:
#把服务器上的linxerp.bak文件拷贝到本地
root@linx:/home/sg-os# scp -r sg-os@erp.rd.in.linx:~linxerp.bak .
root@linx:/home/sg-os# psql -U postgres -d linxerp < linxerp.bak
重启服务:
root@linx:/home/sg-os# /etc/init.d/odoo restart
:zap: 这时本地的odoo系统环境与服务器上的odoo系统环境一致
页面中的选项解释:
Master password
:默认admin帐户的密码为admin,不需要修改此项,默认即可 Select a database name
:输入数据库的名称,此项必须填写 Load demonstration data
:是否加载demo数据,此项不需要加载 Default language
:根据你的需要选择一种语言 Choose a password
:**admin帐户的新密码 Confirm password
:重复输入一次密密码 端口号由8069改为80,使其在浏览器中不需要输入端口号,直接输入IP地址就可以访问网页:
1 . 打开配置文件
root@runner:/home/sg-os# vi /etc/rc.local
2 .把如下代码写入文件,并保存
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069
3 .重启系统
root@runner:/home/sg-os# reboot
root@runner:/home/sg-os# cd /usr/lib/python2.7/dist-packages/openerp/addons
把您编写的模块目录拷贝到当前目录即可
root@runner:/usr/lib/python2.7/dist-packages/openerp/addons# /etc/init.d/odoo restart
4.1 网址为http://erp.rd.in.linx 登录admin用户,然后点击左边的菜单栏中的用户,如下图所示:
4.2 然后点击Administrator用户,页面跳转,如下图所示:
4.3 然后点击编辑,把技术特性选项打上勾,如下图所示:
4.4 最后点击保存,然后按F5刷新页面,页面跳转,如下图所示:
点击左侧菜单中的更新模块列表选项,然后点击更新,如下图所示:
6.1 点击左侧菜单中的本地模块,如下图所示:
6.2 然后在搜索栏中输入你需要安装的模块的名称,如下图所示:
6.3 我们需要安装的一共有5个模块,如下图的5个模块,依次安装: