概述
⚡️ 如果搭建测试环境,只需要配置一.安装操作系统和四.安装以下软件包即可。
一.安装操作系统
安装 debian8.0 jessie 作为erp.rd.in.linx运行的基本系统。
二.配置ceph
⚡️ 如果是搭建测试环境,跳过此步骤
root@runner:/home/sg-os# apt-get install ceph ceph-common ceph-fuse libcephfs1 python-ceph
⚡️ ceph配置文件以及key文件 os.conf data2T.keyring 向ceph维护人员索取
查看key:
root@runner:/home/sg-os# cat data2T.keyring [client.data2T] key = AQD8irBVqTj+BBAAbyr//+tNfBtwWH4mts8uqg== caps mon = "allow r" caps osd = "allow class-read object_prefix rbd_children, allow rwx pool=data2T"
查看data2T池:
root@runner:/home/sg-os# rbd ls -p data2T --id data2T -k data2T.keyring -c linxos.conf data2T1
查看这个块设备文件的信息
root@runner:/home/sg-os# rbd --image data2T1 -p data2T --id data2T -k data2T.keyring -c linxos.conf info rbd image 'data2T1': size 2050 GB in objects order 22 (4096 kB objects) block_name_prefix: rb.0.5e4d.2ae8944a format: 1
root@runner:/home/sg-os# rbd map data2T1 -p data2T --id data2T -c linxos.conf -k data2T.keyring
root@runner:/home/sg-os# mount /dev/rbd0 /opt
将配置文件放到正确的位置
root@runner:/home/sg-os# cp data2T.keyring /etc/ceph/ceph.keyring root@runner:/home/sg-os# cp linxos.conf /etc/ceph/ceph.conf
修改/etc/ceph/rbdmap文件,添加下面内容
data2T/data2T1 id=data2T,keyring=/etc/ceph/ceph.keyring
修改/etc/fstab文件,添加下面内容
/dev/rbd/data2T/data2T1 /opt xfs defaults,_netdev 0 0
重启服务器验证配置是否正确
root@runner:/home/sg-os# reboot
使用mount命令查看是否正确挂载
root@runner:/home/sg-os# mount |grep /opt /dev/rbd0 on /opt type xfs (rw,relatime,attr2,inode64,sunit=8192,swidth=8192,noquota,_netdev)
三.配置Postgresql数据库
⚡️ 如果搭建测试环境,跳过此步骤
root@runner:/home/sg-os# apt-get install 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
登录postgres用户
root@runner:/home/sg-os# su - postgres
进入数据库
postgres@runner:~$ psql
查看数据存放的目录
postgres=# show data_directory; data_directory \---------------- /opt/main (1 行记录)
四.安装以下软件包
Odoo 是一套开源的ERP系统,企业级的管理软件
1.1 下载最新版本的Odoo
下载地址:http://172.16.0.239/gitlab-ci//?C=M;O=D
1.2 查看Odoo软件包的依赖
root@runner:/home/sg-os# dpkg -I odoo_8.0.0~d666e50_amd64.deb 新格式的 debian 软件包,格式版本 2.0。 大小 字节:主控包= 字节。 69 字节, 3 行 conffiles 1589 字节, 22 行 control 字节,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: 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).
1.3 安装软件包依赖
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 , `
1.4 安装Odoo
root@runner:/home/sg-os# dpkg -i odoo_8.0.0~d666e50_amd64.deb
pip:python的包管理软件,pysftp:python通过pysftp加密上传、下载ftp服务器文件,pysftp是通过python中的pip管理软件来安装的
2.1 安装pip
root@runner:/home/sg-os# apt-get install python-pip python-dev
2.2 安装pysftp
⚡️ 在Odoo中Database Auto-backup这个模块中,其中连接外部的SFTP服务器时,使用到了pysftp
root@runner:/home/sg-os# pip install pysftp
3.1 获取软件包
这个软件包需要找特殊的管理者获取
3.2 安装生成序列号的软件
root@runner:/home/sg-os# dpkg -i pylinxgensn_2.0_amd64.deb
wkhtmltopdf是一个通过webkit浏览器把网页生成pdf的开源组件,把HTML文档转成PDF文档的工具,可以跟多种脚本语言进行集成来转换文档。
4.1 下载wkhtmltopdf
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
4.2 安装wkhtmltopdf
root@runner:/home/sg-os# dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
qrtools是生成二维码的工具。
5.1 安装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
⚡️ Odoo的端口号为8069,程序名为python,Postgresql的端口号5432,程序名为postgres,如下图所示
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 172.16.0.24:48065 CLOSE_WAIT 7410/python tcp 0 0 127.0.0.1:8069 127.0.0.1:44677 ESTABLISHED 7410/python tcp 0 0 127.0.0.1:44679 127.0.0.1:8069 ESTABLISHED 1126/iceweasel tcp 0 1 172.16.0.148:57362 74.125.204.91:443 SYN_SENT 1126/iceweasel tcp 0 1 172.16.0.148:42566 74.125.204.93:443 SYN_SENT 1126/iceweasel tcp 0 0 172.16.0.148:22 172.16.0.20:38966 ESTABLISHED 12234/sshd: sg-os [ tcp 0 0 127.0.0.1:8069 127.0.0.1:44679 ESTABLISHED 7410/python tcp6 0 0 :::22 :::* LISTEN 2775/sshd tcp6 0 0 ::1:631 :::* LISTEN 977/cupsd tcp6 0 0 ::1:5432 :::* LISTEN 5819/postgres
配置数据库权限:
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 -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 :~linxerp.bak . root@linx:/home/sg-os# psql -U postgres -d linxerp < linxerp.bak
重启服务:
root@linx:/home/sg-os# /etc/init.d/odoo restart
⚡️ 这时本地的odoo系统环境与服务器上的odoo系统环境一致
五.配置Odoo的数据库
页面中的选项解释:
Master password?*默认admin帐户的密码为admin,不需要修改此项,默认即可Select a database name?*输入数据库的名称,此项必须填写Load demonstration data?*是否加载demo数据,此项不需要加载Default language?*根据你的需要选择一种语言Choose a password?*admin帐户的新密码Confirm password?*重复输入一次密密码
填写页面中的内容,如下图所示:
[外链图片转存失败(img-OFL8ockI-41)(images/create_database.png)]
[外链图片转存失败(img-4HQowmEx-42)(images/odoo_init.png)]
六.更改Odoo的端口号
端口号由8069改为80,使其在浏览器中不需要输入端口号,直接输入IP地址就可以访问网页:
root@runner:/home/sg-os# vi /etc/rc.local
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069
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
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/211548.html原文链接:https://javaforall.net
