之前申請了兩臺 x86 架構的 Oracle 機器,偶爾用來部署開源項目測試,有一臺在測試 SSH 相關功能時 “變磚”,網上看重裝系統發現很繁瑣就沒去打理,近期又想到這個機器,發現去年就有了官方重裝方法,簡單配置下,繼續讓其發光發熱;
’替換引導卷‘ 重裝系統
這是官方提供的方式,在實例詳情中點擊 “操作” - “更多操作” - “替換引導卷”。
無需開啟 “保留引導卷開關”,選擇 “映像” 和 “輸入 OCID” 選項
在?Oracle Cloud Infrastructure Images?可以找到 OCID,注意只能選擇同系統的不同版本,例如 Ubuntu 從 20.04 到 24.04 Minimal,不能從 Centos 7 到 Oracle 9
粘貼后可以看到它自動顯示了鏡像的信息,保持引導卷大小不變。
如想使用新的 SSH Key,可以在高級選項中添加?ssh_authorized_keys
,值為公鑰內容。
讓 Ubuntu 24.04 看起來很忙
忙起來,別閑著
sudo apt update && sudo apt upgradesudo apt install htop git build-essentialcurl -o lookbusy-1.4.tar.gz https://devin.com/lookbusy/download/lookbusy-1.4.tar.gztar xvf lookbusy-1.4.tar.gzcd lookbusy-1.4chmod a+x configure./configuremakesudo make installnohup lookbusy -c 5-15 -r curve > lookbusy.log 2>&1 &
Centos 7 尚能飯否
太久沒登錄,Yum 安裝軟件都開始報錯
Cannot find a valid baseurl for repo: base/7/x86_64
是因為官方不再支持 Centos 7 的鏡像源,編輯?/etc/yum.repos.d/CentOS-Base.repo?文件
- 取消所有?
baseurl
?開頭的注釋。 - 將所有?
mirrorlist.centos.org
?替換為?vault.centos.org
- 將所有?
mirror.centos.org
?替換為?vault.centos.org
- 清理緩存,執行?
sudo yum clean all
編輯后的內容示例如下:
[base]
name=CentOS-$releasever - Base
mirrorlist=http://vault.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://vault.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://vault.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://vault.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
而后更新下軟件
sudo yum update -y
讓 Centos 7 也忙起來
sudo yum -y updatesudo yum -y install htop git?yum groupinstall "Development Tools"curl -o lookbusy-1.4.tar.gz https://devin.com/lookbusy/download/lookbusy-1.4.tar.gztar xvf lookbusy-1.4.tar.gzcd lookbusy-1.4chmod a+x configure./configuremakesudo make installnohup lookbusy -c 5-15 -r curve > lookbusy.log 2>&1 &
題外話
Ubuntu 24.04 Minimal 占用磁盤少很多,安裝一些軟件后,還剩 46 GB
“完整版” Centos 7 安裝同樣的軟件后,還剩 35 GB