設定環境
這些步驟描述如何在 Oracle Private Cloud Appliance 上安裝 Oracle Cloud Native Environment 之前設定環境。
我們假設已經佈建下列資源:
- 租用戶中的區間。
- 區間中的虛擬雲端網路 (VCN) 若有 DNS 標籤 (此 VCN 已啟用使用 DNS 主機名稱 )。
- 三個工作節點、一個控制節點以及一個運算子節點的運算執行處理。
設定代理主機
在所有節點上設定代理主機 vars in etc bashrc
,讓所有未來的 Shell 階段作業都享有代理主機環境變數的優點。請以下列格式替換適當的代理主機伺服器名稱和連接埠:http://proxy-host:proxy-port
。
if [ ! -f /etc/bashrc.bak ]; then
cp -p /etc/bashrc /etc/bashrc.bak
else
cp -p /etc/bashrc.bak /etc/bashrc
fizz=/tmp/ocne.setup.sh.on_host_to_be_setup
cat <<EOD > $zz
export http_proxy=http://proxy-host:proxy-port
export https_proxy=http://proxy-host:proxy-port
# substitute your domain name for "dm.com"
HOSTNAME=`hostname`
first_3_octets_of_LAN=`nslookup $HOSTNAME.dm.com | grep Address | tail -1 | sed -e 's/Address: //' -e 's/\.[0-9]*$//'`
export
no_proxy='localhost,127.0.0.1,.proxy-host,.oraclecorp.com,.oraclevcn.com,$first_3_octets_of_LAN.0/24,.svc,/var/run/crio/crio.sock,10.96.0.0/12'EOD
cat $zz >> /etc/bashrc
套用作業系統更新項目
套用作業系統修正程式,讓所有節點安全和功能保持在最新狀態。
識別您的作業系統。
Identify Oracle Linux major release
uname -a | sed -e 's/.*\.el//' -e 's/^\(.\).*/\1/'
如果此命令的結果為 8
,則您正在執行 Oracle Linux 8。如果您執行的是 Oracle Linux 7,請使用 yum
而不是 dnf
,請勿傳送額外的引數 --best --allowerasing
。
例如,如果指示如下:
yum --setopt=keepcache=1 xyz
如果您改為在 Oracle Linux 7 上執行,則應該執行以下指令:
dnf --best --setopt=keepcache=1 --allowerasing xyz
在設定 yum
之後,在所有節點上套用作業系統更新,可能 dnf
知道您的代理主機伺服器。
if [ ! -f /etc/yum.conf.bak ]; then
cp /etc/yum.conf /etc/yum.conf.bak
else
cp /etc/yum.conf.bak /etc/yum.conf
fi
echo proxy=http://proxy-host:proxy-port >> /etc/yum.conf
if [ -d /etc/dnf ]; then
if [ ! -f /etc/dnf/dnf.conf.bak ]; then
sudo cp /etc/dnf/dnf.conf /etc/dnf/dnf.conf.bak
else
sudo cp /etc/dnf/dnf.conf.bak /etc/dnf/dnf.conf
fi
cp /etc/dnf/dnf.conf.bak /tmp/dnf.conf
echo proxy=http://proxy-host:proxy-port:80 >> /tmp/dnf.conf
sudo mv /tmp/dnf.conf /etc/dnf/dnf.conf
fi
dnf --best --setopt=keepcache=1 --allowerasing update -y
reboot
設定所有節點上的儲存區域
在所有節點上設定 yum
儲存區域。
configure repos
# if we are on OEL7, do the following:
sudo yum-config-manager --enable ol7_olcne15 ol7_kvm_utils ol7_addons ol7_latest ol7_UEKR6
sudo yum-config-manager --disable ol7_olcne14 ol7_olcne13 ol7_olcne12 ol7_olcne11 ol7_olcne
ol7_developer
# but if we are on Oracle Linux 8, do the following:
sudo dnf -y install oracle-olcne-release-el8
sudo yum config-manager --enable ol8_olcne15 ol8_addons ol8_baseos_latest ol8_appstream
ol8_UEKR6
sudo yum config-manager --disable ol8_olcne12 ol8_olcne13 ol8_olcne14 ol8_developer
安裝 Chrony
#Install chrony on all nodes.
sudo dnf --best --setopt=keepcache=1 --allowerasing -y install chrony
sudo systemctl enable --now chronyd.service
在所有節點停用交換
no swap
swapoff -a
if [ ! -f /etc/fstab.bak ]; then
sudo cp /etc/fstab /etc/fstab.bak
fi
cat /etc/fstab.bak | sed '/[\t ]swap[\t ]/d' > /tmp/fstab
echo diff /etc/fstab.bak /tmp/fstab
diff /etc/fstab.bak /tmp/fstab
sudo cp /tmp/fstab /etc/fstab
echo cat /etc/fstab
cat /etc/fstab
設定操作員節點上的防火牆
operator node firewall
sudo firewall-cmd --add-port=8091/tcp --permanent
sudo firewall-cmd --reload
設定工作節點上的防火牆
worker node firewall
sudo firewall-cmd --zone=trusted --add-interface=cni0 --permanent
sudo firewall-cmd --add-port=8090/tcp --permanent
sudo firewall-cmd --add-port=10250/tcp --permanent
sudo firewall-cmd --add-port=10255/tcp --permanent
sudo firewall-cmd --add-port=8472/udp --permanent
sudo firewall-cmd --add-masquerade --permanent
sudo systemctl restart firewalld.service