Avatar

Organizations

2 results for CentOS 7
  • Proxmox VE 官方提供的 Centos 7 模板是有问题的无法正常使用,现在给出解决方案。

    安装

    安装完成后,容器可以启动,但无法关闭、网络无法使用、控制台无法使用,这些都是我们要解决的问题。

    解决方法

    1. ssh登录进入PVE主机
    # 查看 CT 容器列表
    $ pct list
    # 进入 CT 容器
    $ pct enter <VMID>
    
    1. 打开网络
    # 启动网络,从DHCP拿IP地址
    $ ifup eth0
    
    1. 更新 yum 库
    $ curl -o /etc/yum.repos.d/jsynacek-systemd-backports-for-centos-7-epel-7.repo https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo
    $ yum update
    # 安装 sshd
    $ yum install -y openssh-server
    $ systemctl start sshd.service
    $ systemctl enable sshd.service
    
    1. 退出 CT 容器
    $ exit
    $ pct stop <VMID>
    
    1. 重新启动 CT 容器,一切正常—
    CT Container lxc centos 7 linux proxmoxve Created Wed, 31 Jan 2024 21:37:49 +0800
  • 1、查看已安装的Python

    # 查看已安装的信息
    $ yum info python3
    # 查看python安装位置
    $ whereis python3
    

    2、卸载已安装的Python环境

    # 卸载已安装的程序
    $ yum erase python3
    # 删除所有残余文件
    $ whereis python3|xargs rm -frv
    # 查看现有的python
    $ whereis python3
    

    3、yum安装依赖环境

    $ yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
    

    4、官网下载Python3.9.12

    $ yum -y install wget
    # 尽量使用国内镜像站点下载比较快
    $ wget https://mirrors.huaweicloud.com/python/3.9.12/Python-3.9.12.tgz
    

    5、创建安装目录

    $ tar -zxvf Python-3.9.12.tgz -C ./
    $ cd  Python-3.9.12
    $ mkdir /usr/local/python3 
    $ ./configure --prefix=/usr/local/python3.9.12
    $ make && make install
    

    6、创建软链接

    $ ln -s /usr/local/python3.9.12/bin/python3 /usr/bin/python3
    $ ln -s /usr/local/python3.9.12/bin/pip3 /usr/bin/pip3
    

    7、测试

    $ python3 -V
    Python 3.9.12
    
    $ pip3 -V
    pip 22.0.4 from /usr/local/python3.9.12/lib/python3.9/site-packages/pip (python 3.9)
    

    8、pip升级、换源

    # pip升级
    $ python3 -m pip install --upgrade pip
    # pip换源
    # 推荐使用清华的源,因为使用https协议
    $ pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    
    pip CentOS 7 Python Created Fri, 06 May 2022 13:11:27 +0800