Install Odoo under Centos

After installing CentOS6.8, python is version 2.6.6, first upgrade to the latest version 2.7.13.

First yum install gcc. to compile the source code.

1. Go to the python official website to download the latest Python-2.7.13.tgz. decompress

tar -xvf Python-2.7.13.tgz

2. Create the directory /usr/lib/python2.7

3.cd Python-2.7.13 #Enter the decompressed Python directory

4../configure --prefix=/usr/lib/python2.7

5.make && make install #Waiting for installation

6. Although the python2.7 build is completed during make, an error is reported.

building dbm using gdbm
INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished, but the necessary bits to build these modules were not found:
_curses            _curses_panel      _sqlite3       
_ssl               _tkinter           bsddb185       
bz2                dl                 imageop        
readline           sunaudiodev        zlib           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

running build_scripts
running install_lib
copying build/lib.linux-x86_64-2.7/_sysconfigdata.py -> /usr/lib/python2.7/lib/python2.7/lib-dynload
copying build/lib.linux-x86_64-2.7/_sysconfigdata.pyo -> /usr/lib/python2.7/lib/python2.7/lib-dynload

Check the Internet and say that tcl-devel and tk-devel are not installed

yum install tcl-devel tk-devel。

_curses            _curses_panel      _sqlite3       
_ssl               _tkinter           bsddb185       
bz2                dl                 imageop        
readline           sunaudiodev        zlib

These class libraries can be used with

Use the yum search command to find the package name, such as: yum search sqlite3

 

yum install openssl-devel

Continue make, ignore other errors

 

 

 

 

vim /etc/profile.

Add export PATH="/usr/lib/python2.7/bin:$PATH" (note = no spaces on both sides)

source /etc/profile

Some articles on the Internet say that yum cannot be used after CentOS upgrade, saying that yum only supports python2.6. After backing up the python of /usr/bin, yum needs to modify yum #! /usr/bin/python to #! /usr/bin/python2.6. The CentOS6.8 I installed doesn't seem to need this operation.

 

https://pip.pypa.io/en/stable/installing/

Install pip.

1. Download get-pip.py.

2. Run python get-pip.py, install pip,

 

Install the required python packages for odoo

cd to the odoo code directory

#pip install -r requirements.txt

Other packages are installed relatively smoothly.

When I installed reportlab-3.3.0, it stopped all the time. After downloading reportlab-3.3.0.tar.gz from the official website, the local installation also stopped. At first, I thought vpn was needed, but vpn was not enough. Later, using the pip install -v command, I found that the installation has been stopped at download t1 fonts curves. Later, I checked google and saw that after someone deleted the rl_addons directory under reportlab, the installation package was successful. I was in the process of stopping easy_install, press ctrl+c. As a result, the installation was successful.

But there are sequelae, which will be described later.

install wkhtmltopdf,

 

If odoo prints pdf, you need to install wkhtmltopdf, http://wkhtmltopdf.org/downloads.html to download the linux 64bit package,

wkhtmltox-0.12.4_linux-generic-amd64.tar.xz is directly extracted to /usr/lib/wkhtmltox,

After that #cp / usr / lib / wkhtmltox / wkhtmltopdf / usr / bin

#chown root:root /usr/bin/wkhtmltopdf

#chmod +x /usr/bin/wkhtmltopdf

Test #wkhtmltopdf http://www.baidu.com baidu.pdf can come out pdf indicating that the installation was successful.

Then restart odoo. The pdf came out normally.

But the pdf barcode is not showing up.

One of the modules reported an error that the msyh.ttf font was not available, and the font was installed according to the online method.

cp msyh.ttf /usr/share/fonts/

chmod 644 /usr/share/fonts/msyh.ttf

mkfontscale

mkfontdir

fc-cache -fv

But another barcode print place shows RenderPMError: Can't setFont(Times-Roman) missing the T1 files

Considering the problem of downloading t1 fonts curves when reportlab was installed.

Later google to other people's solution

Download and uncompress in /path/to/your/python/site-packages/reportlab/fonts these file

http://www.reportlab.com/ftp/fonts/pfbfer.zip

Restart odoo server and try

 

 

 

 

Install postgresql

1. Go to https://yum.postgresql.org/repopackages.php#pg94 to download rpm

yum install pgdg-centos94-9.4-3.noarch.rpm。

yum list postgres* can list the available installation packages

yum install postgres94-server

[root@MiWiFi-R1D-srv /]# service postgresql-9.4 initdb
Initializing database: [OK]
[root@MiWiFi-R1D-srv /]# chkconfig postgresql-9.4 on
[root@MiWiFi-R1D-srv /]# service postgresql-9.4 restart
Stop postgresql-9.4 service: [OK]
Start postgresql-9.4 service: [OK]
[root@MiWiFi-R1D-srv/]#
10.1 Modify postgresql.conf file
# vi /var/lib/pgsql/9.4 /data/postgresql.conf
Remove the # before listen_addresses, and change listen_addresses = ' localhost ' to listen_addresses = ' * '
10.2 Modify the client authentication configuration file pg_hba.conf
Add the IP address or address segment that needs to remotely access the database to this document.
# vi /var/lib/pgsql/9.4/data/pg_hba.conf Modify 127.0.0.1/32 under IPv4 area
to 0.0.0.0/0 ; Modify ident to md5

 

Centos Firewall Settings

