配置ubuntu 14.04.3 LTS odoo 9.0开发环境

使用VMware Fusion 8.0.1创建ubuntu 64bit虚拟机:
使用ubuntu-14.04.3-desktop-amd64.iso镜像缺省安装ubuntu,用户名odoo,密码123456

安装open vm tools:
使用odoo/123456登录ubuntu桌面,打开Terminal窗口,执行下述命令安装open vm tools:
sudo apt-get install open-vm-toolbox

安装输入法框架fcitx替换IBUS

打开Ubuntu Software Center,搜索fcitx google,点击搜索结果中的Flexible Input Method Framework和Fcitx wrapper for Google Pinyin IM engine分别安装,到Ubuntu的System Settings ­> Language Support 修改底部的 Keyboard input method 从 IBus 改为 fcitx,重启计算机后,到Ubuntu的System Settings ­> Text Entry取消下面的Show current input source in the menu bar复选框。

点击标题栏上的键盘图标,选Configure菜单,点击下面的+号按钮,去掉Only Show Current Language选择,在Search Input Method文本框中输入google,然后选择上面的Google Pinyin行,点击OK按钮完成添加。

安装ubuntu最新更新:

sudo apt-get update && sudo apt-get upgrade

安装git:

sudo apt-get install git

创建源码目录:

mkdir ~/odoo-dev

进入目录,获取odoo 9.0最新源码,但不要历史更新内容:

cd ~/odoo-dev

git clone https://github.com/odoo/odoo.git -b 9.0 --depth 1

安装依赖库:

./odoo/odoo.py setup_deps

安装配置pg数据库:

./odoo/odoo.py setup_pg

安装nodejs、node-less

这一步不能忘掉,否则将来登录Odoo帐套时,界面中会有报错信息:Could not execute command lessc

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install node-less

安装wkhtmltopdf和中文字体:

sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb #下载wkhtmltopdf,注意根据操作系统选择相应版本
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb #安装wkhtmltopdf
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf #安装完成后将可执行文件复制到usr/bin中
sudo chown root:root /usr/bin/wkhtmltopdf #更改所有者为root用户
sudo chmod +x /usr/bin/wkhtmltopdf #并增加可执行属性
wkhtmltopdf www.baidu.com ~/baidu.pdf #打印一个网页到home目录,如果成功生成pdf则表明安装成功
sudo apt-get install ttf-wqy-zenhei #安装中文字体
sudo apt-get install ttf-wqy-microhei #安装中文字体

安装pycharm5:

先安装java JDK

sudo apt-add-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

从 http://www.jetbrains.com/pycharm/download/ 下载最新的Pycharm 5.0.3

在终端中进入Pycharm的下载目录,输入命令 tar xfz pycharm-*.tar.gz,将Pycharm文件夹解压到当前目录

找到bin文件夹运行pycharm.sh

在安装过程中,指定License server address: http://idea.lanyus.com 你懂得

安装完后,如果你不喜欢pycharm的即时保存,可以参考这里: PyCharm 4.5.4 环境配置

如果没有将IBus输入法框架变为fcitx,在启动pycharm时可能遇到:

IBus prior to 1.5.11 may cause input problems. See IDEA-78860 for details.Do not show again.

请到Ubuntu的System Settings ­> Language Support 修改底部的 Keyboard input method 从 ibus 改为 none.

安装pgAdmin3:

sudo apt-get install pgadmin3

设置postgres用户密码:

切换到ubuntu下postgres用户,登录postgres数据库

sudo -u postgres psql postgres

在postgres=#提示符下执行

alter user postgres with password 'postgres';

启动pgadmin3

添加本地数据库配置,Name随便写,Host输入localhost,Port输入5432,Maintenance DB和Username、Password都是postgres

生成odoo运行配置文件:

在~/odoo-dev/odoo目录下建立myaddons目录,用于保存自定义开发的插件

从odoo/debian目录复制openerp-server.conf到odoo目录,修改其中的内容:

[options]
addons_path = /home/odoo/odoo-dev/odoo/openerp/addons,/home/odoo/odoo-dev/odoo/addons,/home/odoo/odoo-dev/odoo/myaddons
admin_passwd = admin
csv_internal_sep = ,
data_dir = /home/odoo/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_template = template1
db_user = False
dbfilter = .*
debug_mode = False
demo = {}
dev_mode = False
email_from = False
geoip_database = /usr/share/GeoIP/GeoLiteCity.dat
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = None
logrotate = False
longpolling_port = 8072
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = None
proxy_mode = False
reportgz = False
server_wide_modules = None
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_commit = False
test_enable = False
test_file = False
test_report_directory = False
translate_modules = ['all']
unaccent = False
without_demo = False
workers = 0
xmlrpc = True
xmlrpc_interface =
xmlrpc_port = 8069
timezone = Asia/Shanghai

配置pycharm调试

启动PyCharm,打开C:\odoo\odoo-8.0,等待几分钟indexing完成
菜单Run-->Edit Configurations…
添加python configuration
Name: odoo
Script: /home/odoo/odoo-dev/odoo/odoo.py
Script parameters: --config=/home/odoo/odoo-dev/odoo/openerp-server.conf
Working directory: /home/odoo/odoo-dev/odoo

还要打开openerp目录下的__init__.py文件,注释掉evented = False下面的两行:

#MODBEGIN
#必须移除下面的语句,否则无法Debug。

#if sys.modules.get("gevent") is not None:
# evented = True

#MODEND

命令行启动odoo

~/odoo-dev/odoo/odoo.py --config=/home/odoo/odoo-dev/odoo/openerp-server.conf

然后浏览器访问localhost:8069

 

 

 

可能用到的:

重设ubuntu的root密码:

sudo passwd root

查看进程#ID:

ps -A 

杀掉进程:

kill #ID

保存当前odoo配置到home目录.openerp-serverrc文件  

~/odoo-dev/odoo/odoo.py --save --stop-after-init

查看该文件 

more ~/.openerp_serverrc  # show the configuration file

生成新模块 

~/odoo-dev/odoo/odoo.py scaffold newmodulename /home/odoo/odoo-dev/odoo/myaddons

 

本文参考了:

  • Odoo Development Essentials
  • http://blog.csdn.net/wangnan537/article/details/48895897
  • http://www.maiziedu.com/group/article/9952/
  • http://qiaolevip.iteye.com/blog/2264038
  • http://www.wangting.name/?p=193
  • http://www.wangting.name/?cat=4

 

你可能感兴趣的:(配置ubuntu 14.04.3 LTS odoo 9.0开发环境)