系统环境配置
安装python3.6
sudo apt-get update
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get install python3.6
cd /usr/bin
sudo rm python
sudo ln -s python3.6 /usr/bin/python
sudo rm python3
sudo ln -s python3.6 /usr/bin/python3
安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
安装依赖软件包
sudo apt-get install python3.6-dev
sudo apt-get install libldap2-dev
sudo apt-get install libsasl2-dev
sudo apt-get install libxml2
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install libc6-dev gcc
sudo apt-get install -y make build-essential zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm tk-dev
安装node、npm
sudo apt-get install -y nodejs node-less npm
sudo npm install -g less-plugin-clean-css
安装python包
pip install -r requirements.txt
安装wkhtmltopdf
sudo apt-get install libxfont1 xfonts-encodings xfonts-utils xfonts-base xfonts-75dpi fontconfig
sudo dpkg -i wkhtmltox_*.deb
安装psql
sudo apt-get install -y postgresql
odoo配置
获取odoo13源码
git clone git@github.com:odoo/odoo.git
修改odoo启动配置文件odoo.conf
[options]
addons_path = /opt/odoo-saas/odoo-13.0/addons,/opt/odoo-saas/odoo-13.0/odoo/addons
db_host = localhost
db_maxconn = 64
db_password = ********
db_port = 5432
db_sslmode = prefer
db_user = odoo
dbfilter = ^%h$
http_enable = True
logrotate = True
data_dir = /opt/odoo-saas/odoo-data
logfile = /var/log/odoo-saas/odoo-server.log
wokers=3
http_port = 8069
将odoo添加到服务
vim /etc/init.d/odoo
#!/bin/bash
### BEGIN INIT INFO
# Provides: odoo-saas
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start odoo-saas daemon at boot time
# Description: Enable service provided by daemon.
# X-Interactive: true
### END INIT INFO
## more info: http://wiki.debian.org/LSBInitScripts
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/opt/odoo-saas/odoo-13.0/odoo-bin
NAME=odoo-saas
DESC=odoo-saas
CONFIG=/opt/odoo-saas/odoo13.conf
LOGFILE=/var/log/odoo-saas/odoo-server.log
PIDFILE=/var/run/${NAME}.pid
USER=root
export LOGNAME=$USER
test -x $DAEMON || exit 0
set -e
function _start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --config $CONFIG --logfile $LOGFILE
}
function _stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 3
rm -f $PIDFILE
}
function _status() {
start-stop-daemon --status --quiet --pidfile $PIDFILE
return $?
}
case "$1" in
start)
echo -n "Starting $DESC: "
_start
echo "ok"
;;
stop)
echo -n "Stopping $DESC: "
_stop
echo "ok"
;;
restart|force-reload)
echo -n "Restarting $DESC: "
_stop
sleep 1
_start
echo "ok"
;;
status)
echo -n "Status of $DESC: "
_status && echo "running" || echo "stopped"
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
创建日志目录
mkdir /var/log/odoo-saas/
赋予odoo-bin执行权限
sudo chmod 755 ..../odoo-bin
添加系统服务
sudo update-rc.d odoo defaults
运行odoo
service odoo start
其他操作
停止服务:service odoo stop
重启服务:service odoo restart
查看服务状态:service odoo status