被围观了 6,365 次

环境:CentOS 6.0 X86_64,OpenERP 6.1-1

1、准备源码包
# cd /tmp
# wget http://nightly.openerp.com/6.1/nightly/src/openerp-6.1-20120512-233338.tar.gz

2、安装需要的软件包
# yum install -y pychart python-pip
# pip-python install werkzeug
# yum install -y python-dateutil python-feedparser python-gdata libxslt-python python-lxml python-mako python-psyscopy2 python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-xlwt python-paml python-zsi
# yum install -y python-openid

3、创建用户
# useradd -r -d /opt/openerp -m openerp
# su - openerp -s /bin/bash
$ tar -zxf /tmp/openerp-6.1-20120512-233338.tar.gz

$ mv openerp-6.1-20120512-233338 server
$ exit

4、安装数据库
# yum install -y postgresql-server postgresql
# su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp_id"
---输入密码123456

5、配置文件
# cat >/etc/openerp-server.conf << EOF
db_host = database
db_port = False
db_user = openerp_id
db_password = 123456
logfile = /var/log/openerp/openerp-server.log
EOF

# chown openerp: /etc/openerp-server.conf
# chmod 640 /etc/openerp-server.conf
# mkdir /var/log/openerp
# chown openerp:root /var/log/openerp
# mkdir /var/run/openerp
# chown openerp /var/run/openerp

6、启动服务
# su - openerp -s /bin/bash -c "/opt/openerp/server/openerp-server --config=/etc/openerp-server.conf  --pidfile=/var/run/openerp/openerp-server.pid"

7、制作服务启动脚本
# cat >/etc/init.d/openerp-server <<E"O"F

#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/binNAME=openerp-server
USER=openerpDAEMON=/opt/openerp/server/openerp-server
PID_DIR=/var/run/openerp
PIDFILE=$PID_DIR/$NAME.pid
CONFIGFILE="/etc/openerp-server.conf"
DAEMONOPTS="--config=$CONFIGFILE --pidfile=$PIDFILE"
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
do_start() {
if [ -f $PIDFILE ]; then
echo "pidfile already exists: $PIDFILE"
exit 1
fi
echo -n "Starting $NAME: "
if [ ! -d $PID_DIR ]
then
mkdir $PID_DIR
chown $USER $PID_DIR
fi
su - $USER -c "nohup $DAEMON $DAEMONOPTS >/dev/null 2>&1 &"
sleep 3
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
do_stop() {
echo -n "Stopping $NAME: "
checkpid
if [ $? -eq 0 ]; then
pid=`cat $PIDFILE`
kill -15 $pid
sleep 2
if [ $? -eq 1 ]; then
echo "Failed. (pidfile found but process didn't exist)"
fi
fi
/bin/rm -rf $PIDFILE
echo "done."
}
do_status() {
echo -n "Checking $NAME: "
checkpid
if [ $? -eq 1 ]; then
echo "stopped."
else
echo "running."
fi
}
do_restart() {
do_stop
do_start
}
case "$1" in
start) do_start ;;
stop) do_stop ;;
restart|force-reload) do_restart ;;
status) do_status ;;

*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

 

EOF

 
目前有2条回应
Comment
Trackback
Loading ....
  • 歌瑞尔 回应于2012/06/07 08:10 回复TA

    爽。。我都羡慕了。

  • Tee 回应于2013/02/27 06:40 回复TA

    第二步,第二条语句就执行不了
    建立用户的时候不用建立 postgres 吗?

    没有安装成功,可能自己菜吧

  • 本篇文章没有Trackback
你目前的身份是游客,请输入昵称和电邮!

Verify Code   If you cannot see the CheckCode image,please refresh the page again!