本安装说明可在ubuntu及debian系统实现,CentOS会略有不同,强烈推荐使用ubuntu
本文档基于安装环境
- Ubuntu 16 64位,阿里云主机/腾讯云主机
- Odoo 12 20191123 社区版
- Postgres 9.6
- Python 3.5.2,操作系统原生
- Nginx 1.12,使用AMH面板安装
- SecureCRT,用于远程登录
- 下载SecrueCRT http://www.cr173.com/soft/4697.html
- 在secureCRT处理好中文乱码问题,同时颜色方案选“绿/黑”,字体选大点,会让你在接下来的操作中舒服很多 https://jingyan.baidu.com/article/948f59245be128d80ff5f9aa.html
- 了解下vi操作指令 Linux中vi编辑器的使用详解_百度经验 https://jingyan.baidu.com/article/59703552e2e1e38fc107405a.html vim 常用快捷键 - 轻典 - 博客园 http://www.cnblogs.com/tianyajuanke/archive/2012/04/25/2470002.html
- 了解postgres常用指令 postgresql 常用命令 - RocTian - 博客园 http://www.cnblogs.com/tzp_8/archive/2012/11/08/2760746.html
- 以下操作使用secureCRT登录至主机操作
8022,80,8069,8888
装sudo http://chenpeng.info/html/964 [一般不用,如果服务器上没有则需安装]
apt-get install -y sudo
这会让你减少很多网络攻击,改 sshd_config 文件,大概第4行将22改为8022 记得要把云服务器的安全策略中的8022端口打开
sudo vi /etc/ssh/sshd_config
sudo service sshd restart
sudo service ssh restart
Ubuntu 16.04 apt-get更换为国内阿里云源 - Door's Dream Blog - CSDN博客 http://blog.csdn.net/Hehailiang_Dream/article/details/54094634
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vi /etc/apt/sources.list
sudo apt-get update
sudo vi /etc/hostname
确认其内容为 sunpopO12
sudo vi /etc/hosts
增加一行 127.0.1.1 sunpopO12
便于后期优化。也可以直接用阿里云自带的高级监控,十分方便
sudo apt install -y htop && sudo apt install -y iotop && sudo apt install -y vmstat && sudo apt install -y lsof
sudo apt install -y nmap && sudo apt install -y tcpdump && sudo apt install -y iostat && sudo apt install -y iotop
sudo apt install -y iptraf && sudo apt install -y iotop && sudo apt install -y acct && sudo apt install -y psacct
sudo apt install -y monit && sudo apt install -y nethogs && sudo apt install -y iftop
默认环境与字体选择 zh_CN.UTF-8 UTF-8
sudo apt install -y aptitude;sudo aptitude install -y locales;sudo dpkg-reconfigure locales
sudo cat /etc/default/locale
确定文件改为如下,然后重启
LANG="zh_CN.UTF-8"
reboot
apt install -y xfonts-utils
sudo apt-get install -y ttf-wqy-* && sudo apt-get install ttf-wqy-zenhei && sudo apt-get install ttf-wqy-microhei && apt-get install -y language-pack-zh-hant language-pack-zh-hans
sudo chmod -R 0755 /usr/share/fonts/truetype/wqy && sudo chmod -R 0755 /usr/share/fonts/truetype/wqy/*
copy 文件 C:\Windows\Fonts中微软雅黑至 /usr/share/fonts/truetype/microsoft
sudo chmod -R 0755 /usr/share/fonts/truetype/microsoft && sudo chmod -R 0755 /usr/share/fonts/truetype/microsoft/*
pfbfer文件夹,放到 /usr/share/fonts/type1之下即可,注意文件权限
sudo chmod -R 0755 /usr/share/fonts/type1/pfbfer
sudo chmod -R 0755 /usr/share/fonts/type1/pfbfer/*
cd /usr/share/fonts/truetype/wqy && sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
cd /usr/share/fonts/truetype/microsoft && mkfontscale && mkfontdir && fc-cache -fv
sudo apt-get install -y ntpdate
sudo systemctl disable ntpd;sudo /etc/init.d/ntp stop;sudo /usr/sbin/ntpdate cn.pool.ntp.org
sudo vi /etc/crontab
在 crontab 中添加如果下语句,每2小时同步一次
0 */2 * * * root /usr/sbin/ntpdate cn.pool.ntp.org
sudo apt-get install -y python3-pip; sudo pip3 install --upgrade virtualenv
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
sudo pip3 install setuptools --upgrade
sudo pip3 install ipython[all]
解决Ubuntu 16.04 SSH 无法远程登录问题_百度经验 https://jingyan.baidu.com/article/6079ad0e97278828ff86dbb7.html
sudo passwd root
sudo vim /etc/ssh/sshd_config
找到:PermitRootLogin prohibit-password禁用 添加:PermitRootLogin yes
sudo service ssh restart
cd && mkdir src && cd src
wget http://nightly.odoo.com/master/nightly/deb/odoo_12.0alpha1.latest_all.deb
sudo apt-get install -y python-software-properties software-properties-common;sudo apt-get install -y add-apt-repository
sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
sudo apt-get install -y wget ca-certificates
su root
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
sudo apt-get update
reboot
sudo apt-get -y upgrade
sudo apt-get install -y postgresql-9.6
ubuntu/debian装完后已初始化库,如果是centos要initdb 。注意中文支持,当更改了locale.conf后,默认用文件中LANG指定的
sudo systemctl enable postgresql.service && sudo systemctl start postgresql.service && sudo systemctl restart postgresql.service
apt install -y nmap
nmap -p 5432 127.0.0.1
ps -ef | grep postgres
sudo -i -u postgres
/usr/lib/postgresql/9.6/bin/pg_ctl -D /var/lib/postgresql/9.6/main -l logfile start
createuser --createdb --no-createrole --no-superuser --pwprompt odoo
http://www.cnblogs.com/jys509/p/4543429.html
Ubuntu PostgreSQL安装和配置 - March On - 博客园 http://www.cnblogs.com/z-sm/archive/2016/07/05/5644165.html
sudo -i -u postgres
psql;
\l;
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'f1';
drop database f1;
dpkg --list | grep postgresql
apt-get purge -y postgresql-10
apt-get purge -y pgdg-keyring
apt-get purge -y postgresql-client-10
apt-get purge -y postgresql-client-common
apt-get purge -y postgresql-common
apt-get purge -y postgresql-9.6
apt-get purge -y pgdg-keyring
apt-get purge -y postgresql-client-9.6
apt-get purge -y postgresql-client-common
apt-get purge -y postgresql-common
sudo aptitude remove -y postgresql-9.6
sudo aptitude install -y postgresql-9.6
pip3 install -r requirements.txt
社区版
cd /src
sudo dpkg -i odoo_12.0alpha1.latest_all.deb;sudo apt-get -f -y install
企业版
cd /src
sudo dpkg -i o12e.deb;sudo apt-get -f -y install
设置自动启动
/lib/systemd/systemd-sysv-install enable odoo
sudo systemctl enable odoo
sudo systemctl start odoo
sudo cat /var/log/odoo/odoo-server.log
- ubuntu/debian
sudo mkdir /usr/lib/python2.7/dist-packages/odoo/odoofile
sudo mkdir /usr/lib/python3/dist-packages/odoo/odoofile
sudo mkdir /usr/lib/python3/dist-packages/odoo/odoofile/sessions
chown -R odoo:odoo /usr/lib/python3/dist-packages/odoo/odoofile/
sudo chmod 755 /usr/lib/python3/dist-packages/odoo/odoofile
sudo chmod 755 /usr/lib/python3/dist-packages/odoo/odoofile/sessions
sudo chmod 755 /usr/lib/python3/dist-packages/odoo/addons
- centos
sudo mkdir /usr/lib/python3/site-packages/odoo/odoofile
sudo chmod 777 /usr/lib/python3/site-packages/odoo/odoofile
sudo apt-get remove --purge odoo
/var/odoo/.local/share/Odoo/
sudo pip3 install vobject qrcode
sudo apt install libldap2-dev libsasl2-dev
sudo pip3 install pyldap
sudo pip3 install num2words
sudo pip3 install pycrypto
sudo pip3 install vobject qrcode
sudo pip3 install phonenumbers
sudo pip3 install xlwt
sudo apt install -y npm && sudo npm install -g cnpm -registry=https://registry.npm.taobao.org
sudo curl -sL https://deb.nodesource.com/setup_4.x | bash -;sudo apt-get install -y nodejs;
sudo npm install -g less less-plugin-clean-css
sudo ln -s /usr/bin/nodejs /usr/bin/node
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb;sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin;sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
除了在nginx反向代理配置8072代理外,要确定已装 gevent,psycogreen,正常odoo已安装,如果没装则执行
sudo apt-get purge python-gevent
sudo pip install gevent
pip install psycogreen==1.0
sudo vi /etc/odoo/odoo.conf
- ubuntu/debian 配置 /etc/postgresql/9.6/main 数据 /var/lib/postgresql/9.6/main 日志
cat /var/log/postgresql/postgresql-9.6-main.log
- centos /var/lib/pgsql/9.6/data
- ubuntu/debian /usr/lib/python3/dist-packages/odoo
- centos /usr/lib/python3/site-packages/odoo
sudo cat /var/log/odoo/odoo-server.log
rm /var/log/odoo/odoo-server.log
sudo rm /var/log/odoo/odoo-server.log
pg 启动停止
su postgres
postgres -D /opt/postgresql/data/ > /opt/postgresql/log/pg_server.log 2>&1 &
odoo 相关
sudo systemctl stop odoo
sudo systemctl start odoo
sudo systemctl status odoo
cd /usr/lib/python3/dist-packages/odoo/
设置 odoo用户可以登陆
vi /etc/passwd
改 odoo:x:112:119::/var/lib/odoo:/bin/bash
指令启动 odoo,在强制更新模块时有用
sudo systemctl stop odoo
su odoo
/usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log --database="ol" --update="app_base_chinese"
sudo cat /var/log/odoo/odoo-server.log
配置ngnix代理,此项请访问 http://amh.sh,建议配置为
wget http://amh.sh/amh.sh && bash amh.sh nginx-1.12,mysql-5.6,php-5.6 2>&1 | tee amh.log
sudo apt-get install -y nginx
vi /etc/nginx/nginx.conf
配置好反向代理
nginx -s reload
https://www.transifex.com/odoo/odoo-12/
访问 http://www.myserver.com:8069 ,即可初始化数据库使用odoo