常用 pacman,APT,RPM 命令参数

pacman

pacman -S base-devel //安装基本开发工具

-S 安装
-y, –refresh download fresh package databases from the server,同步更新package list列表
-f, –force force install, overwrite conflicting files
-i, –info view package information
-l, –list <repo> view a list of packages in a repo
-w, –downloadonly download packages but do not install/upgrade anything
-g, –groups view all members of a package group,包括运程服务器上的group
-s, –search <regex> search remote repositories for matching strings
-p, –print-uris print out URIs for given packages and their dependencies
-r, –root <path> set an alternate installation root(类似chroot)
-b, –dbpath <path> set an alternate database location
–cachedir <dir> set an alternate package cache location
–ignore <package,…> 不要升级指定的软件包
–ignoregroup base,base-devel 不要升级group中的软件包
–config <path> set an alternate configuration file
–noconfirm do not ask for any confirmation
–noscriptlet do not execute the install scriptlet if one exists

–asdeps install packages as non-explicitly installed
–asexplicit install packages as explicitly installed
-c, –clean remove old packages from cache directory (-cc for all)
-d, –nodeps skip dependency checks
-u, –sysupgrade upgrade all packages that are out of date
–needed don’t reinstall up to date packages
–ignore <pkg> ignore a package upgrade (can be used more than once)
–ignoregroup <grp> ignore a group upgrade (can be used more than once)
-q, –quiet show less information for query and search
–logfile <path> set an alternate log file
–noprogressbar do not show a progress bar when downloading files
-v, –verbose be verbose

-Q 查询
-i, –info view package information (-ii for backup files)
-g, –groups view all members of a package group,仅本地安装的group
-l, –list list the contents of the queried package
-o, –owns <file> query the package that owns <file>
-p, –file <xxx.pkg.tar.gz> 获取该软件包的名称以及版本号
-s, –search <regex> search locally-installed packages for matching strings
-t, –unrequired list all packages not required by any package
-u, –upgrades list all packages that can be upgraded
-v, –verbose be verbose
-r, –root <path> set an alternate installation root
-b, –dbpath <path> set an alternate database location
–cachedir <dir> set an alternate package cache location

-c, –changelog view the changelog of a package
-d, –deps list all packages installed as dependencies
-e, –explicit list all packages explicitly installed
-m, –foreign list installed packages not found in sync db(s)
-q, –quiet show less information for query and search
–config <path> set an alternate configuration file
–logfile <path> set an alternate log file
–noconfirm do not ask for any confirmation
–noprogressbar do not show a progress bar when downloading files
–noscriptlet do not execute the install scriptlet if one exists

-U 升级
-U xxx.pkg.tar.gz 直接安装该软件包,要给出全路径
-c, –cascade remove packages and all packages that depend on them
-d, –nodeps skip dependency checks
-k, –dbonly only remove database entry, do not remove files
-n, –nosave remove configuration files as well
-s, –recursive remove dependencies also (that won’t break packages)
(-ss includes explicitly installed dependencies too)
-u, –unneeded remove unneeded packages (that won’t break packages)
–config <path> set an alternate configuration file
–logfile <path> set an alternate log file
–noconfirm do not ask for any confirmation
–noprogressbar do not show a progress bar when downloading files
–noscriptlet do not execute the install scriptlet if one exists
-v, –verbose be verbose
-r, –root <path> set an alternate installation root
-b, –dbpath <path> set an alternate database location
–cachedir <dir> set an alternate package cache location

 


ref:http://rediceli.blogspot.com/2006/08/debian.html

从源代码编译debian包
以gaim为例
确认所有依赖的包都已经安装好后,可以开始编译gaim包了。编译过程较为简单,通过下面几条命令即可完成:

redice@debian $ dpkg-source -x gaim_1.5.0+1.5.1cvs20051015-5.dsc
redice@debian $ cd gaim-1.5.0+1.5.1cvs20051015
redice@debian $ fakeroot dpkg-buildpackage

构建一个本地包发布库
这样构造出来的包可以通过dpkg直接安装,更好的方式是构造一个类似于非其它Debian非官方的包发布站点的库,这样可以直接通过apt-get或dselect等工具来进行统一的管理。

假设我们只需要在本地构造一套发布库,如/opt/my_packages。建立目录/opt/my_packages,将生成的所有deb扩展名的包复制到该目录,然后通过Debian工具dpkg-scanpackages来生成索引文件。

redice@debian $ mkdir -p /opt/my_packages/{deb,debsrc}
redice@debian $ mv .deb /opt/my_packages/deb
redice@debian $ mv sources/
/opt/my_packages/debsrc
redice@debian $ cd /opt/my_packages/deb/
redice@debian $ dpkg-scanpackages . | gzip -f9 > ./Packages.gz
redice@debian $ cd /opt/my_packages/debsrc/
redice@debian $ dpkg-scansources . | gzip -f9 > Sources.gz

