Wednesday, January 27, 2016

Set hostname for CentOS 7 using hostnamectl

1. Listing hostname using "hostnamectl" or "hostnamectl status"

[root@localhost ~]# hostnamectl
   Static hostname: helloworld.com
         Icon name: computer-server
           Chassis: server
        Machine ID: aaaaaaaaaaaaa
           Boot ID: ddddddddddd
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64

2.Setting static host-name using hostnamectl

# hostnamectl set-hostname "helloworld.com" --static

3. Delete static host-nameusing hostnamectl
# hostnamectl set-hostname "" --static

Tuesday, January 26, 2016

Listing more information on an rpm file

1. List the RPM to which a file belongs
# rpm -qa |grep  gcc
gcc-4.4.7-16.el6.x86_64
gcc-gnat-4.4.7-16.el6.x86_64
gcc-objc++-4.4.7-16.el6.x86_64
libgcc-4.4.7-16.el6.x86_64
gcc-c++-4.4.7-16.el6.x86_64
gcc-gfortran-4.4.7-16.el6.x86_64
gcc-java-4.4.7-16.el6.x86_64
gcc-objc-4.4.7-16.el6.x86_64

2. List all files from an installed package:
# rpm -qpl rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
/etc/apt
/etc/apt/sources.list.d
/etc/apt/sources.list.d/rpmforge-extras.list
/etc/apt/sources.list.d/rpmforge-testing.list
/etc/apt/sources.list.d/rpmforge.list
/etc/pki/rpm-gpg
/etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
/etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-fabian
/etc/smart
/etc/smart/channels
.....
.....

 List of dependent RPMs for a specific RPM package
# rpm -qaR htop
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libncursesw.so.5()(64bit)
libtinfo.so.5()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1