Wednesday, March 9, 2016

Week 21: Day 055 - Managing Software


Hello, this week I'm focusing on yum and rpm. In other words, this is about downloads and repositories. Although I already have a good understanding of it's basic uses, I will delve into more specific things.

First of all, "Red-Hat Package Manager" is a way to archive packages and provide its metadata. This program which comes with Red Hat, is immensely important when dealing with repos. Repositories should be kept up to date as it's important for installations. In the past I have made several repos, in my successful attempt to install Google Chrome and Spotify. To tell the server which repo to use, make the extensions of your repository files ".repo".

In this exercise, you learn how to create your own repository. To perform this exercise, you need to have access to the CentOS installation disk or ISO file.

1. Insert the installation disk in your virtual machine. This mounts it on the directory /run/media/user/CentOS 7 x86_64. Alternatively, you can manually mount the ISO on the /mnt directory, using mount -o loop /path/to/centos.iso /mnt.

I don't really need to do this part.

2. Type mkdir /repo to create a directory /repo that can be used as repository.

3. If you want to create a complete repository, containing all the required files, type cp $MOUNTPATH/Packages/* repo. (Replace $MOUNTPATH with the name of the directory on which the installation disk is mounted.) If you do not need a complete repository, you can copy just a few files from the installation disk to the /repo directory.

4. Type yum install -y createrepo to ensure that the createrepo RPM package is installed.

OR you can just make a new file with the extension ".repo"

5. Type createrepo /repo. This generates the repository metadata, which allows you to use your own repository.

If you do it my way, you open the repo file you made.

6. Now that you have created your own repository, you might as well start using it. In the /etc/yum.repos.d directory, create a file with the name my.repo. Make sure this file has the following contents:
[myrepo]
name=myrepo
baseurl=file:///repo

Then type it into this file. That's all you need, then you're done!

7. Type yum repolist to verify the availability of the newly created repository. It should show the name of the myrepo repository, including the number of packages that is offered through this repository

Done.
------------------------------------------------------------------------------------------------------------

Second of all, let's talk about yum! Even though it may be deprecated some day by dnf, right now it's important for us to use this instead, since it will be on the test. yum works with repositories, which is why RPM is so important, and why they go hand in hand.

Here are all the important yum commands:

- yum install (name of file)
- yum search (name of file)
- yum update (name of file)
- yum history
- yum list
- yum provides

That's pretty much it haha. Thanks for reading.


Review Questions

1. You have a directory containing a collection of RPM packages and want to make that directory a repository. Which command enables you to do that?

createrepo

2. What needs to be in the repository file to point to a repository on http://server.example.com/repo?

[xxxx]
name=xxxxx
baseurl=http://server.example.com/repo?

3. You have just configured a new repository to be used on your RHEL computer. Which command enables you to verify that the repository is indeed available?

yum repolist

4. Which command enables you to search the RPM package containing the file useradd?

5. Which two commands do you need to use to show the name of the yum group that contains security tools and shows what is in that group?

6. Which command enables you to install an RPM that you have downloaded from the Internet and which is not in the repositories?

7. You want to make sure that an RPM package that you have downloaded does not contain any dangerous script code. Which command enables you to do so?

8. Which command reveals all documentation in an RPM?

9. Which command shows the RPM a file comes from?

10. Which command enables you to query software from the repository?

No comments:

Post a Comment