CentOS Version Command and Update CentOS to New Version
CentOS is a popular Linux Operating System for enterprise computing, web servers and Virtual Private Servers. CentOS may be given as a Linux option when configuring a new Virtual Private Server (VPS), online with a hosting company. This article provides a list of basic commands to help manage a CentOS VPS.
View the CentOS Version and Update with Shell Commands
For this article try all the commands on a test system to see them in action. See the article SSH into VPS Virtual Machine on Windows Using PuTTY. Remember to have backups of data before changing any aspect of a live running system.
In this article:
- View CentOS version
- Check if CentOS is 64-bit or 32-bit
- View the Centos server Name
- View CentOS kernel version
- View list of available CentOS updates
- Updating CentOS
- Rebooting CentOS
- Listing CentOS installed packages
In these examples root is the logged in user, in practice a different superuser will normally be used when maintaining a server. All the following commands are executed in the shell.
View CentOS Version
When CentOS boots the major version is briefly displayed on a boot screen. It is usually configured to show on the shell login with the kernel version:
CentOS is based on the commercially supported Red Hat Linux, therefore, once logged in use cat /etc/redhat-release:
[root@servername ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core)
For more information use cat /etc/*release:
In version 7 of CentOS the hostnamectl status command can be used to find the major version and kernel version:
Check if CentOS is 64-bit or 32-bit
Since CentOS version 7 there is only the 64-bit version officially supported (although a 32-bit version is available from the community). To check if the running CentOS is 64-bit or 32-bit use the uname command with the -p option (p for processor):
[root@servername ~]# uname -p x86_64
The 64-bit CentOS will display x86_64, and 32-bit will display i686:
[root@servername ~]# uname -p i686
See also the command to display the kernel version below.
Display the CentOS Server Name (Host Name)
Use hostname to display the systems name:
[root@servername ~]# hostname servername.server
See also the hostnamectl status command above.
Display the CentOS Kernel Version
Use uname -r -v to see the kernel version:
[root@servername ~]# uname -r -v 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015
Again, see also the hostnamectl status command above.
List Available CentOS Updates
List available updates using yum, here piped (using |) to less to view one screen at a time, using the space bar. Use q to quit the listing:
[root@servername ~]# yum list updates | less
Update CentOS using yum, package downloads may need to be confirmed with y:
[root@servername ~]# yum update
(Note: After confirming the update, the packages will download, extract and install. If this fails you may see messages such as Trying other mirrors, Error Downloading Packages and [Errno 256]. Use the command yum clean metadata and try yum update again. If it still reports errors use the command yum clean all and try again.)
[root@servername ~]# reboot
[root@servername ~]# shutdown -r now
One logged back in use the commands above to check the updated versions:
[root@servername ~]# uname -r -v 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon Dec 4 23:52:40 UTC 2017 [root@servername ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
List CentOS Installed Packages
List installed packages using yum, piped to less to view a page at a time, with the space bar (use q to quit):
[root@servername ~]# yum list installed|less
For more information on CentOS see their Wiki and the CentOS web site at https://www.centos.org/
Previous related posts:
- Virtualization Software for Windows, Run Another OS for Free
- Virtual CentOS on Windows Using VirtualBox to Run the VM
- SSH into VPS Virtual Machine on Windows Using PuTTY
- View related articles on CentOS and Virtual Private Servers (VPS).
- View the Tek Eye full Index for other articles.
Author:Daniel S. Fowler Published: Updated: