Install Odoo8.0 with git source code on UbuntuServer14.04LTS

Source: Internet
Author: User
Tags website server strong password wkhtmltopdf
In September 19, 2014, Odoo officially released the official version of Odoo8.0, which is a brand new version that integrates various functions such as website construction. In the Linux operating system, the conventional way to install Odoo is to download from the Odoo official website download library http://nightly.openerp.com corresponding version of the directory. deb installation package (for Debian/Ubuntu Linux) or. rpm installation package (for RedHat/CentOS type)

In September 19, 2014, Odoo officially released the official version of Odoo8.0, which is a brand new version that integrates various functions such as website construction.

In the Linux operating system, the conventional way to install Odoo is to download from the Odoo official website download library http://nightly.openerp.com corresponding version of the directory. deb installation package (for Debian/Ubuntu Linux) or. run and install the rpm installation package (for RedHat/CentOS-type Linux systems. However, in this case, the installation configuration is performed according to the official Odoo default configuration. The personalized setting space is small and sometimes inconvenient to manage. Therefore, we adopt a more manual source code Installation Method to configure the required configurations for installation.

This article describes how to install Odoo in source code mode on the Ubuntu Server 14.04 operating system. The advantages of this approach are:

If necessary, we can use only one "git pull" command to update the local code when the network is connected.

Please note that you need to back up the pull code in advance in the future. In some cases, the Odoo database also needs to be updated.

Step 1 create a Server to install Ubuntu Server 14.04

Visit the Ubuntu official website server version page at http://www.ubuntu.com/serverto download the installation image. Currently, the server version does not have 32-digit versions, but 64-digit versions. Or you can download the image from the domestic Internet: elastic.

This document takes the host name odoo and user name dean as an example to install Ubuntu. If the commands in the following steps are related to the Host Name and user name, change the actual host name and user name.

When installing and selecting pre-installed services, select PostgreSQL and install the data service environment PostgreSQL database required by Odoo.

After the system is installed and restarted, log in with your username and password and run

Psql-version

Command to view the version. Currently, PostgreSQL 9.3.5 is installed with Ubuntu 14.04 server version.

Next, update the software source information of the server:

Sudo apt-get update

In addition, the software packages of the server are updated and the dependency is automatically searched:

Sudo apt-get dist-upgrade

Although it is not always necessary, it is best to restart the server to update the changed content.

Sudo shutdown-r now

Step 2: Create a system user named odoo to grant Odoo program permissions and run it.
Run commands

Sudo adduser -- system -- home =/opt/odoo -- group odoo

The odoo User Added here is a system user. It is a type of user used to own and run various background services, rather than an individual user used to log on to the system for various operations. Specify and create the odoo user's "home" in the preceding command. The home directory is/opt/odoo. Here we will store the odoo program code. You can freely choose the location where the code is stored, but note that the content in some configuration files below is determined based on the directory specified by the preceding command, therefore, when you choose the location where your code is stored, you must modify some settings in the following sections. Although the System user is forbidden to log on without a shell, when we need to perform some specific operations as a system user, we can still use the su command to switch users:

Sudo su-odoo-s/bin/bash

The su (Switch User) Command will Switch your current terminal logon to the odoo User and use the/bin/bash shell. After running this command, the current directory will be automatically switched to the odoo user's home directory/opt/odoo. After you complete the operation as an odoo user, you can use

Exit

Command to exit the odoo user's shell and return to the user you are logged on.


Step 3 install and configure the database server PostgreSQL
If you did not select to install PostgreSQL when installing the Ubuntu server, you can install PostgreSQL now:

Sudo apt-get install postgresql

If it has already been installed, you do not need to execute this command.
Add and configure odoo users for the PostgreSQL database as follows:
First, switch to the postgres user, which is the default initial user of PostgreSQL. to operate on it, we have the permission to configure the database:

Sudo su-postgres

