Common Commands and Examples in CentOS
Example 1: Getting the IP address of the Server in CentOS
To get the IP address of the server we can use the “ifconfig” command.
ifconfig | grep 192
The above command will display the IP address of the host system.
We can also use the “ip addr” with grep to get the same result.
ip addr | grep 192
Example 2: Updating the Packages in CentOS
To check for any updates available for your installed packages, use the “yum” package manager. Type the command below on the terminal:
yum check-update
To update a single package to the latest available version, run the command below:
yum update [package name]
To update all packages to the latest available version, run the command below:
yum update -y
Example 3: Installing VIM in CentOS
To install the VIM editor on CentOS, type the command given below on the terminal.
sudo yum install vim-enhanced -y
Nowadays, the VIM editor comes pre-installed with CentOS.
Example 4: Installing EPEL Repository in CentOS
We can use the “yum” package manager to install the EPEL repository. Connect to the server via SSH as the root user or open a terminal and type the command below
sudo yum install epel-release
It will simply install all the required packages of EPEL. In this case, it is already installed.
Example 5: Install Byobu in CentOS
After installing the EPEL repository, we can also use the “yum” package manager to install the Byobu. Type the command below:
yum -y install byobu
One thing to keep in mind is that the EPEL repository should be enabled before installing Byobu. To enable the EPEL repository type the command below.
yum --enablerepo="epel"
To check whether the repository is enabled or not type the command below.
yum repolist enabled
Example 6: Permanently Disable SELinux in CentOS
To permanently disable SELinux and make it persist across reboots follow the steps below :
Open the SELinux configuration file on any editor.
nano /etc/selinux/config
- Now change the SELINUX directive to either permissive or disabled.
- Now just save and exit the configuration file and then reboot the system.
Example 7: Granting Users Sudo know in CentOS
To grant the superuser permission to the normal user account, type “sudo su” and then type the root account password.
sudo su
Getting Started with CentOS
CentOS, short for Community ENTerprise Operating System, is a powerful and widely used Linux distribution known for its stability, security, and open-source nature. Derived from the source code of Red Hat Enterprise Linux (RHEL), CentOS has become a popular choice for server environments and enterprise-level applications. In this article, we will delve into the various aspects of CentOS, exploring its history, features, advantages, and use cases.
Table of Content
- History and Origin of CentOS
- Choosing CentOS over Ubuntu
- Hardware Requirements CentOS
- Graphical Installation of CentOS 7
- Common Commands and Examples in CentOS