0%

CentOS 和 Ubuntu 命令区别列表总结

因为实验室服务器上有多种 Linux 的发行版(行吧,其实大多 Ubuntu 都是装的,原先默认都是 CentOS),有些命令老是搞混,于是找到一个总结,原文 是个图片,我将其转成表格了。

*图片来自 https://zhuanlan.zhihu.com/p/145812549

基本信息

任务 RedHat(CentoS) Ubuntu(Debian)
软件包后缀 *.rpm *.deb
软件源配置文件 /etc/yum.conf /etc/apt/sources.list

服务相关(启动、关闭、重启)

任务 RedHat(CentoS) Ubuntu(Debian)
启动服务 service httpd start /etc/init.d/apache start
停止服务 service httpd stop /etc/init.d/apache stop
重启服务 service httpd restart /etc/init.d/apache restart
随系统启动自动运 chkconfig httpd on update-rc.d apache
禁止启动自动运行 chkconfig httpd off update-rc.d apache purge

系统及软件相关(安装、卸载、更新)

任务 RedHat(CentoS) Ubuntu(Debian)
更新软件包列表 每次运行 yum 时自动更新 apt-get update
从软件仓库安装软件 yum install package apt-get install package
安装已下载的软件包 yum install pkg.rpm 或 rpm -ivh pkg.rpm dpkg -i pkg.deb
删除软件包 yum -e package apt-get remove package
软件包升级测试 yum check-update apt-get -s update 或 apt-get -s dist-update
升级软件包 yum update 或 rpm-Uvh [args] apt-get upgrade
升级整个系统 yum upgrade apt-get dist-upgrade

Welcome to my other publishing channels