我的编程空间,编程开发者的网络收藏夹
学习永远不晚

Installing Odoo 8 on

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

Installing Odoo 8 on

This tutorial will walk you through the process of installing the latest version of Odoo on CentOS 6. It is intended for those who might not be experienced Linux administrators but who want to run their own Odoo server. You can simply copy-paste the commands into your terminal or SSH window.

The tutorial is fully tested on CentOS 6.5 but should work for any 6.x version. Please see my other tutorial for CentOS 7 instructions.

First we will install the PostgreSQL database server, then install the necessary package dependencies. Next we will create a virtual Python environment (so we don’t interfere with the CentOS version) and install all the modules Odoo requires. Then it’s time to pull the latest Odoo code from GitHub and create a CentOS 6 compatible init script. Finally we will add the necessary firewall rules and connect to the server.

This tutorial assumes you have already performed a minimal install of the latest version of CentOS 6.5 on a server dedicated to just running Odoo. It also assumes you will be running Odoo on the same server as the PostgreSQL database. You will need at least 1GB of available RAM for lxml to install, although this can include SWAP space.

Odoo is a complicated installation with many dependencies and can be quite resource intensive. I highly recommend you install on a server (or real or virtual) that is dedicated to Odoo. Co-locating Odoo with existing websites/applications is likely to cause problems at some point.

1: Generate Odoo Passwords

Before starting installation we will generate two passwords. The first line generates a strong random password for the odoo server to access the PostgreSQL database that we will install. The second line is the master password you will use to create the Odoo database after the installation is complete. Don’t worry about these for now. After the installation is complete you will find both these passwords in the Odoo configuration file (/etc/odoo-server.conf).

Important: You must run these commands as the root user

ODOO_POSTGRES_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-20};echo;`
ODOO_DB_ADMIN_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-20};echo;`

2: Install and configure PostgreSQL

First will install the PostgreSQL version 9.3. Unfortunately the CentOS 6 official respository only contains older versions, so we will need to install directly from the PostgreSQL repositories. We use the repository rather than simply downloading an RPM because it’s easier to keep up to date with important security and maintenance updates. This command will add the PostgreSQL repository to your server:

rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm

It’s important we exclude postgresql from the official CentOS repository files, otherwise we will encounter problems when we run updates:

sed -i 's/^gpgkey.*/&\nexclude=postgresql*/' /etc/yum.repos.d/CentOS-Base.repo

Installing PostgreSQL and some associated libraries is now straightforward. We then need to initialise the database.

yum -y install postgresql93 postgresql93-server postgresql93-devel postgresql93-libs
service postgresql-9.3 initdb

Next we need to configure PostgreSQL so it will accept connections using MD5 hashed passwords so it’s compatible with the Python modules:

sed -i "/^host/s/ident/md5/g" /var/lib/pgsql/9.3/data/pg_hba.conf

Finally let’s add PostgreSQL to the list of services which will be enabled at startup. We then start the PostgreSQL server and add the Odoo user with the password we generated in step 1.

/sbin/chkconfig --level 35 postgresql-9.3 on
service postgresql-9.3 start

echo -e "$ODOO_POSTGRES_PASSWORD\n$ODOO_POSTGRES_PASSWORD\n" | su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo"

3: Installing Python

Odoo requires a modern version of Python lot of additional libraries. Potentially these could conflict with the Python libraries supplied in CentOS 6 and relied upon by the built in administration tools. So to avoid this risk we will create a virtual environment under the Odoo system user account which will be used solely by the Odoo server.

First lets install some package dependencies:

yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libffi-devel libxslt libxslt-devel libxml2 libxml2-devel openldap-devel libjpeg-turbo-devel openjpeg-devel libtiff-devel git libpng libXext libz.so.1 xorg-x11-fonts-Type1 curl cabextract

We also need the wkhtmltopdf package in order to generate PDF reports in Odoo. This link is for the 64bit version of CentOS. For 32bit change ‘amd64′ to ‘i386′ in the filename below.

