Linux and other Unices prevent ordinary users from being able to install, remove, or modify software, libraries, or important configurational information. On a networked, professionally run installation of workstations the need for this sort of control to ensure security and functionality is obvious. On a privately owned and controlled workstation, the need is less obvious but just as profound. Even there the owner of the workstation needs to take extreme care whenever working with the fundamental system configuration and package installation or they will likely break the system or leave it vulnerable to crackers.
To ensure that an adequate degree of care is exercised when doing things that could render a system unusable or vulnerable, linux and Unices require the owner of such a workstation to assume root privileges, usually by means of the su command. In order to execute the privileged commands to add or remove software from your system, you must therefore become root. To do this, enter (in a tty window such as an xterm):
and enter the root password when prompted to do so. The prompt should become the sharp sign `#'
# yum list
to remind you to be sharp as root.
Warning! It is essential that you heed this advice to "be sharp" as you can destroy your system's installation with a careless keystroke, especially one involving wildcards such as '*' or '?'. Certain yum commands (notably upgrade and remove) can have unexpected side effects depending on the whims of the maintainers of RPMs in the repository, so caution and testing are advised. Be certain that you understand what a command will do, including side effects, before invoking it, especially with commands that delete files.
Some yum commands will actually work fine for ordinary, unprivileged users. In general these are the informational yum commands, discussed next. Note that the unprivileged commands do require that the yum header cache exist, so they will not work at all correctly if run before root has run a yum command to create current images of the header files.
There are basically two ways to "get yum".
If your distribution is RPM based, it may well already have it. See if the "yum list" command works. This is by far the best way to get yum -- by already having it installed and ready to run.
If you are setting up a repository to serve a LAN (or even a WAN) or you are planning to install yum for use as a client to support local software installation on a LAN, perhaps using a oon-RPM operating system with its own update and install mechanism, tenn you should get the yum tarball (.tgz compressed source directory) from the yum website http://yum.baseurl.org.
In this case building yum and getting it to work is beyond the scope of this HOWTO, as you may need to get and install other libraries and tools (such as python) in order to get it to work. Follow instructions in the tarball and/or seek hep from the yum mailing list to proceed.
The same is true of ancilliary tools such as createrepo. They will be instantly available on an RPM-based system that provides yum, because you can execute (from a command line, as root):
# yum -y install createrepoand seconds later it will be installed. A command such as:
# yum list yum\*(carefully copy the backslash and *) will list all of the other yum-related tools available in the distribution's basic set of repositories by default. Otherwise you will need to build them, from source, getting the sources from their respective project websites.
To set up a repository of your own to serve a private LAN or public WAN or both, you will need the yum tarball so that you can build and install it to bootstrap its use. If you are new to yum, you should likely start with the stable tarball, not the development tree, and join the yum list.
To get the stable tarball is simple. Just visit the yum website, http://yum.baseurl.org, and download it.
It is also possible to get yum directly from the development tree using "git" as it is hosted on the yum project website. Most normal humans" won't need or want to do this -- it might have cool new features or support a broader range of cutting edge distributions and releases, but it also might have bugs. Even immediately fatal bugs -- some snapshots you might grab will simply be pre-broken and need immediate replacement.
Don't let these dire-sounding warnings deter you, though. The entire operating system you are using (presuming that you are using Linux) was built by precisely this process, and many hands contributing a small bit of work, intelligently directed, can create incredibly powerful tools. Come on in, the water's fine! Especially if you have mad python skills and some clever ideas...;-)
To pull the latest snapshot of yum in this way, just visit the project website and follow the simple step by step instructions on the screen. They do require that you have the "git" program on your development system, which may leave you with a bit of a chicken and egg problem -- if you had yum already, you could just use "yum -y install git" and a few seconds later you'd have it ready to go. For this reason it is suggested that you start with the non-development tarball (or one of the many distributions that already support yum) and ease over into development. It's better that way anyway, as you want to start with something that already works!
Therefore, it is strongly recommended that one become pretty thoroughly familiar with yum from using a stable release version and at least listening in on the yum list (which is mailman-managed and hence can easily be digested or throttled altogether) before tackling a git-based build. Knowing python is probably a good idea as well.
Once you have yum installed, either natively, from the stable tarball, or the git-delivered development tree, you can either use it to do installs and updates or use it and createrepo and rpmbuild to craate your own repository. If all you want to do is the former, skip ahead to the section on using yum. If you are interested in setting up your own repository, continue straight on to the next section.