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

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

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

?

本地拉取鏡像后運(yùn)行起來(lái),在更新這個(gè)新運(yùn)行起來(lái)的系統(tǒng)軟件倉(cāng)庫(kù)信息時(shí),報(bào)了錯(cuò)誤,如下圖:

?

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

[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í)行第二個(gè)命令時(shí),依舊報(bào)錯(cuò):

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)錯(cuò)內(nèi)容,大致是libselinux這個(gè)倉(cāng)庫(kù)有問(wèn)題,于是 rm /etc/yum.repos.d/libselinux.repo?刪除這個(gè)倉(cāng)庫(kù)文件后,再繼續(xù)前面三步曲中的命令。此時(shí)三個(gè)命令都執(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,安裝時(shí)報(bào)錯(cuò)“Public key for MySQL-server-community-5.0.45-0.rhel5.x86_64.rpm is not installed”,從返回的關(guān)鍵詞看應(yīng)該是 key 之類的安全校驗(yàn)沒(méi)過(guò),使用 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í)給出的提示設(shè)置一次 root 密碼。

?

?最終,大功告成。

?

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

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