0x01 前言
技能大赛的题目里面用的是CentOS的系统,本来觉得没什么,居然要装上Python3的版本,尝试了各种办法去下载python.
中间用了curl
和 wget
的下载方式,提示,说不能建立SSL,办法就是更新wget
这个工具,我想我还是自己下载吧。
然而浏览器也是
0x02 源代码安装Python3
下载Python3软件包
老系统就安装那么新的版本了,就选择了一个3.5的,在实体机下载的,因为浏览器也不支持ssl,只能在实体机下载了软件包然后拉到虚拟机里面。 下载地址:https://www.python.org/downloads/release/python-355/ 把文件放到用户的主目录,然后切换到root。
安装Python3
先解压
tar zxvf Python-3.5.4.tgz
然后进入
cd Python-3.5.4
编译安装
./configure prefix=/usr/local/python3
make && make install
这里需要等一段时间,安装好之后,因为CentOS原本就自带了Python2的版本,所以我们可以软链到/usr/bin的目录下,并改名为python3。
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
安装完成后
0x03 配置yum源
但是很多库文件要下载,pip也要安装,网上都是用yum安装pip的,所以只得更新下yum源了。 我开始是去百度找的,但是那些都过期了,就去官网找。 http://mirror.centos.org/centos/5.5/readme 里面只有一个readme,内容是
This directory (and version of CentOS) is deprecated. For normal users, you should use /5/ and not /5.5/ in your path. Please see this FAQ concerning the CentOS release scheme: https://wiki.centos.org/FAQ/General If you know what you are doing, and absolutely want to remain at the 5.5 level, go to http://vault.centos.org/ for packages. Please keep in mind that 5.5 no longer gets any updates
然后我又去找5版本的目录http://mirror.centos.org/centos/5/readme
This directory (and version of CentOS) is depreciated.
CentOS-5 is now past EOL You can get the last released version of centos 5.11 here: http://vault.centos.org/5.11/ Please NOTE: this is not being maintained for security since moving to Vault. It will have security issues, you should upgrade to a new version instead.
说已经弃用了,叫我去这里找http://vault.centos.org/5.11/
记得修改钱备份你的文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
然后
vi /etc/yum.repos.d/CentOS-Base.repo
输入一下内容
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://vault.centos.org/5.11/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://vault.centos.org/5.11/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://vault.centos.org/5.11/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-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://vault.centos.org/5.11/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-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=http://vault.centos.org/5.11/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5</span></strong></span>
最后执行
yum makecache
yum update
等待更新就行了
0x04 结束
又鼓捣了一个下午,每周一洞的文章还没写,现在比赛时间太紧了。
0x05 参考
https://blog.csdn.net/qq_36357820/article/details/77732656
- 原文作者: F0rmat
- 原文链接: https://xxe.icu/centos-5.x-yum-source-configuration.html
- 版权声明:本作品采用 署名 - 非商业性使用 4.0 国际 (CC BY-NC 4.0)进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。