CentOS 7 安装 Odoo 9

  • 现有CentOS 7 VPS一台:

    CentOS 7 安装 Odoo 9_第1张图片

  • 先更新系统:

    sudo yum -y update

    当然我这个系统是刚刚升级过的

    CentOS 7 安装 Odoo 9_第2张图片

  • Odoo 使用PostgreSQL数据库, 如果系统自带MariaDBserver,我们需要先卸载掉:

    sudo yum remove mariadb mariadb-server

[ak@odoo9 ~]$ sudo yum remove mariadb mariadb-server
Loaded plugins: fastestmirror
No Match for argument: mariadb
No Match for argument: mariadb-server
No Packages marked for removal
[ak@odoo9 ~]$
  • 为了安装Odoo9的依赖,需要添加EPEL到库:

    sudo yum install -y epel-release

[ak@odoo9 ~]$ sudo yum install -y epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch             Version         Repository        Size
================================================================================
Installing:
 epel-release           noarch           7-5             extras            14 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 14 k
Installed size: 24 k
Downloading packages:
epel-release-7-5.noarch.rpm                                |  14 kB   00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-5.noarch                                      1/1 
  Verifying  : epel-release-7-5.noarch                                      1/1 

Installed:
  epel-release.noarch 0:7-5                                                     

Complete!
[ak@odoo9 ~]$
  • 安装PostgreSQL数据库:

    sudo yum install -y postgresql-server

[ak@odoo9 ~]$ sudo yum install -y postgresql-server
Loaded plugins: fastestmirror
epel/x86_64/metalink                                             | 4.5 kB  00:00:00     
epel                                                             | 4.3 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                      | 169 kB  00:00:02     
(2/3): epel/x86_64/updateinfo                                    | 471 kB  00:00:04     
(3/3): epel/x86_64/primary_db                                    | 3.8 MB  00:01:14     
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: ftp.cuhk.edu.hk
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
...
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package                   Arch           Version                 Repository       Size
========================================================================================
Installing:
 postgresql-server         x86_64         9.2.14-1.el7_1          updates         3.7 M
Installing for dependencies:
 postgresql                x86_64         9.2.14-1.el7_1          updates         3.0 M
 postgresql-libs           x86_64         9.2.14-1.el7_1          updates         231 k

Transaction Summary
========================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 7.0 M
Installed size: 33 M
Downloading packages:
(1/3): postgresql-9.2.14-1.el7_1.x86_64.rpm                      | 3.0 MB  00:00:02     
(2/3): postgresql-libs-9.2.14-1.el7_1.x86_64.rpm                 | 231 kB  00:00:02     
(3/3): postgresql-server-9.2.14-1.el7_1.x86_64.rpm               | 3.7 MB  00:00:03     
----------------------------------------------------------------------------------------
Total                                                      746 kB/s | 7.0 MB  00:09     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql-libs-9.2.14-1.el7_1.x86_64                                1/3 
.....
  Verifying  : postgresql-libs-9.2.14-1.el7_1.x86_64                                3/3 

Installed:
  postgresql-server.x86_64 0:9.2.14-1.el7_1                                             

Dependency Installed:
  postgresql.x86_64 0:9.2.14-1.el7_1       postgresql-libs.x86_64 0:9.2.14-1.el7_1      

Complete!
[ak@odoo9 ~]$
  • 安装完成后,需要初始化PostgreSQL数据库:

    sudo postgresql-setup initdb

[ak@odoo9 ~]$ sudo postgresql-setup initdb
Initializing database ... OK

[ak@odoo9 ~]$
  • 启动PostgreSQL服务同时配置使其在系统开机时自动运行:

    sudo systemctl start postgresql

    sudo systemctl enable postgresql

[ak@odoo9 ~]$ sudo systemctl start postgresql
[ak@odoo9 ~]$ sudo systemctl enable postgresql
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql.service to /usr/lib/systemd/system/postgresql.service.
[ak@odoo9 ~]$
  • 为Odoo新建新的yum库:

    sudo nano /etc/yum.repos.d/odoo.repo

  • 添加如下内容:

[odoo-nightly]
name=Odoo Nightly repository
baseurl=http://nightly.odoo.com/9.0/nightly/rpm/
enabled=1
gpgcheck=1
gpgkey=https://nightly.odoo.com/odoo.key
  • Ctrl +X 退出并保存:

  • 然后安装Odoo 9:

    sudo yum install -y odoo

        这将会安装最新的Odoo及其所有依赖到你的系统,目前下载内容大小为110MB,安装时间取决于你的网速。

  • 安装完成后,启动Odoo同时使其随系统开机自动运行:

    sudo systemctl start odoo

    sudo systemctl enable odoo

