Linux常用软件管理(yum|rpm|apt|pip|npm)

软件管理

文章目录

  • 软件管理
    • yum
      • 更换源
    • rpm
    • apt-get
      • debian源
    • pip
    • npm

RedHat: yum,rpm
Debian: apt-get

yum

yum install package_name #下载并安装一个rpm包
yum update package_name #更新一个rpm包
yum remove package_name #删除一个rpm包
yum list #列出当前系统中安装的所有包
yum search package_name #在rpm仓库中搜寻软件包
yum clean all #删除所有缓存的包和头文件
yum install -y yum-utils #安装yum工具
yum makecache #建立缓存

更换源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache

rpm

rpm -ivh *.rpm # 安装
yum install *.rpm # rpm包也可以用yum安装
rpm -qa | grep mysql # 搜索指定rpm包是否安装
rpm -q mysql # 查询程序是否安装
rpm -ql mysql   # 查询程序安装位置
rpm -ivh  /../mysql.rpm  # 按路径安装并显示进度
rpm -qa | grep java # 查看已安装的相关软件

卸载:  rpm -e --nodeps java-1.4.2...
或者使用yum:yum -y remove java-1.4.2...

更新(启动或停止)和查询系统服务的运行级信息
chkconfig --add mysqld
chkconfig --list mysqld
netstat -anp | grep mysqld

apt-get

apt-cache search package #搜索软件包
apt-cache show package  #获取包的相关信息,如说明、大小、版本等
apt-cache depends package #了解使用该包依赖那些包
apt-cache rdepends package #查看该包被哪些包依赖

apt-get install package #安装包
apt-get install package --reinstall   #重新安装包
apt-get -f install   #修复安装
apt-get remove package #删除包
apt-get remove package --purge #删除包,包括配置文件等
apt-get update  #更新源
apt-get upgrade #更新已安装的包
apt-get dist-upgrade #升级系统
apt-get build-dep package #安装相关的编译环境
apt-get source package  #下载该包的源代码
apt-get clean && sudo apt-get autoclean #清理无用的包
apt-get check #检查是否有损坏的依赖

whereis package  #查看包位置

debian源

vi /etc/apt/sources.list

deb https://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb https://mirrors.aliyun.com/debian-security stretch/updates main
deb-src https://mirrors.aliyun.com/debian-security stretch/updates main
deb https://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

pip

~/.pip/pip.conf
    
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple 
[install]  
trusted-host=pypi.tuna.tsinghua.edu.cn
disable-pip-version-check = true  
timeout = 6000 
    
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

也可以使用命令:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

npm

vi ~/.npmrc 
registry=https://registry.npm.taobao.org

你可能感兴趣的:(Linux)