Thursday, October 30, 2014

[Admin]Redhat Ubuntu yum/rpm V.S. apt/dpkg

最常用打印版
(Fedora, CentOS) (Debian, Ubuntu)
yum install <pkg> apt-get install <pkg>
yum erase <pkg> apt-get remove <pkg>
yum check-update apt-get update
yum update apt-get upgrade
yum repolist cat /etc/apt/sources.list
/etc/yum.repos.d/ /etc/apt/sources.list
yum search <pkg> apt-cache search <pkg>
yum info <pkg> apt-cache show <pkg>
rpm -qpi pkgfile.rpm dpkg -I pkgfile.deb
rpm -qpl pkgfile.rpm dpkg -c pkgfile.deb
rpm -i <filename>.rpm dpkg -i <filename>.deb
rpm -U <filename>.rpm dpkg -i <filename>.deb
rpm -e <pkg> dpkg -P <pkg>
rpm -q <pkg> dpkg -l <pkg>
rpm -qa dpkg -l
rpm -qi <pkg> dpkg -p/-s <pkg>
rpm -qf <filename> dpkg -S <filename>
rpm -ql <pkg> dpkg -L <pkg>

全面对照版:
Red Hat/Fedora Ubuntu Task
Adding, Removing and Upgrading Packages
yum does this every time it's run, use -C to avoid this slow behavior apt-get update Refresh list of available packages
yum install package_name apt-get install package_name Install a package from a repository
yum install package.rpm
rpm -i package.rpm
dpkg --install package.deb Install a package file
n/a apt-get remove package_name Remove a package
rpm -e package_name apt-get purge package_name Remove a package with configuration files
yum check-update apt-get -s upgrade
apt-get -s dist-upgrade
Check for package upgrades
yum update
rpm -Uvh [args]
apt-get upgrade Upgrade packages
yum upgrade apt-get dist-upgrade Upgrade the entire system
Package Information
yum search package_name apt-cache search package_name Get information about an available package
yum list available apt-cache dumpavail Show available packages
yum list installed
rpm -qa
dpkg --list List all installed packages
yum info package_name apt-cache show package_name Get information about a package
rpm -qi package_name dpkg --status package_name Get information about an installed package
rpm -ql package_name dpkg --listfiles package_name List files in an installed package
rpm -qd package_name - List documentation files in an installed package
rpm -qc package_name dpkg-query --show -f '${Conffiles}\n'package_name List configuration files in an installed package
rpm -qR package_name apt-cache depends Show the packages a given package depends on
rpm -q -whatrequires [args] apt-cache rdepends Show other packages that depend on a
given package (reverse dependency)
Package File Information
rpm -qpi package.rpm dpkg --info package.deb Get information about a package file
rpm -qpl package.rpm dpkg --contents package.deb List files in a package file
rpm -qpd package.rpm - List documentation files in a package file
rpm -qpc package.rpm - List configuration files in a package file
rpm2cpio package.rpm | cpio -vid dpkg-deb --extract package.deb dir-to-extract-to Extract files in a package
rpm -qf filename dpkg --search filename Find package that installed a file
yum provides filename apt-file search filename Find package that provides a particular file
Misc. Packaging System Tools
- apt-cache stats Show stats about the package cache
rpm -Va debsums Verify all installed packages
yum clean packages apt-get clean Remove packages from the local cache directory
- apt-get autoclean Remove only obsolete packages from the local cache directory
yum clean headers apt-file purge Remove header files from the local cache directory
(forcing a new download of same on next use)
/etc/yum.conf /etc/apt/sources.list Repository location configuration
service httpd start invoke-rc.d apache start Starting/stopping services immediately
chkconfig httpd on update-rc.d apache defaults Enabling a service at boot
chkconfig httpd off update-rc.d apache purge Disabling a service at boot

Reference:
https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux/RedHatEnterpriseLinuxAndFedora


No comments:

Post a Comment