Lab04 Exercises
Lab04 Exercises
Exercise 1
This exercise can be experimented with a fresh installation of Red Hat Enterprise Linux. We will use the
rpm packages found on the installation dvd (the Server directory on the dvd) that we mounted at
/mnt/distdvd.
We want to install a mysql database server. Looking through the packages we can see that a mysqlserver package is available. First of all we query the installed packages list to see if mysql is installed.
# rpm -qa mysql
The query does not output anything so there is no mysql related package installed. We change to the
directory containing the rpms (#cd /mnt/distdvd/Server) and then issue the following command to start
the installation:
# rpm -ivh mysql-server-5.0.45-7.el5.i386.rpm
Note: In your setup some other version of the package might be available. The safest way to write this
command line is to write rpm ivh mysql-server and then hit the TAB key to autocomplete
the package file name.
The options given to the rpm command are: -i (or --install) specifies the operation, -v tells rpm to be
verbose and output everything, -h makes rpm display hashes as a completion indication.
After we run the above command we get the following output:
warning: mysql-server-5.0.45-7.el5.i386.rpm: Header V3 DSA signature: NOKEY,
key ID 37017186
error: Failed dependencies:
libmysqlclient.so.15 is needed by mysql-server-5.0.45-7.el5.i386
libmysqlclient_r.so.15 is needed by mysql-server-5.0.45-7.el5.i386
mysql = 5.0.45-7.el5 is needed by mysql-server-5.0.45-7.el5.i386
perl(DBI) is needed by mysql-server-5.0.45-7.el5.i386
perl-DBD-MySQL is needed by mysql-server-5.0.45-7.el5.i386
perl-DBI is needed by mysql-server-5.0.45-7.el5.i386
From this output we can clearly see that we first need to install some other packages that mysql-server
depends on: we need the mysqlclient, the perl-DBI and perl-DBD-MySQL packages.
1
Trying to install the two perl related packages we give the following command:
# rpm -ivh perl-DBI-1.52-2.el5.i386.rpm perl-DBD-MySQL-3.0007-2.el5.i386.rpm
We see that we still got two dependency problems. To install the perl-DBD-MySQL package we need to
have installed the mysqlclient first. The perl-DBI package can be installed without a problem so we issue
the installation command for this package:
# rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
warning: perl-DBI-1.52-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID
37017186
Preparing...
########################################### [100%]
1:perl-DBI
########################################### [100%]
The package is now installed despite the warning about the missing signature key. We do not care about
this warning yet and we can even make rpm ignore the missing key by providing the --nosignature
option in the command.
We now want to install the mysqlclient because both the mysql-server and the perl-DBD-MySQL
packages depend on it:
# rpm -ivh mysql-5.0.45-7.el5.i386.rpm
warning: mysql-5.0.45-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID
37017186
Preparing...
########################################### [100%]
1:mysql
########################################### [100%]
We can see that now, after we manually handled all its dependencies, mysql-server installed without
complaints. We can now query the installed packages list and search for mysql inside the list; we
should get two packages:
# rpm -qa | grep mysql
mysql-5.0.45-7.el5
mysql-server-5.0.45-7.el5
Exercise 2
In this exercise we will uninstall all the packages installed in the previous exercise. First of all we have to
remove the mysql-server as it is the top of our dependency chain.
# rpm -e mysql-server
With a simple query we see that only the client is installed now:
# rpm -qa | grep mysql
mysql-5.0.45-7.el5
Now we try to remove the client:
# rpm -e mysql
error: Failed dependencies:
libmysqlclient.so.15 is
2.el5.i386
needed
by
(installed)
perl-DBD-MySQL-3.0007-
The error tells us that we cannot uninstall mysql as there is one installed package that uses it. So we first
have to clear any dependencies and then we can perform the uninstall.
Note: At this point we could ignore dependencies but that is not advisable as we would leave some
broken dependency chains on our system. In other words, ignoring dependencies could lead to installed
but not functional software.
#
#
#
#
#
#
rpm
rpm
rpm
rpm
rpm
rpm
-e perl-DBD-MySQL
-e mysql
-e perl-DBI
-qa | grep mysql
-qa | grep DBI
-qa | grep DBD
3
As we can see from the queries there is no sign left of mysql or the two other dependencies.
Exercise 3
We saw that trying to manage package dependencies ourselves can be a really cumbersome activity. We
can avoid this trouble by using a metapackager instead. A metapackager would save us a lot of work as
we dont need to bother finding and downloading packages and especially we dont have to worry about
dependencies. Before we can install something using YUM (rpm based metapackager) we will configure
one repository so that yum knows where to look for packages.
YUMs repositories configuration files are stored in the /etc/yum.repos.d/ directory. Inside that
directory we duplicate the existing configuration file under another name:
#cd /etc/yum.repos.d/
#cp rhel-debuginfo.repo
rhel-distdvd.repo
Now we edit the new file (rhel-distdvd.repo) to suit our needs. The final contents of this file will be:
[rhel-distdvd]
name=Red Hat Enterprise Linux Distribution DVD
baseurl=file:///mnt/distdvd/Server
enabled=1
We changed the identifier, the name, the url to point to our distribution dvd and we have enabled
(made YUM use it) the repository by changing the enabled property to 1. Now that we have the
repository configured we will give the command to install mysql-server.
# yum --nogpg install mysql-server
We included the --nogpg option because otherwise the install would fail as we didnt download and
install a public key for this repository and yum cannot check the authenticity of the packages. Including
the publick key does not meet our point at this moment so well just skip it although in a production
environment it is advisable to verify if packages come from a trusted source.
Doing some queries we can see that from a single command all the needed packages were installed:
# rpm -qa | grep mysql
mysql-5.0.45-7.el5
mysql-server-5.0.45-7.el5
# rpm -qa | grep DBD
perl-DBD-MySQL-3.0007-2.el5
# rpm -qa | grep DBI
perl-DBI-1.52-2.el5