使用Linux系统一定绕不开的就是软件包管理,当前主要分两类Mac的Homebrew和Linux的yum。
Mac平台
一、 Homebrew 简介
Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。
二、替换源
使用Homebrew可能遇到的问题就是下载慢的场景,常常需要替换成国内源,操作如下:
- 替换brew.git
1、进入目录
cd "$(brew --repo)"
2、设置远端地址
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
- 替换homebrew-core.git
1、进入目录
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
2、设置地址
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
- 刷新源
brew update
三、常用命令
- 显示安装列表
brew list 显示安装列表
- 搜索软件
brew search git
- 安装软件
brew install git
- 卸载软件
brew uninstall git
- 更新软件
brew upgrade git
- 删除软件
brew cleanup git
- 查看哪些软件需要更新
brew outdated
- 更新所有软件
brew upgrade
Linux平台
一、 Yum 简介
Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
二、 替换源
- 打开配置目录:
vim /etc/yum.repos.d/CentOS-Base.repo
- 修改配置内容如下:
#可以将这个mirrorlist注释掉,
mirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=basearch&repo=os。
#然后将baseurl设置成国内的阿里云源
baseurl=http://mirrors.aliyun.com/repo/Centos-6.repo
也可以将原来的备份好然后下载阿里云的源,如下命令
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 配置生效
# 清除系统所有的yum缓存
yum clean all
yum makecache
三、常用命令
- 查看所有yum源
yum repolist all
- 查看可用的源
yum repolist enabled
- 所有已安装和可安装的包
yum list
- 安装软件
yum -y install git
- 查看软件
yum list git
- 卸载软件
yum remove git
- 查看依赖
yum deplist rpm
- 检查可更新软件
yum check-update
- 更新
全部更新:yum update
更新指定包 yum update git
本文暂时没有评论,来添加一个吧(●'◡'●)