การติดตั้ง OpenERP 7.0 อย่างง่าย บน Ubuntu Server 12.10
OpenERP 7.0 Installation
Platform: Ubuntu Server 12.10
Pre-installation
1. Install SSH server for remote connection with Denyhosts for Brute-force-attack protection.
Run command:
#sudo apt-get install openssh-server denyhosts
2. Try login to server remotely.
3. Update system before install OpenERP.
Run command:
#sudo apt-get update
#sudo apt-get dist-upgrade
4. Reboot server.
5. Create OpenERP’s user, owner and group.
Run command:
#sudo adduser --system --home=/opt/openerp --group openerp
This command build user as system’s user and make a default home directory of user and add user to openerp group.
6. Install Postgre-SQL.
Run command:
#sudo apt-get install postgresql
7. Change to postgre user for a privilege to configure the database.
Run command:
#sudo su - postgres
8. Create new database and access right for OpenERP to connect PostgreSQL. Where the * is your password.
Run command:
#createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
Enter password for new role: ********
Enter it again: ********
#exit
9. Install Python library for server.
Run command:
#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-psycopg2 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
Install OpenERP server.
1. Install OpenERP server with wget. First, check if download link of OpenERP is available from http://nightly.openerp.com/7.0/nightly/deb/ .
Run command:
#sudo su – openerp –s /bin/bash
#wget http://nightly.openerp.com/7.0/nightly/deb/openerp_7.0-latest-1.tar.gz
#cd /opt/openerp
2. Extract file.
Run command:
#sudo tar xvf ~/ openerp_7.0-latest-1.tar.gz
3. Change the file’s owner to openerp.
Run command:
#sudo chown -R openerp: *
4. Make a copy of directory that we will make configure for OpenERP server.
Run command:
#sudo cp -a
openerp_7.0-latest-1 server
Configure OpenERP application.
1. Copy a configure file to /etc directory and define permission.
Run command:
#sudo cp /opt/openerp/server/install/openerp-server.conf /etc/
#sudo chown openerp: /etc/openerp-server.conf
#sudo chmod 640 /etc/openerp-server.conf
2. Edit a configure file. Add log location, addon part, and connection port. The db_host and db_password parameters(*) must be the same as when create new database.
Run command:
#vi /etc/openerp-server.conf
[options] ; This is the password that allows database operations: ; admin_passwd = admin db_host = False db_port = False db_user = ****** db_password = ****** logfile = /var/log/openerp/openerp-server.log xmlrpc_port = 8989 addons_part=/opt/openerp/server/addons,/opt/openerp/server/web/addons |
3. Test running server. Make sure you are the openerp user for running the application.
Run command:
# sudo su - openerp -s /bin/bash
# /opt/openerp/server/openerp-server
If the application is running smoothly you should see the message as below.
2013-07-05 05:39:07,581 1701 INFO ? openerp: OpenERP version 7.0-20130701-231330 2013-07-05 05:39:07,581 1701 INFO ? openerp: addons paths: /opt/openerp/server/openerp/addons 2013-07-05 05:39:07,581 1701 INFO ? openerp: database hostname: localhost 2013-07-05 05:39:07,581 1701 INFO ? openerp: database port: 5432 2013-07-05 05:39:07,581 1701 INFO ? openerp: database user: openerp 2013-07-05 05:39:07,950 1701 INFO ? openerp.addons.google_docs.google_docs: GData lib version `%s GData-Python/2.0.17` detected 2013-07-05 05:39:08,209 1701 INFO ? openerp.service.wsgi_server: HTTP service (werkzeug) running on 0.0.0.0:7070 2013-07-05 05:39:08,212 1701 INFO ? openerp: OpenERP server is running, waiting for connections... |
4. Ctrl+C to exit and stop running server.
Make script to start/stop application and add to start-up booting.
1. Put the script file on path /etc/init.d/ and name openerp-server.
#!/bin/sh ### BEGIN INIT INFO # Provides: openerp-server # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Enterprise Resource Management software # Description: Open ERP is a complete ERP and CRM software. ### END INIT INFO PATH=/bin:/sbin:/usr/bin DAEMON=/opt/openerp/server/openerp-server NAME=openerp-server DESC=openerp-server #LOGFILE=/var/log/openerp/openerp-server.log # Specify the user name (Default: openerp). USER=openerp # Specify an alternate config file (Default: /etc/openerp-server.conf). CONFIGFILE="/etc/openerp-server.conf" # pidfile PIDFILE=/var/run/$NAME.pid # Additional options that are passed to the Daemon. DAEMON_OPTS="-c $CONFIGFILE" [ -x $DAEMON ] || exit 0 [ -f $CONFIGFILE ] || exit 0 checkpid() { [ -f $PIDFILE ] || return 1 pid=`cat $PIDFILE` [ -d /proc/$pid ] && return 0 return 1 } case "${1}" in start) echo -n "Starting ${DESC}: " start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ --chuid ${USER} --background --make-pidfile \ --exec ${DAEMON} -- ${DAEMON_OPTS} echo "${NAME}." ;; stop) echo -n "Stopping ${DESC}: " start-stop-daemon --stop --quiet --pidfile ${PIDFILE} --oknodo echo "${NAME}." ;; restart|force-reload) echo -n "Restarting ${DESC}: " start-stop-daemon --stop --quiet --pidfile ${PIDFILE } --oknodo sleep 1 start-stop-daemon --start --quiet --pidfile ${PIDFI LE} \ --chuid ${USER} --background --make-pidfile --exec ${DAEMON} -- ${DAEMON_OPTS} echo "${NAME}." ;; *) N=/etc/init.d/${NAME} echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 |
2. Change permission and owner for executable.
Run command:
# sudo chmod 755 /etc/init.d/openerp-server
# sudo chown root: /etc/init.d/openerp-server
3. Make logging directory and set permission.
Run command:
# sudo mkdir /var/log/openerp
# sudo chown openerp:root /var/log/openerp
Testing server
1. Start application by command.
# sudo /etc/init.d/openerp-server start
2. Check log.
# less /var/log/openerp/openerp-server.log
3. Open Web browser.
http://<ip_server>:8989
4. Stop server.
# sudo /etc/init.d/openerp-server stop
5. Make script start/stop automatically with Server.
#sudo update-rc.d openerp-server defaults
6. Reboot server to test script and enjoy the application (^_^).
Author : Sitthep Thithuan
ความคิดเห็น
แสดงความคิดเห็น