Reference from: http://blog.csdn.net/csdnones/article/details/51513163, thank the original author for solving my problem.
Execute Xhost + to report the following error because no related packages have been installed (other command not found commands can be resolved in this manner)
[Email protected] ~]# Xhost +
-bash:xhost:command not found
To install the package:
[Email protected] ~]# yum whatprovides "*/xhost"
Loaded Plugins:product-id, Security, Subscription-manager
This system isn't registered to Red Hat Subscription Management. You can use the Subscription-manager to register.
base/filelists_db | 3.4 MB 00:00 ...
xorg-x11-server-utils-7.7-2.el6.x86_64:x.org X11 X Server Utilities
Repo:base
Matched from:
Filename:/usr/bin/xhost
[Email protected] ~]#yum-y Install xorg-x11-server-utils-7.7-2.el6.x86_64
Loaded Plugins:product-id, Security, Subscription-manager
This system isn't registered to Red Hat Subscription Management. You can use the Subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--Running Transaction check
---> Package xorg-x11-server-utils.x86_64 0:7.7-2.el6 'll be installed
--processing dependency:mcpp for package:xorg-x11-server-utils-7.7-2.el6.x86_64
--processing dependency:libxxf86misc.so.1 () (64bit) for package:xorg-x11-server-utils-7.7-2.el6.x86_64
--Running Transaction check
---> Package libxxf86misc.x86_64 0:1.0.3-4.el6 'll be installed
---> Package mcpp.x86_64 0:2.7.2-4.1.el6 'll be installed
--processing dependency:libmcpp.so.0 () (64bit) for package:mcpp-2.7.2-4.1.el6.x86_64
--Running Transaction check
---> Package libmcpp.x86_64 0:2.7.2-4.1.el6 'll be installed
--Finished Dependency Resolution
Dependencies resolved
=======================================================================================================
Package Arch Version Repository Size
=======================================================================================================
Installing:
Xorg-x11-server-utils x86_64 7.7-2.el6 Base 155 k
Installing for dependencies:
Libxxf86misc x86_64 1.0.3-4.el6 Base K
Libmcpp x86_64 2.7.2-4.1.el6 Base K
Mcpp x86_64 2.7.2-4.1.el6 Base (k)
Transaction Summary
=======================================================================================================
Install 4 Package (s)
Total Download size:265 k
Installed size:570 K
Downloading Packages:
-------------------------------------------------------------------------------------------------------
Total 2.2 mb/s | 265 KB 00:00
Running Rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing:libxxf86misc-1.0.3-4.el6.x86_64 1/4
Installing:libmcpp-2.7.2-4.1.el6.x86_64 2/4
Installing:mcpp-2.7.2-4.1.el6.x86_64 3/4
Installing:xorg-x11-server-utils-7.7-2.el6.x86_64 4/4
Verifying:libmcpp-2.7.2-4.1.el6.x86_64 1/4
Verifying:xorg-x11-server-utils-7.7-2.el6.x86_64 2/4
Verifying:libxxf86misc-1.0.3-4.el6.x86_64 3/4
Verifying:mcpp-2.7.2-4.1.el6.x86_64 4/4
Installed:
Xorg-x11-server-utils.x86_64 0:7.7-2.el6
Dependency installed:
libxxf86misc.x86_64 0:1.0.3-4.el6 libmcpp.x86_64 0:2.7.2-4.1.el6 mcpp.x86_64 0:2.7.2-4.1.el6
complete!
"Linux error"-bash:xhost:command not found