[ak@odoo9 ~]$ sudo systemctl start odoo
[sudo] password for ak: 
[ak@odoo9 ~]$ sudo systemctl enable odoo
Created symlink from /etc/systemd/system/multi-user.target.wants/odoo.service to /usr/lib/systemd/system/odoo.service.
[ak@odoo9 ~]$
  • 为了让系统可以输出PDF报告,需要wkhtmltopdf,但是CentOS默认软件软件库里的wkhtmltopdf并不支持页眉页脚的打印,所以我们从官方网站下载我们需要的版本:

  • 安装前先安装其依赖:

    sudo yum install fontconfig libpng libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi

[ak@odoo9 ~]$ sudo yum install fontconfig libpng libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: ftp.cuhk.edu.hk
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
......
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package                     Arch          Version                 Repository      Size
========================================================================================
Installing:
 fontconfig                  x86_64        2.10.95-7.el7           base           228 k
.......
 xorg-x11-font-utils         x86_64        1:7.5-20.el7            base            87 k

Transaction Summary
========================================================================================
Install  7 Packages (+7 Dependent packages)

Total download size: 5.0 M
Installed size: 9.2 M
Is this ok [y/d/N]: y
Downloading packages:
(1/14): libX11-common-1.6.3-2.el7.noarch.rpm                     | 162 kB  00:00:00     
.....  
(14/14): libXext-1.3.3-3.el7.x86_64.rpm                          |  39 kB  00:00:01     
----------------------------------------------------------------------------------------
Total                                                      1.5 MB/s | 5.0 MB  00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libfontenc-1.1.2-3.el7.x86_64                                       1/14 
  .... 
  Verifying  : 1:xorg-x11-font-utils-7.5-20.el7.x86_64                            14/14 

Installed:
  fontconfig.x86_64 0:2.10.95-7.el7          libX11.x86_64 0:1.6.3-2.el7               
  libXext.x86_64 0:1.3.3-3.el7               libXrender.x86_64 0:0.9.8-2.1.el7         
  libpng.x86_64 2:1.5.13-7.el7_2             xorg-x11-fonts-75dpi.noarch 0:7.5-9.el7   
  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7   

Dependency Installed:
  libX11-common.noarch 0:1.6.3-2.el7             libXau.x86_64 0:1.0.8-2.1.el7         
  libXfont.x86_64 0:1.5.1-2.el7                  libfontenc.x86_64 0:1.1.2-3.el7       
  libxcb.x86_64 0:1.11-4.el7                     ttmkfdir.x86_64 0:3.0.9-42.el7        
  xorg-x11-font-utils.x86_64 1:7.5-20.el7       

Complete!
  • 下载安装wkhtmltopdf:

    sudo rpm -Uvh http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm

[ak@odoo9 ~]$ sudo rpm -Uvh http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
Retrieving http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:wkhtmltox-1:0.12.2.1-1           ################################# [100%]
[ak@odoo9 ~]$
  • Odoo使用8069端口,你需要在CentOS防火墙上打开该端口:

    firewall-cmd --zone=public --add-port=8069/tcp --permanent

[ak@odoo9 ~]$ sudo firewall-cmd --zone=public --add-port=8069/tcp --permanent
success
[ak@odoo9 ~]$

  • 重启防火漆使其生效:

[ak@odoo9 ~]$ sudo systemctl restart firewalld
  • 检查设置是否生效:

    sudo iptables -I INPUT -p tcp --dport 8069 -j ACCEPT

[ak@odoo9 ~]$ sudo iptables -L -n| grep 8069
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8069 ctstate NEW
  • 现在打开浏览器,输入http://192.168.137.80:8069  新建PostgreSQL数据库,这里的IP需要替换为你自己的IP:

    CentOS 7 安装 Odoo 9_第3张图片

  • 默认的管理员密码是admin,你也可以通过配置文件查看或修改,修改后通过systemctl restart odoo重启Odoo:

    sudo more  /etc/odoo/openerp-server.conf

[ak@odoo9 ~]$ sudo more  /etc/odoo/openerp-server.conf
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/site-packages/openerp/addons

[ak@odoo9 ~]$
  • 新建数据库后就可以进入Odoo的界面了:

    CentOS 7 安装 Odoo 9_第4张图片

你可能感兴趣的:(CentOS7,package,Odoo9)