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

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 Configuration
Acquire::http::Proxy "http://x.x.x.x:8888/";
Package searchyum search STRINGSapt search STRINGS
Package searchapt list PACKAGE
apt list php
Package Detailyum info PACKAGEapt show PACKAGE
apt show php
Package installationyum install PACKAGEapt install PACKAGE
apt -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 -qa
rpm -qagrep xxxdpkg -l
dpkg -lgrep ^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/issue
Tips:cat /etc/*release/etc/lsb-release
/etc/issue
Tips:cat /etc/*release
Hostname/etc/sysconfig/network/etc/hostname
Network Interfaces/etc/sysconfig/network-scripts/ifcfg-X
Example
/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/locale
Modification method
update-locale LANG=ja_JP.UTF-8
Check Locale
locale #Confirm current locale
localectl list-locales #List of available locales
apt install language-pack-ja
TimezoneModification method
dpkg-reconfigure tzdata
Keybord/etc/sysconfig/keyboard/etc/default/keyboard
Modification method
dpkg-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

Source:

https://cmdref.net/os/linux/note/rhel-vs-ubuntu

Further reading:

https://www.openlogic.com/blog/centos-commands-cheat-sheet

https://linuxsimply.com/wp-content/uploads/2023/05/redhat-Linux-Cheat-Sheet.pdf

https://bjpcjp.github.io/pdfs/devops/linux-commands-handbook.pdf

https://scadahacker.com/library/Documents/Cheat_Sheets/Linux%20-%20RHEL%20-%20Linux%20Commands.pdf

https://www.freecodecamp.org/news/bash-scripting-tutorial-linux-shell-script-and-command-line-for-beginners/

https://www.kau.edu.sa/Files/830/Files/60761_Linux.pdf

https://doc.lagout.org/operating%20system%20/linux/Commands%20and%20Shell%20Programming/Mastering%20UNIX%20Shell%20Scripting.pdf

https://fisnikd.files.wordpress.com/2009/11/beginning-shell-scripting.pdf

https://github.com/RehanSaeed/Bash-Cheat-Sheet