Intall software from installation disk of CentOS

I have been using CentOS on my VPS. Today I need to install CentOS 7 on my PC. The installation process was not smooth and I had to do it in text mode. The main task during the installation is selecting a target partition. Anyway, I successfully installed CentOS 7 on my PC. Then I found some development tools are missing. I did not select the packages to install and the development tools were not installed on the system by default. On VPS, I can easily install the development tools using yum:

yum groupinstall “Development Tools”

But how to use yum to install software from local disk? First, I need to mount the usb drive that contains the CentOS installation files to the system. I know the command to mount a device in Linux,like mount /dev/devicename /moutdirectory. The problem is I do not know which device name corresponds to the USB disk I inserted. Looking into the /dev/ directory, there are a number of strange device names. I cannot tell which one belongs to the USB drive. The solution to find the correct device name for the USB drive is first un-plugin the USB, use ls /dev/ to list all the device names in that directory, them plugin the USB drive and ls /dev/ again. You will find two new device files /dev/sda and /dev/sda1. I do not know the difference between sda and sda1. I tried to mount the sda first but failed. Then I mounted sda1 and succeeded which means /dev/sda1 is exactly the usb drive. You can find another method to mount the usb flash driver in centos7 but I’ve not tried that. I do not want to be a CentOS guru anyway.

Now I have mounted my CentOS installation disk. How to install software from it using yum? You need to modify the yum repo file

You need to add a basedir option under the [c7-media] section. Suppose your USB drive is mounted under the directory /usbdrive/, the repo file looks like:

Now you can use the yum command to install the software from the local repo as:

The –disablerepo option lets yum not check packages from Internet, the –enablerepo tells yum to only fetch software from local file system. You can find more information about offline install of software on CentOS here.

I only played around the Linux system occasionally so one day I forgot the CentOS root password. If you do not login your Linux system for several months, you will definitely forget the Linux password. Don’t be panic, you do not need to reinstall the system. Follow the steps below to reset your root password on CentOS7.

  1. boot CentOS 7, hit “e” quickly on startup screen.
  2. locate the line containing “ro”, change “ro” to “rw init=/sysroot/bin/sh”
  3. press Ctrl+x to boot in single mode
  4. chroot /sysroot
  5. passwd
  6. touch /.autorelabel
  7. exit
  8. reboot

Now you can login with the new password.

How to shutdown Windows 10 with keyword?

  • Win+x
  • Alt-F4


Posted in tips of hosting