rpm -ivh http://sourceforge.net/projects/wkhtmltopdf/files/0.12.2/wkhtmltox-0.12.2_linux-centos6-amd64.rpm/downloadln -s /usr/local/bin/wkhtmltopdf /usr/bin/

Optional: You may wish to install Microsoft’s Core Fonts so they are available when you generate reports in Odoo. First we need to install some dependencies, then the msttcore-fonts-installer rpm downloads the fonts from sourceforge, installs them and activates them on your CentOS server.

For 64 bit (x86) CentOS installs ONLY:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/libmspack-0.4-0.1.alpha.el6.x86_64.rpmrpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/cabextract-1.3-3.el6.x86_64.rpmrpm -ivh https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

For 32 bit (i386) CentOS installs ONLY:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/libmspack-0.4-0.1.alpha.el6.i686.rpmrpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/cabextract-1.3-3.el6.i686.rpmrpm -ivh https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm

Now let’s download and install Python 2.7.8 from source. The first command removes any existing python2.7 installs from previous attempts. Note after compiling we use “altinstall” to prevent overwriting the CentOS default python installation. We will do the Python build in the root users home directory as some CentOS installs prevent the execution of compiled C programs in the /tmp/ directory for security reasons (see “noexec” in /etc/fstab):

rm -rf /usr/local/lib/python2.7
cd /root/
wget http://python.org/ftp/python/2.7.8/Python-2.7.8.tgztar -xzf Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make
make altinstall

With Python successfully installed it’s time to add the Python virtual environment (virtualenv) and the PIP module installation utility:

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | /usr/local/bin/python2.7
/usr/local/bin/easy_install-2.7 pip virtualenv

Next let’s create an Odoo user and setup the virtual environment.

adduser odoo

DIR="/var/run/odoo /var/log/odoo /opt/odoo /opt/andromeda-addons"
for NAME in $DIR
do
if [ ! -d $NAME ]; then
   mkdir $NAME
   chown odoo.odoo $NAME
fi
done

4: Installing Python modules in a virtual environment

Odoo requires a lot of Python modules to run. With the Python virtual environment successfully created we now need to add all the additional modules.

Important note for WHM/cPanel users: If your hosting provider is using WHM/cPanel to manager your server, you must enable compiler access for the odoo user otherwise the Python and additional modules installation will fail. See here for instructions on how to enable compiler access. You can disable compiler access again after Odoo installation is completed.

Important: Commands in this section must be run as the odoo user

First let’s switch from root to the odoo user, then create a new virtual environment called odoo and activate it:

su - odoo

/usr/local/bin/virtualenv --python=/usr/local/bin/python2.7 odoo
source odoo/bin/activate

Before starting the module installation we need to add the path to the PostgreSQL binaries, otherwise the PsycoPG2 module install will fail:

export PATH=/usr/pgsql-9.3/bin:$PATH

Now let’s install all the Python modules. Note we are replacing PIL with pillow – it’s a better supporting fork of PIL and it plays nicely with the location of the CentOS development libraries.

pip install http://download.gna.org/pychart/PyChart-1.39.tar.gzpip install babel
pip install docutils
pip install feedparser
pip install gdata
pip install Jinja2
pip install mako
pip install mock
pip install psutil
pip install psycopg2
pip install pydot
pip install python-dateutil
pip install python-openid
pip install pytz
pip install pywebdav
pip install pyyaml
pip install reportlab
pip install simplejson
pip install unittest2
pip install vatnumber
pip install vobject
pip install werkzeug
pip install xlwt
pip install pyopenssl
pip install lxml
pip install python-ldap
pip install decorator
pip install requests
pip install pillow
pip install pyPdf
pip install passlib

5: Installing Odoo 8 from GitHub

Now it’s finally time to install Odoo itself. We are going to download the latest version of Odoo 8 from the GitHub repository. Note that we are installing into the /opt directory so we can easily manage the installation in a single location and keep it separate from the rest of the operating system.

Important: These commands must be run as the odoo user

cd /opt
git clone https://github.com/odoo/odoo.git --branch 8.0
chown -R odoo.odoo odoo
exit

