|
Shilpa Nair just graduated in 2015. She then went to one in Noida, Delhi state television news, candidates intern positions. In her graduation season last year, when visiting Tecmint often seek help on the job. Since then, she frequented Tecmint.
RPM related aspects of Linux interview questions
All questions and answers are based on memories Shilpa Nair rewritten.
"Hello everyone! I am Shilpa Nair from Delhi and I only recently graduated, is looking for an internship in the early college, when I was very fond of UNIX, so I hope that this opportunity for me to meet I am interested in. I have been asked a lot of questions, most of them are based on RedHat package management issues. "
Here is what I asked questions and the corresponding answers. I just posted and RedHat GNU / Linux package management related, is also a major question.
1, Linux in how to find a package is installed or not? Suppose you need to make sure 'nano' has not been installed, how do you do?
Answer: In order to confirm nano package has not been installed, we can use the rpm command with the -q -a option to query all installed packages
# Rpm -qa nano
or
# Rpm -qa | grep-i nano
nano-2.3.1-10.el7.x86_64
At the same package name must be complete, incomplete package name will return to the prompt, do not print anything, that this package (package name incomplete) is not installed. The following example will better understand something:
We usually use vim replace vi command. If we then look for the installation package vi / vim, we will see no results on the standard output.
#vi
#vim
Nevertheless, we can still run as above vi / vim command knew package has not been installed. Just because we do not know its full package name was not found. If we do not know exactly the full file name, we can use wildcards:
# Rpm -qa vim *
vim-minimal-7.4.160-1.el7.x86_64
In this way, we can get information about any packages installed or not.
2. How do you use the rpm command to install package XYZ?
Answer: We can use the rpm command to install any software package (* .rpm), like this, the option -i (install), - v (redundancy or show additional information) and -h (during the installation process, print # sign shows the progress).
# Rpm -ivh peazip-1.11-1.el6.rf.x86_64.rpm
Preparing ... ################################# [100%]
Updating / installing ...
1: peazip-1.11-1.el6.rf ################################# [100%]
If you are upgrading an earlier version of the package, should be added to the -U option, -v, and -h options to ensure we get the # sign indicates redundant output, which increases the readability.
3. You have installed a software package (say httpd), and now you want to see the package creation and installation of all files and directories, how would you do?
Answer: Use the option -l (list all files) and -q (query) lists all files httpd packages installed (Linux philosophy: all are files, including directories).
# Rpm -ql httpd
/ Etc / httpd
/ Etc / httpd / conf
/etc/httpd/conf.d
...
4. If you want to remove a software package, called postfix. What would you do?
Answer: First of all we need to know what package installed postfix. Find installation postfix package name, use the -e (erase / uninstall packages) and -v (verbose output) are two options to achieve.
# Rpm -qa postfix *
postfix-2.10.1-6.el7.x86_64
Then remove postfix, as follows:
# Rpm -ev postfix-2.10.1-6.el7.x86_64
Preparing packages ...
postfix-2: 3.0.1-2.fc22.x86_64
5. Obtain an installed package specific information, such as version, serial number, installation date, size, summary and a brief description.
Answer: We use rpm option -qi, followed by the package name, you can get information about a specific installed packages.
For example, in order to obtain specific information openssh package, I have to do is:
# Rpm -qi openssh
[Root @ tecmint tecmint] # rpm -qi openssh
Name: openssh
Version: 6.8p1
Release: 5.fc22
Architecture: x86_64
InstallDate: Thursday28May201512: 34: 50 PM IST
Group: Applications / Internet
Size: 1542057
License: BSD
....
6. If you are unsure about a specific package configuration file in which, for example, httpd. How do you find the list of profiles and locations of all httpd provided.
Answer: We need to take the package name with the option -c, which will list the names of all the configuration files and their locations.
# Rpm -qc httpd
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf.modules.d/00-base.conf
/etc/httpd/conf/httpd.conf
/ Etc / sysconfig / httpd
Similarly, we can list all the relevant documentation file, as follows:
# Rpm -qd httpd
/ Usr / share / doc / httpd / ABOUT_APACHE
/ Usr / share / doc / httpd / CHANGES
/ Usr / share / doc / httpd / LICENSE
...
We can also list all the relevant certificate file, as follows:
# Rpm -qL openssh
/ Usr / share / licenses / openssh / LICENCE
Forgot to explain the above option -d and -L indicate "Documents" and "certificate", sorry.
7. Do you find a configuration file located in '/usr/share/alsa/cards/AACI.conf', now you're not sure which files belong to which package. How do you find out the name of the package?
Answer: When a package is installed, the relevant information is stored in the database. So the option -qf (-f query files owned by the package) is very easy to track who provided the above packages.
# Rpm -qf /usr/share/alsa/cards/AACI.conf
alsa-lib-1.0.28-2.el7.x86_64
Similarly, we can find (who provides) information on any sub-package, documentation and certificate files.
8. How do you use rpm find recently installed software list?
Answer: As just said, every file is installed as are recorded in the database. So it is not difficult, by querying the rpm database, find the list of recently installed software.
We run the following command, use the option -last (print out the recently installed software) to achieve the purpose.
# Rpm -qa --last
The above command will print out all the software installed recently installed software on top of the list.
If our concern is to find a particular package, we can use the grep command from the list to match the package (assuming sqlite), simple as follows:
# Rpm -qa --last | grep-i sqlite
sqlite-3.8.10.2-1.fc22.x86_64 Thursday18June201505: 05: 43 PM IST
We can also get a list of 10 recently installed software, simple as follows:
# Rpm -qa --last | head
We can redefine it, and outputs the result you want, simple as follows:
# Rpm -qa --last | head-n 2
The above command, -n represents the number, then a constant value behind. The command is to print a list of two recently installed software.
9. Before installing a package, if you want to check its dependencies. What would you do?
Answer: Check for a rpm package (XYZ.rpm) dependence, we can use the option -q (query packet), - p (specified package name) and -R (query / list the package depends on the package, ah, that is dependent on ).
# Rpm -qpR gedit-3.16.1-1.fc22.i686.rpm
/ Bin / sh
/ Usr / bin / env
glib2 (x86-32)> = 2.40.0
gsettings-desktop-schemas
gtk3 (x86-32)> = 3.16
gtksourceview3 (x86-32)> = 3.16
gvfs
libX11.so.6
...
10. rpm is not a front-end package management tool?
Answer: No! rpm is a back-end management tools for Linux-based distributions RPM (referred to herein Redhat Package Management).
YUM, full name Yellowdog Updater Modified, is the tool of a RPM. YUM command automatically do all the work, including dependency resolution and all other matters.
Recently, DNF (YUM command upgrade version) replaces YUM on Fedora 22 release. Although you can still use YUM on RHEL and CentOS platform, we can also install dnf, coexist with the YUM command to use. It is said that there are a lot of DNF increase compared to YUM.
Always good to know more, to maintain self-renewal. Now we talk about the venue to the front end portion.
11. How can you list a list of all available system above the warehouse.
Answer: simply use the following command, we can list a list of all available storage on a single system.
#yum repolist
or
# Dnf repolist
Last metadata expiration check performed 0:30:03 ago on MonJun2216: 50: 002015.
repo id repo name status
* Fedora Fedora22- x86_64 44,762
ozonos RepositoryforOzon OS 61
* Updates Fedora22- x86_64 -Updates
The above command will only list the available warehouse. If you need to list all the warehouse, whether available or not, you can do so.
#yum repolist all
or
# Dnf repolist all
Last metadata expiration check performed 0:29:45 ago on MonJun2216: 50: 002015.
repo id repo name status
* Fedora Fedora22- x86_64 enabled: 44,762
fedora-debuginfo Fedora22- x86_64 -Debug disabled
fedora-source Fedora22-Source disabled
ozonos RepositoryforOzon OS enabled: 61
* Updates Fedora22- x86_64 -Updates enabled: 5,018
updates-debuginfo Fedora22- x86_64 -Updates-Debug
12. How do you list all available on a single system and installed the package?
Answer: List all the packages available on a system, we can do this:
#yumlist available
or
# Dnf list available
ast metadata expiration check performed 0:34:09 ago on MonJun2216: 50: 002015.
AvailablePackages
0ad.x86_64 0.0.18-1.fc22 fedora
0ad-data.noarch 0.0.18-1.fc22 fedora
0install.x86_64 2.6.1-2.fc21 fedora
0xFFFF.x86_64 0.3.9-11.fc22 fedora
2048-cli.x86_64 0.9-4.git20141214.723738c.fc22 fedora
2048-cli-nocurses.x86_64 0.9-4.git20141214.723738c.fc22 fedora
....
And lists all installed packages on a system, we can do so.
#yumlist installed
or
# Dnf list installed
Last metadata expiration check performed 0:34:30 ago on MonJun2216: 50: 002015.
InstalledPackages
GeoIP.x86_64 1.6.5-1.fc22@System
GeoIP-GeoLite-data.noarch 2015.05-1.fc22@System
NetworkManager.x86_64 1: 1.0.2-1.fc22@System
NetworkManager-libnm.x86_64 1: 1.0.2-1.fc22@System
aajohan-comfortaa-fonts.noarch 2.004-4.fc22@System
....
And to meet two requirements, we can do so.
#yumlist
or
# Dnf list
Last metadata expiration check performed 0:32:56 ago on MonJun2216: 50: 002015.
InstalledPackages
GeoIP.x86_64 1.6.5-1.fc22@System
GeoIP-GeoLite-data.noarch 2015.05-1.fc22@System
NetworkManager.x86_64 1: 1.0.2-1.fc22@System
NetworkManager-libnm.x86_64 1: 1.0.2-1.fc22@System
aajohan-comfortaa-fonts.noarch 2.004-4.fc22@System
acl.x86_64 2.2.52-7.fc22@System
....
13. you how in a system used above YUM or DNF separately install and upgrade a package with a package?
Answer: Install a package (assuming the nano), we can do this,
#yum install nano
And install a set of packages (assumed to be Haskell), we can do so,
#yum groupinstall 'haskell'
Upgrading a package (or nano), we can do so,
#yum update nano
In order to upgrade a package (or haskell), we can do so,
#yum groupupdate 'haskell'
14. How would you synchronize a system to install the software above all stable release?
Answer: We can on a system (assuming CentOS or Fedora) all packages to stable release, as follows,
#yum distro-sync [in CentOS / RHEL]
or
# Dnf distro-sync [in Fedora20 after version]
Before the interview you seem to do quite a few lessons, very good! Before further conversation, I would like to ask a question or two.
15. Your local warehouse for YUM familiar? Have you tried to create a local YUM repository it? Let's briefly look at how you can create a local YUM repository.
Answer: First of all, thank you for the compliment. Back to the question, I must admit I was very familiar with the local YUM repository, and on my local host is also deployed, as a test.
1, in order to establish a local YUM repository, we need to install three packages below:
#yum install deltarpm python-deltarpm createrepo
2. Create a new directory (assuming / home / $ USER / rpm), and then copy the RPM RedHat / CentOS DVD on the package to this folder
# Mkdir / home / $ USER / rpm
# Cp / path / to / rpm / on / DVD / *. Rpm / home / $ USER / rpm
3, the new basic library header files as follows.
# Createrepo -v / home / $ USER / rpm
4, create a file in the path /etc/yum.repo.d .repo (such as abc.repo):
cd / etc / yum.repos.d && cat << EOF abc.repo
[Local-installation] name = yum-local
baseurl = file: /// home / $ USER / rpm
enabled = 1
gpgcheck = 0
EOF
Important: Replace your username away $ USER.
Above all the work it is to create a local YUM repository to do. We can now install the software from here, relatively faster, safer, and most importantly, does not require an Internet connection. |
|
|
|