CentOS 6.5 Python+PostGreSql环境搭建(openerp 7.0)

正式站点服务器更换,现在需要把原本运行在Ubuntu上的开源ERP软件openerp 7.0迁移到新的CentOS 6.5的服务器上。

第一次在生产环境上配置Linux,学习到好多东西,记录一下,方便以后会用到(比如.net core)。 

同时也分享一下迁移过程中学到的东西。需要有Linux基本操作基础。

常用

yum命令是在Fedora和RedHat以及SUSE中基于rpm的软件包管理器,它可以使系统管理人员交互和自动化地更细与管理RPM软件包,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软体包,无须繁琐地一次次下载、安装。yum详解

yum install 包名

yum remove 包名

Ubuntu

apt-get install 

wget命令 可以把网络地址中的文件下载到当前目录中

wget https://pypi.python.org/packages/90/bf/9da959928a4f212c56e0b31299ef1d28e3b2457b484cb9dfc8df23258235/aetros-0.14.2.tar.gz

还有两个解压命令

tar xzvf 压缩包名 解压路径(不填则解压到当前目录)

tar xzvf aetros-0.14.2.tar.gz 

unzip 需要先安装 yum -y install wget unzip

unzip 包名字


安装openerp 的Python环境

yum -y install python-psycopg2 python-lxml PyXML python-setuptools libxslt-python pytz \
python-matplotlib python-babel python-mako python-dateutil python-psycopg2 \
pychart pydot python-reportlab python-devel python-imaging python-vobject \
hippo-canvas-python mx python-gdata python-ldap python-openid \
python-werkzeug python-vatnumber pygtk2 glade3 pydot python-dateutil \
python-matplotlib pygtk2 glade3 pydot python-dateutil python-matplotlib \
python python-devel python-psutil python-docutils make\
automake gcc gcc-c++ kernel-devel byacc flashplugin-nonfree poppler-utils pywebdav

安装PIP   PyPA推荐的安装Python软件包的工具

安装pip
$ curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.45.tar.gz
$ tar -xzvf distribute-0.6.45.tar.gz
$ cd distribute-0.6.45
$ sudo python setup.py install
$ sudo easy_install pip

安装完成之后可以使用

pip install Python软件包

pip uninstall Python软件包

easy_install  包名

某些包找不到的话需要下载后手动安装

推荐的下载地址

https://pypi.python.org/pypi

https://pypi.python.org/simple/

解压并进入安装目录后

python setup.py install 执行安装

安装PostgreSQL

yum -y install postgresql92-libs postgresql92-server postgresql92

初始化PostgreSQL数据库

service postgresql-9.2 initdb
chkconfig postgresql-9.2 on
service postgresql-9.2 start
su - postgres -c "createuser --superuser openerp"

PostgreSQL的备份和还原

  1. 切换到数据库用户: sudo su - postgres
  2. 备份数据: pg_dump testdb > testdb.out

利用备份文件,恢复数据库:
  1. 切换到数据库用户: sudo su - postgres
  2. 停止openerp: service openerp stop
  3. 删除旧的数据库:dropdb testdb
  4. 新建数据库,并关联到openerp用户:createdb -O openerp  testdb
  5. 导入之前备份过的数据:psql -d testdb -f testdb.out

从中发现的问题

1 安装openerp时 提示Python包版本号不对或引用不存在

反复使用pip install yun install easy_install  和手动下载安装


2 Ubuntu中的postgresql启动配置和CentOS不一致。这导致openerp 需要

/var/run/postgresql/.s.PGSQL.5432而Linux命令行需要/tmp/.s.PGSQL.5432

不然报错: [归档 (db)] 与数据库 "Test" 联接失败: 无法联接到服务器: 没有那个文件或目录

服务器是否在本地运行并且在 Unix 域套接字"/tmp/.s.PGSQL.5432"上准备接受联接?

目前想让openerp运行起来需要改动/var/lib/pgsql/9.2/data/postgresql.conf

unix_socket_directory = ' /var/run/postgresql '
# (改动需要重启数据库) service postgresql9.2 restart
想从命令行操作数据库需要注释这一行.

导致问题是要么openerp报错.要么命令行报错

目前没有找到解决办法。


参照

openerp数据备份与恢复 

http://blog.csdn.net/huguohuan/article/details/38362567

openerp 7.0 centos 一键安装 shell 

http://www.codeweblog.com/openerp-7-0-centos-%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85-shell-%E8%BD%AC%E8%87%AAopenerp%E8%AE%BA%E5%9D%9B/

openerp7.0官方教程(for ubuntu) 

https://doc.odoo.com/7.0/install/linux/postgres/

openerp备份恢复数据库 master password 

http://blog.csdn.net/uhml/article/details/51731004?locationNum=3&fps=1

猜你喜欢

转载自blog.csdn.net/canyanol/article/details/79210550