Let’s create a basic Odoo server configuration file. The passwords we created earlier will be automatically populated. Note I’ve also disabled the various RPC modules for extra security as I don’t use them. I’ve also dialled back the logging so we only see warnings and fatal errors. I’m located in the UK, so the timezone is set to Europe/London.

Important: All the following commands must be run as the root user

cat > /etc/odoo-server.conf << EOF
[options]
; This is the password that allows database operations:
admin_passwd = $ODOO_DB_ADMIN_PASSWORD
; DATABASE OPTIONS
db_host = localhost
db_port = 5432
db_user = odoo
db_password = $ODOO_POSTGRES_PASSWORD
; MISC SETTINGS
addons_path = /opt/odoo/addons
load = web
timezone = Europe/London
without-demo=all
no-xmlrpc = True
no-xmlrpcs = True
no-netrpc = True
; LOG SETTINGS
logfile = /var/log/odoo/odoo-server.loglog_handler = werkzeug:WARNING
log_level = warn
no-logrotate = True

EOF

chown root.odoo /etc/odoo-server.confchmod 640 /etc/odoo-server.conf

I also like to enable logrotation using the built in CentOS tools so the logs are managed in the same way as all the other applications.

cat > /etc/logrotate.d/odoo-server << EOF
/var/log/odoo/*.log {
    copytruncate
    missingok
    notifempty
}
EOF

Next we create a script to easily start and stop the Odoo server. We download a pre-created init script, then use a sed script to modify the startup command so it plays nicely with the virtual Python environment we created earlier.

wget -O /etc/init.d/odoo https://raw.githubusercontent.com/Johnzero/OE7/master/install/openerp-server.initsed -i "s/openerp/odoo/g" /etc/init.d/odoo
sed -i "s/OpenERP/Odoo/g" /etc/init.d/odoo

sed -i "s/\/usr\/bin\/setsid \/usr\/bin\/odoo-server/~\/odoo\/bin\/python \/opt\/odoo\/openerp-server/" /etc/init.d/odoo

chmod +x /etc/init.d/odoo
/sbin/chkconfig --level 35 odoo on

The final step in this section is to add the necessary firewall rules. The redirect command accepts connection on port 80 and redirects them to the default Odoo port 8069. This avoids your users having to remember to enter the port number each time.

/sbin/iptables -A INPUT -p tcp --dport 5432 -i lo -j ACCEPT -m comment --comment "Accept local connections to PostgreSQL"
/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069 -m comment --comment="Redirect Odoo HTTP requests to 8069"
/sbin/iptables -A INPUT -p tcp --dport 8069 -j ACCEPT -m comment --comment "Accept inbound Odoo connections"
/etc/init.d/iptables save

6: Launching Odoo and logging in

To start Odoo, simply run the init script:

/etc/init.d/odoo start

You should be able to open a browser and connect to your Odoo server IP address.

You can check the logfiles in /var/log/messages and /var/log/odoo/odoo-server.log to make sure everything started correctly. Note you can also use “/etc/init.d/odoo restart” and “/etc/init.d/odoo stop” to restart and stop Odoo as required.

tail -50f /var/log/odoo/odoo-server.log

Remember you can find your database admin password in the odoo configuration file: /etc/odoo-server.conf

7: Updating Odoo

If you want to update the Odoo code to the latest version you can easily do that by stopping the server then performing a “git pull”. Note that you must only do the git pull as the odoo user.

/etc/init.d/odoo stop
su - odoo
cd /opt/odoo
git pull
exit
/etc/init.d/odoo start

I hope this guide helps you get Odoo 8 up and running on CentOS 6.5. Let me know how you get on in the comment section, and also check out my other tutorials.


免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

Installing Odoo 8 on

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

Installing Odoo 8 on

This tutorial will walk you through the process of installing the latest version of Odoo on CentOS 6. It is intended for
2023-01-31

ORA-55617: Flashback Archive “string” runs out of space and tracking on “string

文档解释ORA-55617: Flashback Archive string runs out of space and tracking on string is suspendedCause: Flashback
ORA-55617: Flashback Archive “string” runs out of space and tracking on “string
2023-11-05

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录