修改Linux软件源

作者: 正踪大米饭儿 | 来源:发表于2019-01-21 11:42 被阅读3次

生物信息中,常用的Linux发行版为 Ubuntu 以及CentOS。本文以设置清华大学软件源为例,更改替换 Ubuntu 18.04 及 CentOS7 系统安装完成后的默认软件源。

Ubuntu 18.04

Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak,然后,将该文件替换为下面内容,即可使用 TUNA 的软件源镜像。

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

然后,更新升级系统。

sudo apt-get update
sudo apt-get upgrade

CentOS 7

首先备份 CentOS-Base.repo sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
之后启用 TUNA 软件仓库, 将以下内容写入 /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
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

然后,更新软件包缓存 sudo yum makecache

相关文章

  • 多快好省,Linux下载及软件源修改(含python)

    目录 linux发行版下载 linux软件源配置 pip软件源修改 前言:折腾linux及python多年,竟不了...

  • 修改Linux软件源

    生物信息中,常用的Linux发行版为 Ubuntu 以及CentOS。本文以设置清华大学软件源为例,更改替换 Ub...

  • Linux修改软件源

    以Ubuntu16.04为例 操作步骤 1 备份原来的源文件 2 编辑源文件 编辑器打开源文件 清空后输入以下内容...

  • ubuntu16.04开始使用

    第一步: 修改yum源,由于众所周知的原因,使用Linux安装软件如果不使用国内源,基本上在线安装软件没戏。 如何...

  • Linux 软件安装与管理入门(deb系)

    Linux Linux 软件安装与管理入门(deb系) 杨博远 源代码编译 下载安装包 软件源 软件源可以是网络...

  • 开源与闭源

    开源指的是那些源代码或源设计可以被大众使用、修改发行的软件或设计体,闭源就是不开放源代码。 Linux 无疑是开源...

  • kali linux 更新源集合

    1. 什么是 linux 源 更新源是 linux 必不可少的软件获取仓库,安装软件时,程序从源获取软件包,才能下...

  • pip修改软件源(win+linux)

    windows: pip config set global.index-url https://mirrors....

  • docker swarm部署minio集群

    安装系统 略 更换软件源 首先备份原来的软件源并另存: 编辑软件源文件 注释所有软件源 阿里云源: 清华源 修改完...

  • Docker 常用工具

    替换 apt 源 Dockerfile 修改 debian 设置软件源为阿里云

网友评论

    本文标题:修改Linux软件源

    本文链接:https://www.haomeiwen.com/subject/gstcjqtx.html