1. 准备工作
1.1 清除yum缓存、安装EPEL源并升级系统
yum clean all yum -y install epel-release.noarch yum update
1.2 安装PostgreSQL和PHP PostgreSQL extension
yum -y install postgresql-libs postgresql-server postgresql php-pgsql php-gd
1.3 安装所需软件
yum -y install wget babel python-devel libxslt-python pyparsing python-dateutil python-decorator python-imaging python-jinja2 python-ldap python-lxml python-mako python-psycopg2 python-reportlab python-requests python-werkzeug python-yaml python-docutils python-matplotlib python-unittest2.noarch python-babel python-gevent pygtk2 glade3 pytz libxslt-devel bzr automake gcc gcc-c++ byacc kernel-headers
系统当前web服务要重启(没有web服务跳过此步骤),比如
systemctl restart php-fpm.service
systemctl restart nginx.service
1.4 PostgreSQL初始化、启动并设为开机自启
postgresql-setup initdb
systemctl start postgresql.service
systemctl enable postgresql.service
1.5 为PostgreSQL的postgres用户设置密码
su - postgres psql \password postgres (输入两次新密码) \q exit
2. 安装Odoo ERP
2.1 新建用户odoo
useradd -s /sbin/nologin odoo passwd odoo
2.2 在PostgreSQL中创建用户odoo
su - postgres -c "createuser --pwprompt --createdb --no-createrole --no-superuser odoo" (输入两遍新密码)
2.3 下载odoo安装包
cd ~ wget http://nightly.odoo.com/8.0/nightly/src/odoo\_8.0.latest.tar.gz tar -xvzf odoo\_8.0.latest.tar.gz mv odoo-8.* odoo cd odoo
2.4 安装odoo(安装过程要能访问被墙网站,比如googlecode)
python setup.py install cp openerp-server /usr/local/bin/odoo-server mkdir -p /var/log/odoo/ touch /var/log/odoo/odoo-server.log chown odoo /var/log/odoo/odoo-server.log chmod 644 /var/log/odoo/odoo-server.log chown odoo -R /usr/lib/python2.7/site-packages/odoo-8*/openerp/addons/ export LD_LIBRARY_PATH=/usr/local/lib source ~odoo/.bashrc
编辑配置文件
vi /etc/odoo-server.conf
输入以下内容:(字段odoo-8.0_20150410-py2.7.egg根据实际情况修改)
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = localhost db_port = 5432 db_user = odoo db_password = False addons_path = /usr/lib/python2.7/site-packages/odoo-8.0_20150410-py2.7.egg/openerp/addons/ #do not forget to change 'odoo-8.0_20150410-py2.7.egg' with the actual directory on your server logfile = /var/log/odoo/odoo-server.log log_level = error
用下列命令可以查看字段odoo-8.0_20150410-py2.7.egg在本机实际是什么:
ls /usr/lib/python2.7/site-packages/
2.5 编辑PostgreSQL配置文件
vi /var/lib/pgsql/data/pg_hba.conf
修改以下内容
TYPE DATABASE USER ADDRESS METHOD "local" is for Unix domain socket connections only local all all trust # changed from 'peer' IPv4 local connections: host all all 127.0.0.1/32 trust # changed from 'ident' IPv6 local connections: host all all ::1/128 trust # changed from 'ident'
如果要远程访问PostgreSQL数据库,再增加下面一行
host all all 0.0.0.0/0 md5
检查PostgreSQL数据库编码是否为UTF8:
su - postgres psql postgres=# l q exit
重启PostgreSQL服务:
systemctl restart postgresql.service
2.6 建立odoo的service文件
vi /usr/lib/systemd/system/odoo.service
输入以下内容
[Unit] Description=Advanced OpenSource ERP and CRM server Requires=postgresql.service After=postgresql.service [Install] Alias=odoo.service [Service] Type=simple PermissionsStartOnly=true EnvironmentFile=-/etc/conf.d/odoo-server User=odoo Group=odoo SyslogIdentifier=odoo-server PIDFile=/run/odoo/odoo-server.pid ExecStartPre=/usr/bin/install -d -m755 -o odoo -g odoo /run/odoo ExecStart=/usr/local/bin/odoo-server -c /etc/odoo-server.conf --pid=/run/odoo/odoo-server.pid --syslog $OPENERP_ARGS ExecStop=/bin/kill $MAINPID [Install] WantedBy=multi-user.target
2.7 启动odoo并设为开机自启
systemctl start odoo.service
systemctl enable odoo.service
2.8 防火墙开放8069端口
firewall-cmd --permanent --add-port=8069/tcp firewall-cmd --reload
3. 配置odoo
打开 http://服务器IP:8069/web/database/manager
- 点击左侧Password修改超级密码(Master password):默认密码是admin。
- 点击左侧Create添加一个新数据库(子站点):输入超级密码(Master password),输入数据库名称,选择语言,设定该数据库(子站点)的管理密码。