安装nc
没有可用软件包 nc.x86_64。
[root@spark01 ~]# yum install -y nc
安装epel-release
[root@spark01 ~]# yum install -y epel-release
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
- base: mirrors.aliyun.com
- extras: mirrors.bfsu.edu.cn
- updates: mirrors.aliyun.com
正在解决依赖关系
–> 正在检查事务
—> 软件包 epel-release.noarch.0.7-11 将被 安装
当报 没有可用的安装包的时候就安装下这个
EPEL简介
EPEL (Extra Packages for Enterprise Linux) 是由 Fedora Special Interest Group 为企业 Linux 创建、维护和管理的一个为“红帽系”的操作系统提供额外的软件包,适用于Red Hat Enterprise Linux (RHEL), CentOS, Scientific Linux (SL), Oracle Linux (OL)等系统。
安装wget
[root@spark01 ~]# yum install -y wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
- base: mirrors.aliyun.com
- extras: mirrors.bfsu.edu.cn
- updates: mirrors.aliyun.com
正在解决依赖关系
–> 正在检查事务
—> 软件包 wget.x86_64.0.1.14-18.el7_6.1 将被 安装
–> 解决依赖关系完成
依赖关系解决
安装 net-tools
-- 安装后可以使用 ifconfig 查看网络等信息
yum install -y net-tools
安装 python3
卸载 python 2
[root@spark03 ~]# rpm -qa | grep python
dbus-python-1.1.1-9.el7.x86_64
python-pyudev-0.15-7.el7_2.1.noarch
libselinux-python-2.5-6.el7.x86_64
python-slip-dbus-0.4.0-2.el7.noarch
newt-python-0.52.15-4.el7.x86_64
python-configobj-4.7.2-7.el7.noarch
python-pycurl-7.19.0-19.el7.x86_64
rpm-python-4.11.3-21.el7.x86_64
python-libs-2.7.5-48.el7.x86_64
python-decorator-3.4.0-3.el7.noarch
python-iniparse-0.4-9.el7.noarch
python-slip-0.4.0-2.el7.noarch
python-firewall-0.4.3.2-8.el7.noarch
python-perf-3.10.0-514.el7.x86_64
python-urlgrabber-3.10-8.el7.noarch
-- 删除
rpm -e dbus-python-1.1.1-9.el7.x86_64 --nodeps
rpm -e python-pyudev-0.15-7.el7_2.1.noarch --nodeps
rpm -e libselinux-python-2.5-6.el7.x86_64 --nodeps
rpm -e python-slip-dbus-0.4.0-2.el7.noarch --nodeps
rpm -e newt-python-0.52.15-4.el7.x86_64 --nodeps
rpm -e python-configobj-4.7.2-7.el7.noarch --nodeps
rpm -e python-pycurl-7.19.0-19.el7.x86_64 --nodeps
rpm -e rpm-python-4.11.3-21.el7.x86_64 --nodeps
rpm -e python-libs-2.7.5-48.el7.x86_64 --nodeps
rpm -e python-decorator-3.4.0-3.el7.noarch --nodeps
rpm -e python-iniparse-0.4-9.el7.noarch --nodeps
rpm -e python-slip-0.4.0-2.el7.noarch --nodeps
rpm -e python-firewall-0.4.3.2-8.el7.noarch --nodeps
rpm -e python-perf-3.10.0-514.el7.x86_64 --nodeps
rpm -e python-urlgrabber-3.10-8.el7.noarch --nodeps
注意:上面卸载按照自己的实际情况来额。否则会导致Linux系统某些功能用不上!!!!
-- 获取源码
wget https://www.python.org/ftp/python/3.9.17/Python-3.9.17.tar.xz
[root@spark01 ~]# mkdir -p /opt/python3
-- 获取成功后解压
tar -xvf Python-3.9.17.tar.xz
[root@spark03 ~]# ls
anaconda-ks.cfg Python-3.9.17 Python-3.9.17.tar.xz
[root@spark03 ~]# cd Python-3.9.17
-- 创建安装目录
[root@spark03 Python-3.9.17]# mkdir -p /opt/python3
[root@spark03 Python-3.9.17]# ./configure --enable-shared=enable --prefix=/opt/python3/
configure: WARNING: unrecognized options: --with-ssl
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.9... no
checking for python3... no
checking for python... no
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/Python-3.9.17':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[root@spark03 Python-3.9.17]# ./configure --enable-shared=enable --prefix=/opt/python3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.9... no
checking for python3... no
checking for python... no
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/Python-3.9.17':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
-- 我没有gcc 编译器,需要安装
配置
./configure --enable-shared=enable --prefix=/opt/python3
--prefix 指定安装目录
安装
-- 编译并安装
make && make install
创建软连接
[root@spark01 bin]# ln -s /opt/python3/bin/python3.9 /usr/bin/python3
-- 测试可用性
[root@spark01 ~]# python3
Python 3.9.17 (main, Aug 7 2023, 15:54:05)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
安装gcc
-- c
[root@spark01 Python-3.9.17]# yum install -y gcc
-- C++
[root@spark01 Python-3.9.17]# yum -y install gcc-c++