Linux分类及软件包管理工具
一、Linux分类
一般来说linux系统基本上分两大类:
RedHat系列:Redhat、Centos、Fedora等
Debian系列:Debian、Ubuntu等
RedHat 系列
- 常见的安装包格式 rpm包,安装rpm包的命令是“rpm -参数”
- 包管理工具 yum
- 支持tar包
Debian系列
- 常见的安装包格式 deb包,安装deb包的命令是“dpkg -参数”
- 包管理工具 apt-get
- 支持tar包
二、yum
yum是RedHat系列的高级软件包管理工具
- 主要功能是更方便的添加/删除/更新RPM包。
- 它能自动解决包的依赖性问题。
- 它能便于管理大量系统的更新问题。
yum的特点
- 可以同时配置多个资源库(Repository)
- 简洁的配置文件(/etc/yum.conf)
- 自动解决增加或删除rpm包时遇到的倚赖性问题
- 保持与RPM数据库的一致性
yum可以用于运作rpm包,例如在CentOS/RedHat系统上对某个软件的管理
安装:yum install <package_name>
卸载:yum remove <package_name>
更新:yum update <package_name>
三、apt-get
apt-get是Debian系列的高级软件包管理工具
- 配置文件/etc/apt/sources.list
apt-get可以用于运作deb包,例如在Ubuntu上对某个软件的管理:
安装:apt-get install <package_name>
卸载:apt-get remove <package_name>
更新:apt-get update <package_name>
什么是源?
源就是 来源 。 就是你安装软件时,程序从哪里获取软件包(安装程序在你的机器上,但需要安装的东西却在软件源服务器上)。 可理解为软件仓库。
常见镜像源:
清华大学镜像源: mirrors.tuna.tsinghua.edu.cn/
中科大镜像源: mirrors.ustc.edu.cn/
网易镜像源: mirrors.163.com/
阿里镜像源: developer.aliyun.com/mirror/
python pip源
清华大学:pypi.tuna.tsinghua.edu.cn/simple
阿里云:mirrors.aliyun.com/pypi/simple…
中国科技大学 :pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:pypi.hustunique.com/
山东理工大学:pypi.sdutlinux.org/
什么是镜像?
镜像,原意是光学里指的物体在镜面中所成之像。引用到电脑网络上,一个网站的镜像是指对一个网站内容的拷贝。镜像通常用于为相同信息内容提供不同的源,特别是在下载量大的时候提供了一种可靠的网络连接。制作镜像是一种文件同步的过程。“镜像网站”(英文:Mirror sites),又译作““镜像站点” ,亦即把一个互联网上的网站数据“拷贝”到本地服务器,并保持本地服务器数据的同步更新,因此也称为“复制网络站点” 。 镜像源就是把官方的源做一个镜像,可以在这下载软件。
为什么要换源?
ubuntu官方源在国外,下载软件可能会很慢,这时候就需要换成国内的镜像源。
更换步骤
1. 备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.使用vim编辑器打开sources.list文件,进行修改
sudo vim /etc/apt/sources.list
sudo apt-get install vim安装vim编辑器
3.将源文件内容全部注释,并添加其他源
vim 编辑器基本操作:
- 字母 i 键为插入功能;
- #为注释符号;
- ESC键 + wq + ! 强制保存退出;
1.注释源文件
2.复制清华源,并粘贴在sources.list 中
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security multiverse
3. 保存源文件
4.更新源
sudo apt-get update