以root身份更新 /etc/apt/sources.list后,即可通过 apt-get 或dselect等工具来安装刚生成的这些Debian包了。
redice@debian # echo “deb file:/opt/my_packages/deb ./“ >> /etc/apt/sources.list
redice@debian # echo “deb-src file:/opt/my_packages/debsrc ./“ >> /etc/apt/sources.list
redice@debian # apt-get update

======================================================================================================

http://blog.chinaunix.net/u/27383/showart_689148.html

aptitude常用命令
aptitude download package

dpkg 常用指令
dpkg -i package.deb 安装包
dpkg -r package 删除包
dpkg -P package 删除包(包括配置文件)
dpkg -L package 列出与该包(已安装的)关联的文件
dpkg -p package Display available version details
dpkg -s package Report status of specified package
dpkg -l package 列出当前已安装的包
dpkg -x package.deb dir/ 解开 deb 包的内容
dpkg -e package.deb dir/ 解开 deb 包的配置文件
dpkg -S keyword 搜索所属的包
dpkg -I/–info package.deb 列出包的详细描述
dpkg -c package.deb 列出 deb 包的所有安装文件
dpkg –configure package 配置包
echo pkgname hold | dpkg –set-selections # hold:告诉 apt 停止自动升级某个包裹
echo pkgname install | dpkg –set-selections # 移出 hold

apt 常用指令
http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html
apt-cache search name 搜索存在的包,参数中name可以是包名的一部分也可是全部。
apt-cache show pkgname 显示包信息,其中pkgname必须是软件包的全名。
apt-cache showpkg pkgname 显示包信息
apt-cache depends/rdepends –installed
apt-file list pkgname 显示软件包内容:
apt-file update 信息更新则:
apt-cdrom add [-d dirname] 在CD-ROM使用APT,dirname为CD-ROM挂载点目录名
apt-get install pkgname1 pkgname2 下载并安装软件包。
apt-get -d install pkgname1 pkgname2 只下载不安装软件包,软件包被下载
apt-get install pakname=version 手工指定安装该版本的pkg
apt-get install –no-upgrade pkg.deb 指定不要自动升级依赖的软件包
apt-get -b source pkgname 通常下载3个文件:.orig.tar.gz和.dsc和.diff.gz;然后解压
apt-get install -s pakname No act, only simulate

auto-apt run ./configure

软件升级时使某个包锁定(即不升级):修改/etc/apt/preferences文件,其中内容为:
Package: pkgname
Pin: pindef
Pin-Priority: pinpri

例如:
Package: gaim
Pin: version 0.58表示锁定以0.58开头的所有版本。
Pin-Priority值含义是:<0表示永不安装,0-100表示不是有效版本不安装,>100且<1000表
如有新版本则安装,>1000表示安装旧版本。
man apt_preferences

eg:
Package: sylpheed
Pin: version 0.4.99*
Pin-Priority: xxx
1001
Sylpheed version 0.4.99 will never be replaced by apt. If available, apt will install version 0.4.99 even if it would replace an installed package with a higher version. Only packages of priority greater than 1000 will ever downgrade an existing package.

1000
The effect is the same as priority 1001, except that apt will refuse to downgrade an installed version to 0.4.99

990
Version 0.4.99 will be replaced only by a higher version available from a release designated as preferred using the “APT::Default-Release” variable (see How to keep a mixed system, Section 3.8, above).

500
Any version higher than 0.4.99 of sylpheed which is available from any release will take preference over version 0.4.99, but 0.4.99 will still be preferred to a lower version.

100
Higher versions of sylpheed available from any release will take preference over version 0.4.99, as will any installed higher version of slypheed; so 0.4.99 will be installed only if no version is installed already. This is the priority of installed packages.

-1
Negative priorities are allowed as well, and prevent 0.4.99 from ever being installed.


rpm软件包相关指令集
一.安装一个包

rpm -ivh

2.升级一个包

rpm -Uvh

3.删除一个包

rpm -e

4.安装参数
–force 即使覆盖属于其它包的文件也强迫安装
–nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。
5.查询一个包是否被安装

rpm -q < rpm package name>

6.得到被安装的包的信息

rpm -qi < rpm package name>

7.列出该包中有哪些文件

rpm -ql < rpm package name>

8.列出服务器上的一个文件属于哪一个RPM包

#rpm -qf
9.可综合好几个参数一起用

rpm -qil < rpm package name>

10.列出所有被安装的rpm package

rpm -qa

11.列出一个未被安装进系统的RPM包文件中包含有哪些文件?

rpm -qilp < rpm package name>

