當(dāng)前位置:首頁 > IT技術(shù) > 數(shù)據(jù)庫 > 正文

Centos 5源及 MySQL 5.0安裝
2021-12-13 17:57:19

最近需要使用古老的 MySQL 5.0版本做測試。經(jīng)過版本歷史查詢得知MySQL 5.0是2005-2009年間的版本,為了成功安裝不出現(xiàn)兼容性問題,該時間段對應(yīng)的可選操作系統(tǒng)版本有 centos 5(沒有選用我最熟悉的 debian/ubuntu 的原因是因?yàn)?MySQL 5.0.45版本沒有對應(yīng)的 deb pre-built 包)。在docker hub 中找到一個centos5的系統(tǒng)

?

本地拉取鏡像后運(yùn)行起來,在更新這個新運(yùn)行起來的系統(tǒng)軟件倉庫信息時,報(bào)了錯誤,如下圖:

?

經(jīng)搜索查閱得知,centos 5已經(jīng)EOL停止維護(hù),且對應(yīng)的源也下線了。所以在 update 倉庫索引信息時,報(bào)了如上錯誤。在網(wǎng)上找到一個可用的騰訊源,如下:

[base]
name=CentOS-5.8 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=5.8&arch=$basearch&repo=os
baseurl=http://mirrors.cloud.tencent.com/centos-vault/5.8/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
#released updates 
[updates]
name=CentOS-5.8 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=5.8&arch=$basearch&repo=updates
baseurl=http://mirrors.cloud.tencent.com/centos-vault/5.8/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
#additional packages that may be useful
[extras]
name=CentOS-5.8 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=5.8&arch=$basearch&repo=extras
baseurl=http://mirrors.cloud.tencent.com/centos-vault/5.8/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.8 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=5.8&arch=$basearch&repo=centosplus
baseurl=http://mirrors.cloud.tencent.com/centos-vault/5.8/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-5.8 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5.8&arch=$basearch&repo=contrib
baseurl=http://mirrors.cloud.tencent.com/centos-vault/5.8/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

將上面的源替換覆蓋掉/etc/yum.repos.d/CentOS-Base.repo中的內(nèi)容后,進(jìn)行三步曲:

yum clean all
yum makecache
yum update

執(zhí)行第二個命令時,依舊報(bào)錯:

Loaded plugins: fastestmirror
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/libselinux/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: libselinux

看報(bào)錯內(nèi)容,大致是libselinux這個倉庫有問題,于是 rm /etc/yum.repos.d/libselinux.repo?刪除這個倉庫文件后,再繼續(xù)前面三步曲中的命令。此時三個命令都執(zhí)行成功。(如果依舊失敗,可以看看是不是配置了fastestmirror,可以在/etc/yum/pluginconf.d/fastestmirror.conf文件中將enabled設(shè)為0以禁用)

接著安裝 MySQL server 包:yum localinstall MySQL-server-community-5.0.45-0.rhel5.x86_64.rpm -y,安裝時報(bào)錯“Public key for MySQL-server-community-5.0.45-0.rhel5.x86_64.rpm is not installed”,從返回的關(guān)鍵詞看應(yīng)該是 key 之類的安全校驗(yàn)沒過,使用 yum localinstall MySQL-server-community-5.0.45-0.rhel5.x86_64.rpm -y --nogpgcheck命令(增加不檢查 gpg key 選項(xiàng))重新安裝完成。

再安裝 MySQL client 包:yum localinstall MySQL-server-community-5.0.45-0.rhel5.x86_64.rpm -y --nogpgcheck,同樣安裝完成。

最后根據(jù)安裝MySQL server 包時給出的提示設(shè)置一次 root 密碼。

?

?最終,大功告成。

?

本文摘自 :https://www.cnblogs.com/

開通會員,享受整站包年服務(wù)立即開通 >