RHEL/CentOS v.s. Ubuntu Differences (Commands and Configuration)

Table of Contents

  • Differences
  • Packages
    • yum vs apt
    • rpm vs dpkg
  • Service
  • OS configuration files
  • Log

Differences

NoteRHELUbuntu
Support10years10years LTS(Long Term Support)
Defautl Editorvinano
Access controlSELinuxAppArmor
Apach HTTP Serverhttpdapache2
Firewallfirewalld (CentOS7)iptables (CentOS5, 6)ufw(Uncomplicated FireWall)

Packages

yum vs apt

  • The apt command is a command for integration of apt-get / apt-cache. Let’s use only apt from now on.
NoteCentOSUbuntu
Repository configuration file/etc/yum.repos.d/*.repo/etc/apt/sources.list
Repository configuration file/etc/yum.conf/etc/apt/apt.conf (Create)Proxy ConfigurationAcquire::http::Proxy “http://x.x.x.x:8888/";
Package searchyum search STRINGSapt search STRINGS
Package searchapt list PACKAGEapt list php
Package Detailyum info PACKAGEapt show PACKAGEapt show php
Package installationyum install PACKAGEapt install PACKAGEapt -f install PACAGE ← Repair broken dependencies
Package uninstallyum remove PACKAGEapt purge PACKAGE
List of repositoriesyum listapt list
Repository updateAutomatic update every timeapt update ← In Ubuntu you need to do
Update installed packagesapt-get upgrade

rpm vs dpkg

NoteCentOSUbuntu
Package installationrpm -i PACKAGE.rpmdpkg -i PACKAGE.deb
List of installed packagesrpm -qarpm -qa |grep xxxdpkg -l |grep XXXdpkg -l |grep ^ii(Also show deleted packages)
Confirm installed packagerpm -q PACKAGEdpkg -l PACKAGE
List of files included in packagerpm -ql PACKAGEdpkg -L PACKAGE
Package confirmation including filerpm -qf PACKAGEdpkg -S PACKAGE
Package uninstallrpm -e PACKAGEdpkg -P PACKAGE

Service

NoteCentOS6CentOS7Ubuntu
Service status checkservice SERVICE status/etc/init.d/SERVICE statussystemctl UNIT statusservice SERVICE status/etc/init.d/SERVICE status
Start serviceservice SERVICE start/etc/init.d/SERVICE startsystemctl UNIT startservice SERVICE start/etc/init.d/SERVICE start
Stop serviceservice SERVICE stop/etc/init.d/SERVICE stopsystemctl UNIT stopservice SERVICE stop/etc/init.d/SERVICE stop
Automatic start setting confirmationchkconfig –listls -l /etc/rc*.d/sysv-rc-conf –list(apt-get install sysv-rc-conf)
Automatic start enablechkconfig SERVICE onsystemctl enable UNITupdate-rc.d SERVICE enable
Disable auto startchkconfig SERVICE offsystemctl enable UNITupdate-rc.d SERVICE disable
Auto start service addedchkconfig –add SERVICEinsserv -d SERVICE
Automatic start service deletionchkconfig –del SERVICEinsserv -r SERVICE
Service setting file/etc/sysconfig/SERVICE/etc/default/SERVICE
Individual service
NoteCentOSUbuntu
Apache/httpd/etc/httpd/httpd.conf/etc/apache2/apache2.conf
mysql/etc/my.cnf/etc/mysql/my.cnf
php/etc/php.ini/etc/php5/apache2/php.ini(For the web)/etc/php5/cli/php.ini(For Command)/etc/php5/conf.d/*.ini(For the web adn Command)

OS configuration files

NoteCentOSUbuntu
OS Version/etc/redhat-release/etc/issueTips:cat /etc/*release/etc/lsb-release/etc/issueTips:cat /etc/*release
Hostname/etc/sysconfig/network/etc/hostname
Network Interfaces/etc/sysconfig/network-scripts/ifcfg-XExample/etc/sysconfig/network-scripts/ifcfg-eth0/etc/network/interfaces
Defautlt Gateway Configuration/etc/sysconfig/network/etc/network/interfaces
Run Level/etc/inittab
Lang/etc/sysconfig/i18n/etc/default/localeModification methodupdate-locale LANG=ja_JP.UTF-8
TimezoneModification methoddpkg-reconfigure tzdata
Keybord/etc/sysconfig/keyboard/etc/default/keyboardModification methoddpkg-reconfigure keyboard-configuration
cron/var/spool/cron/USER/var/spool/cron/crontabs/USER
No difference file
NoteCentOSUbuntu
DNS/etc/resolv.conf/etc/resolv.conf
hosts/etc/hosts/etc/hosts

Log

NoteCentOSUbuntu
syslog/var/log/messages/var/log/syslog
Audit log/var/log/secure/var/log/auth.log
mail log/var/log/maillog/var/log/mail.log
cron log/var/log/cron/var/log/syslog