Then, create a new database user odoo as postgres, And the odoo program will access the postgreSQL database as it to create and delete database files.

Createuser -- createdb -- username S -- no-createrole -- no-superuser -- pwprompt odoo

The system prompts you to enter the password twice:

Enter password for new role :********
Enter it again :********

Remember the password you set here. You will use it later. Finally, exit the ipvs user identity:

Exit

Step 4 install the Python Runtime Library and wkhtmltopdf for the Ubuntu Server
The python Runtime Library that Odoo8.0 depends on is somewhat different from OpenERP7.0.
Run commands

Sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata \
Python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \
Python-psutil python-pybabel python-pychart python-pydot python-pyparsing \
Python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \
Python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-pyPdf \
Python-decorator python-passlib python-requests

For Odoo8.0, you can use wkhtmltopdf to output pdf files. Therefore, you need to download wkhtmltopdf and install it:

Wget http://sourceforge.net/projects/wkhtmltopdf/files/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

Then run

Sudo dpkg-I wkhtmltox-0.12.1_linux-trusty-amd64.deb

.
Copy the executable file to usr/bin after installation.

Sudo cp/usr/local/bin/wkhtmltopdf/usr/bin/wkhtmltopdf

Change owner to root user and add executable attributes

Sudo chown root: root/usr/bin/wkhtmltopdf
Sudo chmod + x/usr/bin/wkhtmltopdf

Run the following command to print a webpage to your home directory:

Wkhtmltopdf www.baidu.com ~ /Baidu.pdf

If a pdf file is successfully output, wkhtmltopdf is successfully installed.

Install Chinese fonts:

Sudo apt-get install ttf-wqy-zenhei
Sudo apt-get install ttf-wqy-microhei

