Determining what package provides a file on a CentOS system
If you wish to know which package provides a particular file on a CentOS
system, you can use the
yum whatprovides
command followed by
the path to the file and its name. E.g., if I wanted to determine what package
provides the
mysql
command on a system, I could determine its
location with the
which
command and then use the
yum whatprovides
command to determine the package that included
the file.
$ which mysql
/usr/bin/mysql
$ yum whatprovides /usr/bin/mysql
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.umd.edu
* epel: mirror.us.leaseweb.net
* extras: mirror.nexcess.net
* updates: mirror.cs.pitt.edu
1:mariadb-5.5.41-2.el7_0.x86_64 : A community developed branch of MySQL
Repo : base
Matched from:
Filename : /usr/bin/mysql
1:mariadb-5.5.41-2.el7_0.x86_64 : A community developed branch of MySQL
Repo : @updates
Matched from:
Filename : /usr/bin/mysql
From the above output, I can see the mysql program was provided in the
mariahdb package.
Another means to determine what package provided a file installed on
the system is to use the
RPM Package
Manager (RPM) utility.
$ rpm -qf /usr/bin/mysql
mariadb-5.5.41-2.el7_0.x86_64
Details on that package could be obtained by using the
rpm -qi mariadb
command.
$ rpm -qi mariadb
Name : mariadb
Epoch : 1
Version : 5.5.41
Release : 2.el7_0
Architecture: x86_64
Install Date: Mon 16 Feb 2015 09:33:02 PM EST
Group : Applications/Databases
Size : 50862464
License : GPLv2 with exceptions and LGPLv2 and BSD
Signature : RSA/SHA256, Thu 05 Feb 2015 11:27:55 AM EST, Key ID 24c6a8a7f4a80eb5
Source RPM : mariadb-5.5.41-2.el7_0.src.rpm
Build Date : Thu 05 Feb 2015 11:12:40 AM EST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://mariadb.org
Summary : A community developed branch of MySQL
Description :
MariaDB is a community developed branch of MySQL.
MariaDB is a multi-user, multi-threaded SQL database server.
It is a client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
If you are interested in what package may provide a file that isn't
currently installed on a system, you could use the yum whatprovides
command or, alternatively use the
www.rpmfind site to perform a search on the file name. In this
case, for mysql, the site will return a long list of packages that could provide
the file.
[/os/unix/linux/centos]
permanent link
Getting sendmail to accept email for a domain
In order to configure sendmail to accept email for a particular domain name,
you need to add the domain name to
/etc/mail/local-host-names
.
E.g., suppose sendmail on my server accepts email for
moonpoint.com, but I also want it to handle email for example.com. I would
then edit the
/etc/mail/local-host-names
file adding
example.com
to the the file, so it would contain the following
lines:
# local-host-names - include all aliases for your machine here.
moonpoint.com
example.com
Any line that begins with the pound or hash character, i.e., #
,
is a comment and domain names are added one per line. After editing the
file, you need to generate a new local-host-names.db
file by
running the command below from the root account:
# makemap hash /etc/mail/local-host-names < /etc/mail/local-host-names
makemap: /etc/mail/local-host-names: line 2: no RHS for LHS moonpoint.com
makemap: /etc/mail/local-host-names: line 6: no RHS for LHS example.com
Don't worry about the "no RHS for LHS" lines; they are to be expected.
You can verify that your sendmail server will now handle email for the
new domain by using the sendmail -bv
command followed by the
name of an account or alias on the system (aliases are added to
/etc/aliases
and a new aliases list generated by running
newaliases
). E.g., if jan is the name of an account on
the system, I could then test that email will be delivered to the local
jan account if I were to send a message to jan@example.com.
# sendmail -bv jan@example.com
jan@example.com... deliverable: mailer local, user jan
The "mailer local, user jan" reference informs me that sendmail will
deliver email addressed to jan@example.com to the local jan account. When
I ran the command prior to updating the local-host-names file, I saw the
following:
# sendmail -bv jan@example.com
jan@example.com... deliverable: mailer relay, host smtp.mandrillapp.com, user jan@example.com
The "mailer relay" reference informed me that sendmail was not configured
to deliver email to the local account if someone on the system sent email
to jan@example.com, but would, instead, send the email through another email
server to what it believed was an external email account.
To get external email servers to use the server on which I'm running
sendmail to delier email for the example.com domain, I need to have an
appropriate mail exchanger
(MX) record configured for the domain - see
Checking MX Records - or at least
ensure that there is no MX record pointing to some other server. E.g., I
could use the command nslookup -querytype=mx example.com
to
check the MX records for example.com.
# nslookup -querytype=mx example.com
Server: 10.255.176.37
Address: 10.255.176.37#53
example.com mail exchanger = 10 smtp.example.com.
If my server running sendmail is accessible at the IP address for
smtp.example.com, then other email servers will send email for any
any email address at example.com to it.
[/network/email/sendmail]
permanent link