一玻淑、更換阿里源
1、備份原文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2帮辟、添加阿里源
sudo vim /etc/apt/sources.list
# 添加在文件最前面
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
3旭绒、更換Python的pip源
在主目錄下創(chuàng)建.pip文件夾,然后在該目錄下創(chuàng)建pip.conf文件
mkdir ~/.pip
vim ~/.pip/pip.conf
pip.conf文件編寫(xiě)如下內(nèi)容保存(更換為阿里源):
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
4、更新系統(tǒng)
sudo apt update && sudo apt upgrade -y
若出現(xiàn)”Release 404 ?Not Found [IP: 221.130.253.135 8080]N: 無(wú)法安全地用該源進(jìn)行更新扬绪,所以默認(rèn)禁用該源】氵耄“的報(bào)錯(cuò)則進(jìn)入到Ubuntu 18.04系統(tǒng)的/etc/apt/sources.lisd.d目錄中根據(jù)上面的錯(cuò)誤提示(沒(méi)有Release文件)刪除對(duì)應(yīng)的文件或目錄挤牛,如果沒(méi)有名字相同的要用記事本一一打開(kāi)查找該源并刪除。
二种蘸、安裝 Python 3并配置環(huán)境變量 (odoo13需3.6及以上版本)
sudo apt install git python3 python3-pip build-essential wget python3-dev python3-wheel libxslt1-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools -y(安裝依賴前必須裝這個(gè)不然會(huì)報(bào)錯(cuò))
echo alias python=python3 >> ~/.bashrc
source ~/.bashrc
三墓赴、添加libpng12-0存儲(chǔ)庫(kù),wkhtmltopdf將使用此依賴
sudo add-apt-repository universe
sudo add-apt-repository "deb http://mirrors.aliyun.com/ubuntu/ xenial main"
sudo apt update && sudo apt upgrade -y
下載安裝wkhtmltopdf(建議提前下載好)
# wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb
# sudo dpkg -i wkhtmltox_0.12.5-1.trusty_amd64.deb
# sudo apt --fix-broken install -y
# 進(jìn)入文件下載路徑解壓
# sudo apt-get install gdebi
sudo gdebi wkhtmltox_0.12.5-1.trusty_amd64.deb
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
四航瞭、安裝中文字體
sudo apt install fonts-wqy-zenhei fonts-wqy-microhei -y
五诫硕、安裝依賴包
在requirements.txt路徑下打開(kāi)終端:
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# sudo pip3 install -r https://github.com/odoo/odoo/raw/13.0/requirements.txt# sudo pip3 install -r https://github.com/odoo/odoo/raw/12.0/requirements.txt# 因源碼包里面一般都有requirements.txt,因此一般直接pip3 install -r requirements.txt安裝即可刊侯,無(wú)需用網(wǎng)絡(luò)地址安裝章办。
如果啟動(dòng)Werkzeug報(bào)錯(cuò)
pip uninstall Werkzeug
pip install Werkzeug==0.11.15
sudo apt-get install libpq-dev
pip install psycopg2
六、安裝Postgresql12
1滨彻、安裝
sudo apt-get install postgresql-12
2纲菌、檢查 PostgreSQL 是否正在運(yùn)行
service postgresql status
3、登錄賬戶:
sudo?su?postgres
psql
4疮绷、修改密碼
ALTER USER postgres WITH PASSWORD?'my_password';
5、創(chuàng)建用戶
CREATE USER my_user WITH PASSWORD?'my_password';
6嚣潜、賦予權(quán)限
ALTER USER my_user WITH SUPERUSER;
7冬骚、刪除用戶
DROP USER my_user;
8、創(chuàng)建用戶
CREATE ROLE odoo WITH LOGIN SUPERUSER CREATEDB CREATEROLE INHERIT REPLICATION CONNECTION LIMIT -1 PASSWORD '123456';
9懂算、查看用戶
\du
10只冻、退出
\q
11、開(kāi)啟遠(yuǎn)程連接
sudo vim /etc/postgresql/10/main/postgresql.conf
listen_addresses = '*'(# listen_addresses = '*'前添加,60行)
sudo vim /etc/postgresql/10/main/pg_hba.conf
host? ? all? ? ? ? ? ?? all? ? ? ? ? ?? 0.0.0.0/0? ? ? ? ? ? ?? md5(# IPv4 local connections后添加,96行)
12计技、重啟數(shù)據(jù)庫(kù)
sudo service postgresql restart
七喜德、安裝Odoo13
克隆代碼(可選,也可在Odoo Nightly builds下載源碼包或使用已有源碼包解壓垮媒,假設(shè)解壓路徑為/opt)
# git clone https://www.github.com/odoo/odoo --depth 1 -b 13.0
# git clone https://gitee.com/mirrors/odoo -b 13.0 --depth=1
# git clone https://www.github.com/odoo/odoo --depth 1 -b 12.0
# pip3 install phonenumbers # 可選
進(jìn)入文件下載路徑解壓(建議)
#sudo tar -xvf odoo_13.0.latest.tar.gz -C /opt/
unzip odoo_13.0.20200824.zip
# 改名
mv odoo-13.0.post20200824/ odoo13
# 復(fù)制出odoo-bin
cp setup/odoo odoo-bin
#創(chuàng)建執(zhí)行權(quán)限文件(可選)
sudo chmod +x odoo-bin
八舍悯、創(chuàng)建并編輯Odoo配置文件
sudo vim /etc/odoo.conf
[options]
; This is the password that allows database operations:
; admin_passwd = admin
; xmlrpc_port = 8888
db_host = False
db_port = 5433
db_user = odoo
db_password = odoo
addons_path = /opt/odoo/odoo/addons
九航棱、啟動(dòng)Odoo
python3 /odoo13/odoo-bin -c /etc/odoo.conf &(加上此符號(hào)當(dāng)關(guān)閉cmd時(shí)服務(wù)不會(huì)關(guān)閉)
python3 /home/vwpt/odoo13/odoo-bin -c /home/vwpt/odoo.conf
十、防火墻開(kāi)放端口
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --reload
內(nèi)網(wǎng)可直接關(guān)閉防火墻
sudo ufw disable
查看防火墻當(dāng)前狀態(tài)
sudo ufw status