Вы находитесь на странице: 1из 3

Software on Red Hat Enterprise Linux is provided in the RPM (Red Hat Package

Manager) format. The package are provided from repositories (Containers). The
maintainer of the repository publishes updated packages in the repository which
helps us to install the most recent version of the software.

YUM Server
----------
The solution for dependency hell is the Meta Package Handler. Meta Package Handler,
which in Red Hat is known as yum (Yellowdog Update Manager). Metadata information
is stored on the local system in the /var/cache/yum directory.
When any # yum command starts, it first checks the file /etc/yum.conf for default
settings. The /etc/yum.conf file is the basic YUM configuration file. You can also
identify the location of repositories here, although the /etc/yum.repos.d directory
is the more typical location for identifying repositories. Cache files
(/var/cache/yum) and log entries (/var/log/yum.log)

Setup Repository (YUM Server)


1. # mkdir /repo (Create in root of file system)
2. Insert the Red Hat installation DVD
3. # cd /media/RHEL[Tab] ? # cd Packages
4. # cp * /repo
5. # cd /repo
6. # rpm -ivh deltarpm[Tab] ? # rpm -ivh python-deltarpm[Tab]
7. # rpm -ivh createrepo[Tab]
8. # createrepo /repo (Creates the metadata to use the dir as a repository)

Syntax of /etc/yum.conf

cachedir ? Location of Cache Directory; keepcache ? Tells whether to keep cache or


clear it [0=no,1=yes]
debuglevel ? Detail level of log-file; logfile ? Specifies the log-file to be
maintained; exactarch ? Match architecture (32 or 64 bit) before install. [1=match;
0=do not match]; gpgcheck ? Verify Package Integrity (1=yes; 0=no); plugins ?
whether to install plugins [1=yes, 0=no];
# man yum.conf ? Refer to man page for more details
If system is registered with RHN (Red Hat Network) all package related operations
are conducted from /etc/sysconfig/rhn/up2date file. For user specific YUM server
repositories, a linker file with the extension .repo has to be created in
/etc/yum.repos.d/ directory. The file can have any name.

Setup Client (a single pc can be configured to be both server and client)


Create a new .repo file in /etc/yum.repos.d/
# vim /etc/yum.repos.d/max.repo
<File Syntax>
[REPO ID]
name= ? Name of repository
baseurl=file:///repo ? For local repo
baseurl=http://pc1.example.com ? for remote YUM server
gpgcheck=1/0 ? Enable(1) or Disable(0) package integrity check
enable=1/0 ? Enable(1) or Disable(0) repository

Managing Repositories
Configure the server to find the repository. Create a repository file in the
directory /etc/yum.repos.d. The file extension should be .repo.
# yum repolist & # yum search <package name> (Issue these 2 commands before
creating the repo)
Installing Software with Yum
# yum search <package name> (Search in package name & summary)
# yum search all <package name> (Search in package description also)
# yum provides */filename (search packages containing a specific file.)
# yum whatprovides. (shows exactly which package you need to find a specific file)
# yum info <package> (short description of the package content and metadata)
# yum install -y (Resolve dependencies & install) --nogpgcheck (Skip GPG check)
# rpm -ivh packagename.rpm (does not update the yum database) ;;; Use # yum
localinstall
# yum check-update (Check for updates)
# yum update <package> (removes the older version of the package)
# yum update kernel --> Keeps the older kernel
# yum list <package name> ? Shows version of presently installed package
# yum list available ? Shows packages available for fresh installation as well as
updates
# yum list installed ? Shows all installed packages
# yum list all ? Shows all packages (installed & not-installed)
# yum deplist <package name> ? Shows dependencies of package
# yum remove <package> (Use -y with caution as it will remove dependencies)
# yum erase <package> (Removes a single package)
# yum reinstall <package> (Re-install package)
# yum history ? Shows YUM transaction history
# yum history list <Package Name> ? Shows all transactions related to specific
package.
# yum history info <transaction ID> ? Shows info about particular transaction
# yum history undo <transaction ID> ? Un-install all packages installed in the
particular transaction
# yumdownloader <Package Name> ? Download .rpm file from YUM repository.
# repoquery -ql <package name> (Exact list of the contents of the package)

Package Groups - In a package group, all packages that relate to specific


functionality exist.
--------------

# yum grouplist - Provides a list of all yum package groups.


# yum groupinfo <Group Name>
# yum groupinstall <Group Name>
# yum groupupdate <Group Name>
# yum groupremove <Group Name>

Vital Info
----------
On the system, two package databases are maintained: the yum database and the rpm
database. When you are installing packages through yum, the yum database is updated
first, after which the updated information is synchronized to the RPM database. If
you install packages using the rpm command, the update is written to the rpm
database only and will not be updated to the yum database, which is an important
reason not to use the rpm command anymore to install software packages.

Maintenance
-----------
# yum clean packages (clean the current package-based cache) ;; # yum clean
metadata (Clearing /var/cache/yum, clean excess XML-based cached metadata files) ;;
# yum clean dbcache (remove cached SQLite database files) ;; # yum clean all (clean
all files associated with enabled repositories) ;; # yum makecache (rebuild yum
cache & restore YUM)
# yum check (Check for errors) ;; # yum clean rpmdb {removes _db* files from the
/var/lib/rpm directory (regenerating those database files to clean up any
problems)}

Вам также может понравиться