First, Software Installation
- Rpm
rpm -ivh zziplib-0.13.62-5.el7.x86_64.rpm //安装zziplib-0.13.62-5.el7.x86_64.rpmrpm -qf `which cd` //查看cd的包名,这里使用反引号,rpm会取反引号中命令的结果作为参数,rpm包格式,包名、版本号、发布版本号、平台rpm -ivh rpm包文件 //安装rpm -Uvh rpm包文件 //升级rpm -e 包名 //卸载rpm -qa //查询安装的包rpm -q 包名 //查询指定包是否安装rpm -qi 包名 //查询指定包信息rpm -ql 包名 //列出包安装的文件rpm -qf 文件绝对路径 //查看一个文件是由哪个包安装的
- Yum
yum list //列出可用rpm包yum search vim //搜索名字包含vim的包yum install [-y] 安装包,不加-y安装时会询问是否安装,加上-y就会不询问直接安装ls /etc/yum.repos.d/ //查看yum源yum list installed //查看已经安装过的包yum grouplist //列出可用的组yum groupinstall [-y] //安装组yum remove [-y] //卸载一个包,包括它的依赖yum update [-y] //升级包yum provides “/*/vim” //查找含有vim命令的包 yum list | grep ‘vim‘ //将yum list 的结果去运行grep ‘vim‘查询包含vim的包名
- Replace the Yum source
实际上就是更换repo文件cd /etc/yum.repos.d/rm -rf CentOS-Base.repo //删除默认源wget http://mirrors.163.com/.help/CentOS7-Base-163.repo //安装网易源,如果没有安装wget命令,就用下一条命令安装curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
- Installing the extension source
yum install -y epel-release
- Download RPM packages via Yum
yum install -y 包名 --downloadonly //只下载安装包不安装ls /var/cache/yum/x86_64/7/ //安装包默认下载路径yum install -y 包名 --downloadonly --downloaddir=路径 //指定yum下载的安装包路径yum reinstall -y 包名 --downloadonly --downloaddir=路径 //下载已安装过的软件的rpm包
- SOURCE Installation
Source package as far as possible to put into the/usr/local/src/directorycd /usr/local/src/wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gztar zxvf httpd-2.2.34.tar.gz //解包cd httpd-2.2.34./configure --prefix=/usr/local/apache2 //指定编译目录为/usr/local/apache2make //编译echo $? //如果非零则说明make出错,基本是有依赖未安装,是0则make成功make install //安装
Linux common commands 5 yum, source installation