配置 Linux 阿里源

该博客介绍了Linux系统更换阿里源的方法。先需查看系统版本,接着分别阐述了YUM源的操作,包括备份CentOS - Base.repo、下载新文件到指定目录、生成缓存,还提及了apt源和pip源的更换相关内容。
部署运行你感兴趣的模型镜像

  首先查看系统版本

1、[root@python ~]# cat /proc/version
Linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017

2、[root@python ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core)

3、[root@python ~]# cat /etc/issue
\S
Kernel \r on an \m

4、[root@python ~]# uname -a
Linux python 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux


查看系统是32位还是64位?
1、[root@python ~]# getconf LONG_BIT
64
   [root@python ~]# getconf WORD_BIT
32
分析:32位的系统中int类型和long类型一般都是4字节,64位的系统中int类型还是4字节的,但是long已变成了8字节,linux 系统中可用 "getconf WORD_BIT"和 "getconf LONG_BIT"获得 word和long的位数 64 位系统中应该分别得到32和64,所以该系统为64位的linux系统。

2、[root@python ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=3d705971a4c4544545cb78fd890d27bf792af6d4, stripped

 一、YUM 源

1、备份CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
如果没有 wget 命令先行下载

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、生成缓存

yum makecache

二、apt 源

sudo cp /etc/apt/source.list /etc/apt/source.list.bak       # 将原有的源文件复制保存
sudo vim /etc/apt/source.list    # 打开源文件

# 将下列的复制到文件中
deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse

# 更新 apt
sudo apt update     
sudo apt upgrade

三、pip 源
 

mkdir .pip              #目标目录下创建.pip文件

sudo vim .pip/pip.conf  #创建pip.conf文件

# 将下面的写入文件中 
    [global]
        index-url = http://mirrors.aliyun.com/pypi/simple/
    [install] 
        trusted-host=mirrors.aliyun.com

 

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值