希志あい 希志愛野 Kishi Aino
希志あい 希志愛野 Kishi Aino

Oracle Linux 8初始化環境設定

2020年底的大爆炸消息就是CentOS官方宣布日後將專注於CentOS Stream,更是將CentOS 8的EOL(支援日期)從原先的2029年直接砍到2021年底(CentOS 7則是2024年6月30日)🙀 也就是說目前的發行順序

Fedora -> Redhat -> CentOS
之後將會變成
Fedora -> CentOS Stream -> Redhat

從上游變下游,活生生變成小白鼠一族 😱🥶😱

CentOS Project shifts focus to CentOS Stream – Blog.CentOS.org
https://blog.centos.org/2020/12/future-is-centos-stream/

身為使用RHEL家族的老用戶自然覺得會不爽,變成小白鼠就算了,別家系統是一個大版本撐5年,CentOS一個大版本撐10年,結果現在一刀揮下砍到支援時間都只剩一年 👺 但不爽也沒辦法,雖然有原CentOS創始人Gregory Kurtzer立刻開闢的新項目:Rocky Linux,但暫時還沒有任何可測試的資源的情況下,只能先尋求其他的解決方案 👹

這段時間我在Oracle Cloud Free Tier試用了一下Oracle Linux 8,其優點是該系統一直是免費、也是RHEL家族、有官方支援、並且非常臭屁的說其系統還有UEK (Unbreakable Enterprise Kernel) 號稱堅若磐石的內核可選,看在宣布與RHEL相容的關係下,再加上有0800的客服支援,個人覺得還是可以嘗試看看的,個人一些心得放到部落格作個筆記 🏄‍♂️⛷🏄‍♀️

ref.

初始化環境設定

# 修改主機名稱 🤓

hostnamectl set-hostname oracle-tyo01.520.be && hostname oracle-tyo01.520.be
exec bash

# 設定DNS 🤓

cat <<"EOF" > /etc/reslov.conf
nameserver 1.1.1.1
nameserver 9.9.9.9
nameserver 2001:2001::
nameserver 2620:fe::fe
EOF
# cat /etc/reslov.conf

# 啟用EPEL Repo並且安裝常用軟體、更新系統 🤓

dnf install -y dnf-plugins-core redhat-lsb-core sudo
sudo dnf install -y oracle-epel-release-el8 oraclelinux-developer-release-el8
sudo dnf config-manager --set-enabled ol8_developer_EPEL ol8_developer_UEKR6
sudo dnf makecache
sudo dnf install -y make gcc screen perl tar unzip gzip bzip2 xz ftp mtr traceroute wget curl mutt crontabs htop mlocate net-tools bind-utils lsof ncdu
sudo dnf update -y
# dnf repolist

# mutt郵件設定 🤓

cat <<"EOF" > ~/.muttrc
set from="root@localhsot"
set charset="utf-8"
set send_charset="utf-8"
set attach_charset="utf-8"
EOF
clear
sed -i "s/^set from=.*$/set from='root@`cat /etc/hostname`'/g" ~/.muttrc
# cat ~/.muttrc | grep from

# 修改hosts for IPv6,沒有IPv6的改用下一個 🤓

rm -f /etc/hosts.bak
mv -f /etc/hosts /etc/hosts.bak
sudo bash -c "echo '127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
`/usr/bin/curl -4 icanhazip.com`  `cat /etc/hostname`
`/usr/bin/curl -6 icanhazip.com`  `cat /etc/hostname`' > /etc/hosts"
clear
cat /etc/hosts
# vi /etc/hosts

# 修改hosts for IPv4 🤓

sudo bash -c "echo '127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
`/usr/bin/curl -4 icanhazip.com`  `cat /etc/hostname`' > /etc/hosts"
clear
cat /etc/hosts

以上就是大概的初始環境設定,其實大多常見的網站環境相關如httpd(2.4.37)、nginx(1.14.1)、php(7.2)、mysql(8.0)、mariadb(10.3)、git(2.27)等等的軟體都有提供 🤓

dnf list httpd-\*
dnf list nginx-\*
dnf list php-\*
dnf list mysql-\*
dnf list mariadb-\*

另外有興趣的也可以安裝UEK的內核 🤓

sudo dnf install -y kernel-uek
systemctl reboot
uname -r

ref.

CentOS 7/8轉換成Oracle Linux

Oracle也真的是老賊老賊的,不找不知道,他們居然有推出一支無痛轉換的小程式:centos2ol,這個就是比較推薦的作法了,假設2021年底還沒有什麼好消息,我應該是會轉投Oracle Linux或Debain的懷抱。而centos2ol用法也很簡單 🤓🤖🤓

wget https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh
chmod +x centos2ol.sh
sudo bash centos2ol.sh

重開機之後再進行一次更新系統 🤓

systemctl reboot
dnf update -y
cat oracle-release

ref.

CentOS 8升級CentOS Stream

我相信其實很多人覺得其實還好,反正Linux系統本來就很難操壞,而且裝了主機控制台之後就很少動到系統了,就算變成小白鼠又如何,備份做好比較實在。這我真的同意,因為我也會很懶得動,但真的比較不建議這樣做,當小白鼠真的很麻煩,除非大多的軟體都是用編譯的才稍稍有可能會幸運些不會碰到怪手,所以如果沒有使用主機控制台的使用者,當然是可以就認命點,乾脆直接更新成CentOS Stream(使用cPanel、DirectAdmin、Plesk等等的主機控制台的使用者都還得等等,目前還不支援) 🤷‍♂️🤷‍♀️🤷‍♂️

dnf install -y centos-release-stream
dnf swap -y centos-{linux,stream}-repos
dnf distro-sync -y

重開機之後再進行一次更新系統 🤓

systemctl reboot
dnf update -y
cat /etc/centos-release

ref.

關於 窮苦人家的小孩

In every democracy, the people get the government they deserve. ~Alexis de Tocqueville
上一篇:
下一篇:

您可能會喜歡

有坂深雪 Miyuki Arisaka

[Debain]安裝HestiaCP

2021新年快樂 🌞㊗☃ 最近 …

發佈留言