Differences
Note | RHEL | Ubuntu |
Support | 10years | 10years LTS(Long Term Support) |
Defautl Editor | vi | nano |
Access control | SELinux | AppArmor |
Apach HTTP Server | httpd | apache2 |
Firewall | firewalld (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.
Note | CentOS | Ubuntu |
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 search | yum search STRINGS | apt search STRINGS |
Package search | apt list PACKAGE | |
apt list php | ||
Package Detail | yum info PACKAGE | apt show PACKAGE |
apt show php | ||
Package installation | yum install PACKAGE | apt install PACKAGE |
apt -f install PACAGE ← Repair broken dependencies | ||
Package uninstall | yum remove PACKAGE | apt purge PACKAGE |
List of repositories | yum list | apt list |
Repository update | Automatic update every time | apt update ← In Ubuntu you need to do |
Update installed packages | apt-get upgrade |
rpm vs dpkg
Note | CentOS | Ubuntu |
Package installation | rpm -i PACKAGE.rpm | dpkg -i PACKAGE.deb |
List of installed packages | rpm -qa | |
rpm -qa | grep xxx | dpkg -l |
dpkg -l | grep ^ii | |
(Also show deleted packages) | ||
Confirm installed package | rpm -q PACKAGE | dpkg -l PACKAGE |
List of files included in package | rpm -ql PACKAGE | dpkg -L PACKAGE |
Package confirmation including file | rpm -qf PACKAGE | dpkg -S PACKAGE |
Package uninstall | rpm -e PACKAGE | dpkg -P PACKAGE |
Service
Note | CentOS6 | CentOS7 | Ubuntu |
Service status check | service SERVICE status | ||
/etc/init.d/SERVICE status | systemctl UNIT status | service SERVICE status | |
/etc/init.d/SERVICE status | |||
Start service | service SERVICE start | ||
/etc/init.d/SERVICE start | systemctl UNIT start | service SERVICE start | |
/etc/init.d/SERVICE start | |||
Stop service | service SERVICE stop | ||
/etc/init.d/SERVICE stop | systemctl UNIT stop | service SERVICE stop | |
/etc/init.d/SERVICE stop | |||
Automatic start setting confirmation | chkconfig --list | ls -l /etc/rc*.d/ | |
sysv-rc-conf --list | |||
(apt-get install sysv-rc-conf) | |||
Automatic start enable | chkconfig SERVICE on | systemctl enable UNIT | update-rc.d SERVICE enable |
Disable auto start | chkconfig SERVICE off | systemctl enable UNIT | update-rc.d SERVICE disable |
Auto start service added | chkconfig --add SERVICE | insserv -d SERVICE | |
Automatic start service deletion | chkconfig --del SERVICE | insserv -r SERVICE | |
Service setting file | /etc/sysconfig/SERVICE | /etc/default/SERVICE |
Individual service
Note | CentOS | Ubuntu |
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
Note | CentOS | Ubuntu |
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 | ||
Timezone | Modification 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
Note | CentOS | Ubuntu |
DNS | /etc/resolv.conf | /etc/resolv.conf |
hosts | /etc/hosts | /etc/hosts |
Log
Note | CentOS | Ubuntu |
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.kau.edu.sa/Files/830/Files/60761_Linux.pdf
https://fisnikd.files.wordpress.com/2009/11/beginning-shell-scripting.pdf