(Why can't these fonts be loaded in Odoo ?)
After the installation is complete, all the projects on which Odoo8.0 runs have been installed.


Step 5 install the Odoo Server
Install the git software first

Sudo apt-get install git

Switch to odoo User:

Sudo su-odoo-s/bin/bash

Use git software to download a set of code from the odoo8.0 branch of the github website (there is no space between-at the end of the first line of the command below and B at the beginning of the second line; add a dot after the last word in the command "."
Is required. This point indicates "Current directory", not a full stop ):
(The file cannot be saved to the current directory. You can download the file to the specified directory before moving it to the directory)

Git clone https://www.github.com/odoo/odoo -- branch 8.0 -- single-branch.

Or use this:

Git clone-B 8.0 https://github.com/odoo/odoo.git.

(It will take some time to download over one hundred m east and west. Based on your network speed)
Download the complete branch to the current odoo directory:

Git clone https://github.com/odoo/odoo.git.

After the download is complete, exit the odoo User:

Exit

Step 6 configure the Odoo Program
The default Odoo configuration file (/opt/odoo/debian/openerp-server.conf) includes the basic settings, which can run well on our system with a little change, here we will repeat this file
To the desired location/etc:

Sudo cp/opt/odoo/debian/openerp-server.conf/etc/odoo-server.conf

Change its ownership and license:

Sudo chown odoo:/etc/odoo-server.conf
Sudo chmod 640/etc/odoo-server.conf

The preceding command allows the file to be owned by odoo users and user groups, and only odoo users and root users can read the file.
Edit it in a text editor. It is recommended that you use the nano editor that comes with Ubuntu as an example to run it:

Sudo nano/etc/odoo-server.conf

Then make three changes,
1. Open the configuration file and find
Db_password = False
In this line, set "False" after the equal sign to the Database Password you set When configuring postgreSQL in step 3.
2. Then find
Addons_path =/usr/lib/python2.7/dist-packages/openerp/addons
Change this line
Addons_path =/opt/odoo/addons
In this way, the odoo program will read the module in the opt/odoo/addons directory we have installed.
3. We also need to specify where Odoo writes its log files. Add a new line at the end of the file
Logfile =/var/log/odoo/odoo-server.log
After the configuration file is edited, press Ctrl + O, press enter to overwrite and save, and then press Ctrl + X to exit the nano program.
Now you can try to start the Odoo server to see if it is running normally.
Switch to the odoo user first,

Sudo su-odoo-s/bin/bash

Then run

/Opt/odoo/openerp-server

If you get a few lines of feedback on the interface, tell you "OpenERP is running and waiting for connections." That's OK. (Although the version has been upgraded, this program is still called OpenERP rather than Odoo in the log)
If an error occurs, you need to go back and check the problem. If everything is normal, press Ctrl + C to stop the server and then use
Exit
The command leaves the odoo user and returns to the shell you log on.


Step 7 install the Startup Script
Starting and stopping the odoo service involves many modules and requires multiple steps. It is complicated. We will install a script below, which will process these steps in batches, we only need to run this script once, and it can run the odoo server startup and stop operations in batches with the correct user identity.
The odoo program provides a ready-made script, which is the/opt/odoo/server/install/openerp-server.init file, but requires a little change-because we didn't install it in the default installation method of odoo.
Here is a modified script file, which can be downloaded and used: (there is no space between the/at the end of the first line of the following command and the o at the beginning of the second line)
Wget requests:

Sudo cp ~ /Odoo-server/etc/init. d/odoo-server

Change it to an executable file, which is owned by the root user:

Sudo chmod 755/etc/init. d/odoo-server
Sudo chown root:/etc/init. d/odoo-server

In step 6, we specify the location of the odoo server's log file in the configuration file.
We need to create the directory so that the odoo server can write logs to it. At the same time, we have to make this location accessible to odoo users:

Sudo mkdir/var/log/odoo
Sudo chown odoo: root/var/log/odoo

Step 8 test the server
To start the Odoo server, enter:

Sudo/etc/init. d/odoo-server start

Now you can view the log file to see if the server has started

Ess/var/log/odoo/odoo-server.log

(To exit the View Interface of the less command, just press the q key)
If a problem occurs during server startup, you can find the cause based on the log file content.
If everything works properly, you can now access the odoo web page using a web browser. The address format is:
Http: // Odoo Server IP address or domain name: 8069
For example, if the IP address of the Odoo server is 192.168.1.10, open a web browser on another computer in the same LAN (because odoo uses a newer HTML5 standard, therefore, Windows XP's IE6 cannot be properly displayed. We recommend that you download and install a new version of Chrome or Firefox). In the address bar, enter:
Http: // 192.168.1.10: 8069
We should be able to see the Odoo database management interface, because it is a new installation, a set of books have not been set up, so the default will come to this interface.
It is recommended that you modify the master password of the Odoo system and keep it in mind. This password is used to create, copy, delete, back up, and restore databases, with great power, set a strong password. Default
The master password of is "admin", which is not safe. The password is written in plaintext in the/etc/odoo-server.conf file. This is why we set this file to read only by odoo users and root users.
When you modify and save the new master password on the web interface. /Etc/odoo-server.conf this file will be overwritten and there will be more options.
Check whether the odoo server can be properly stopped:

Sudo/etc/init. d/odoo-server stop

Check the log file to check whether the service has been stopped. You can also run the top command to check the running progress table of the Ubuntu server. (The q key is also used to exit the top command display interface)

Step 9 automate Odoo startup and Shutdown
If the previous steps run normally, the final step is to enable the startup script to automatically start and close the Odoo service with the startup and shutdown of the Ubuntu server.

Sudo update-rc.d odoo-server defaults

If you like, you can restart your server now. When you log in again, Odoo should already be running. If you enter

Ps aux | grep odoo

You will see the following information:
Odoo 1491 0.1 10.6 207132? Sl python/opt/odoo/openerp-server-c/etc/odoo-server.conf
This shows that the server is running normally. Of course, you can check the log file or use a web browser to access the server.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-12/126177.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.