一、安装
命令格式:
rpm -i ( or –install) options file1.rpm … fileN.rpm
参数:
file1.rpm … fileN.rpm 将要安装的RPM包的文件名
详细选项:
-h (or –hash) 安装时输出hash记号 (``#’’)
–test 只对安装进行测试,并不实际安装。
–percent 以百分比的形式输出安装的进度。
–excludedocs 不安装软件包中的文档文件
–includedocs 安装文档
–replacepkgs 强制重新安装已经安装的软件包
–replacefiles 替换属于其它软件包的文件
–force 忽略软件包及文件的冲突
–noscripts 不运行预安装和后安装脚本
–prefix 将软件包安装到由 指定的路径下
–ignorearch 不校验软件包的结构
–ignoreos 不检查软件包运行的操作系统
–nodeps 不检查依赖性关系
–ftpproxy 用 作为 FTP代理
–ftpport 指定FTP的端口号为
通用选项
-v 显示附加信息
-vv 显示调试信息
–root 让RPM将指定的路径做为”根目录”,这样预安装程序和后安
装程序都会安装到这个目录下
–rcfile 设置rpmrc文件为
–dbpath 设置RPM 资料库存所在的路径为

二、删除
命令格式:
rpm -e ( or –erase) options pkg1 … pkgN
参数
pkg1 … pkgN :要删除的软件包
详细选项
–test 只执行删除的测试
–noscripts 不运行预安装和后安装脚本程序
–nodeps 不检查依赖性
通用选项
-vv 显示调试信息
–root 让RPM将指定的路径做为”根目录”,这样预安装程序和后安装
程序都会安装到这个目录下
–rcfile 设置rpmrc文件为
–dbpath 设置RPM 资料库存所在的路径为

三、升级
命令格式
rpm -U ( or –upgrade) options file1.rpm … fileN.rpm
参数
file1.rpm … fileN.rpm 软件包的名字
详细选项
-h (or –hash) 安装时输出hash记号 (``#’’)
–oldpackage 允许”升级”到一个老版本
–test 只进行升级测试
–excludedocs 不安装软件包中的文档文件
–includedocs 安装文档
–replacepkgs 强制重新安装已经安装的软件包
–replacefiles 替换属于其它软件包的文件
–force 忽略软件包及文件的冲突
–percent 以百分比的形式输出安装的进度。
–noscripts 不运行预安装和后安装脚本
–prefix 将软件包安装到由 指定的路径下
–ignorearch 不校验软件包的结构
–ignoreos 不检查软件包运行的操作系统
–nodeps 不检查依赖性关系
–ftpproxy 用 作为 FTP代理
–ftpport 指定FTP的端口号为
通用选项
-v 显示附加信息
-vv 显示调试信息
–root 让RPM将指定的路径做为”根目录”,这样预安装程序和后安装程序都会安装到这个目录下
–rcfile 设置rpmrc文件为
–dbpath 设置RPM 资料库存所在的路径为

四、查询
命令格式:
rpm -q ( or –query) options
参  数:
pkg1 … pkgN :查询已安装的软件包
详细选项:
-p (or ``-‘’) 查询软件包的文件
-f 查询属于哪个软件包
-a 查询所有安装的软件包
–whatprovides 查询提供了 功能的软件包
-g 查询属于 组的软件包
–whatrequires 查询所有需要 功能的软件包
信息选项:
显示软件包的全部标识
-i 显示软件包的概要信息
-l 显示软件包中的文件列表
-c 显示配置文件列表
-d 显示文档文件列表
-s 显示软件包中文件列表并显示每个文件的状态
–scripts 显示安装、卸载、校验脚本
–queryformat (or –qf) 以用户指定的方式显示查询信息
–dump 显示每个文件的所有已校验信息
–provides 显示软件包提供的功能
–requires (or -R) 显示软件包所需的功能
通用选项:
-v 显示附加信息
-vv 显示调试信息
–root 让RPM将指定的路径做为”根目录”,这样预安装程序和后安装程序都会安装到这个目录下
–rcfile 设置rpmrc文件为
–dbpath 设置RPM 资料库存所在的路径为

五、校验已安装的软件包
命令格式:
rpm -V ( or –verify, or -y) options
参  数:
pkg1 … pkgN 将要校验的软件包名
软件包选项:
-p Verify against package file
-f 校验所属的软件包
-a Verify 校验所有的软件包
-g 校验所有属于组 的软件包
详细选项:
–noscripts 不运行校验脚本
–nodeps 不校验依赖性
–nofiles 不校验文件属性
通用选项:
-v 显示附加信息
-vv 显示调试信息
–root 让RPM将指定的路径做为”根目录”,这样预安装程序和后安装程序都会安装到这个目录下
–rcfile 设置rpmrc文件为
–dbpath 设置RPM 资料库存所在的路径为

六、校验软件包中的文件
语  法:
rpm -K ( or –checksig) options file1.rpm … fileN.rpm
参  数:
file1.rpm … fileN.rpm 软件包的文件名
Checksig–详细选项
–nopgp 不校验PGP签名
通用选项:
-v 显示附加信息
-vv 显示调试信息
–rcfile 设置rpmrc文件为

七、其它RPM选项
–rebuilddb 重建RPM资料库
–initdb 创建一个新的RPM资料库
–quiet 尽可能的减少输出
–help 显示帮助文件
–version 显示RPM的当前版本

continue