#vi /etc/sysconfig/iptables

Add to

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8069 -j ACCEPT

#service iptables restart

The system will automatically create a postgres user,

#passwd postgresChange password.

Postgresql is created by the postgres user by default. You need to switch to postgres to run psql

#su postgres

[root@MiWiFi-R1D-srv /]# su postgres
bash-4.1$ psql
psql (9.4.10)
Enter "help" to get help information.

postgres=# \q
bash-4.1$ psql -Upostgres
psql (9.4.10 )
Enter "help" for help information.

postgres=# password postgres change password,
psql: fatal error: peer authentication failed for user "odoo"

[root@MiWiFi-R1D-srv data]# vim pg_hba.conf
Modify pg_hba.conf

# "local" is for Unix domain socket connections only
local all all md5 Change
the original peer to md5

You can use psql to come in.

[root@MiWiFi-R1D-srv /]# psql -Upostgres -W
User postgres password:
psql (9.4.10)
Enter "help" to get help information.

postgres=#

In this way, the remote pgAdmin can log in as postgres.

 

#cd /usr/odoo enter the odoo code directory

#pip install -r requirements.txt Install the modules required by odoo through requirements.txt

 

Failed to install psycopg2 through requirements.txt, try to download psycopg2 and install it manually.

pip install psycopg2 failed. The error says that there is no PATH for pg_config.

(You can also download psycopg2-2.6.2.tar.gz through source: http://initd.org/psycopg/download/

After decompression, python setup.py build)

is because postgres9.4-devel is not installed

The pg_config program: it is usually installed by the libpq-dev package but sometimes it is not in a PATH directory. Having it in the PATH greatly streamlines the installation, so try running pg_config --version: if it returns an error or an unexpected version number then locate the directory containing the pg_config shipped with the right libpq version (usually /usr/lib/postgresql/X.Y/bin/) and add it to the PATH:

 

pg_config is under /usr/pgsql-9.4/bin

#vim /etc/profile

Add to

export PATH="$PATH:/usr/pgsql-9.4/bin"

#source /etc/profile

#pip install psycopg2 succeeded

 

Note: The db_hostname of openerp-server.conf should be changed to 127.0.0.1 if localhost is used,

After odoo is started, the access data keeps reporting an error saying that the user Ident authentication failed.

 

The current user name of centos is radzhang to create the postgres user.

 

$ sudo su - postgres -c "createuser -s $USER"

If you run $psql, postgres will find the database radzhang by default

$pssql -d postgres enter postgresql normally

 

In this way, openerp-server.conf can be replaced with the same username and password as the loginuser of centos.

db_user = radzhang db_password=123456

 

Note that $python openerp-server -c openerp-server.conf can no longer run under root, and a security error will be reported.

 

 

Supervisor configuration

The source code of odoo is placed under usr/odoo

[program: odoo]

command=/usr/local/python278/bin/python2.7 /opt/odoo/openerp-server -c /opt/odoo/openerp-server.conf

directory = / opt / odoo

autostart=true

autorestart=true

startsecs=3

user=openerp

stdout_logfile=/opt/odoo/openerp-server.log

stdout_logfile_maxbytes=500MB

stdout_logfile_backups=50

stdout_capture_maxbytes=1MB

stdout_events_enabled=false

 

 

2017-2-13how to

After the installation is complete, configure openerp-server.conf. Because your own modules are placed in another directory, addons_path=/home/radzhang/workspace/tse2.0/openerp/addons,/home/radzhang/workspace/tse2.0/openerp/addons_self. Two paths are set. However, when #./openerp-server starts the odoo server, it has been unable to recognize the newly added addons_self directory.

Then if I put my own module in the openerp/addons directory, the program can run normally.

Later, through the openerp-server command, directly specify the addons path, and then use the -s parameter to save it. After that, the second one can be recognized normally.

 

2017-12-31comment

When #pip install -r requirement.txt, an error is reported

  1. src/lxml/lxml.etree.c:157929: error: ‘xsltLibxsltVersion’ undeclared (first use in this function)  
  2. src/lxml/lxml.etree.c:157941: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function)  
  3. src/lxml/lxml.etree.c:157941: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function)  
  4. src/lxml/lxml.etree.c:157950: error: ‘__pyx_f_4lxml_5etree__xslt_doc_loader’ undeclared (first use in this function)  
  5. error: command 'gcc' failed with exit status 1  

pip list to see that lxml4.1.1 has been installed, but the error of lxml is still reported.

 

Check it out #rpm -qa|grep libxlm2*,

[root @ tse4-odoo tse_4.0] # rpm -qa | grep libxml2 *

libxml2-python-2.7.6-21.el6_8.1.x86_64

libxml2-2.7.6-21.el6_8.1.x86_64

libxml2-devel-2.7.6-21.el6_8.1.x86_64

libxml2-static-2.7.6-21.el6_8.1.x86_64

is installed, but there is no libxslt.

#yum install libxslt*

[root @ tse4-odoo tse_4.0] # rpm -qa | grep libxslt *

libxslt-1.1.26-2.el6_3.1.x86_64

libxslt-devel-1.1.26-2.el6_3.1.x86_64

 

Then it's normal. The lxml of requirement.txt is version 3.3.5, and pip install -r requirement.txt will automatically delete lxml4.1.1. Then install lxml3.3.5

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326755684&siteId=291194637