Sei sulla pagina 1di 20

How to create dump of RHEL CD

Step 1: Create directory

Mkdir /dump

Step 2 : Copy packages into /dump folder

Createrepo /dump/(createrepo /dump/)

cd /etc/yum.repos.d/

Step 3: Remove existing files inside /etc/yum.repos.d/

Rm rf /etc/yum.repos.d/*

Step 4: Create new file and add below content as per below.

vi rhel-5.8.repo (create new file)

[root@server yum.repos.d]# more rhel-5.8.repo

[local]

name=rhel-5.8

baseurl=file:///dump

enabled=1

gpgcheck=0

yum clean all

Whether you perform network installation or create yum repository file you need dump of
RHEL CD. It is generally created on server in RHCE exam. Candidate is given a location
ofthis dump to perform network installation. We will create dump of RHEL CD on
/var/ftp/pub and use this for network installation or to create yum repository files.

Check how many space is available on /var partition mimimun 4 GB space is required

Now mount RHEL dvd on mnt and copy entire disk on /var/ftp/pub

Dump is created on /var/ftp/pub now you can umount RHEL dvd

If you have more than 1 yum local repo, in this case if you want to install package default from
specific repo then you can use below command

# yum repolist

Using above command you can find all repos which are available. Then disable all and enable which
is your require.

yum --disablerepo="*" --enablerepo="Prasad.repo" list available

Which returns available packages that are only in that particular repo

yum --disablerepo "*" --enablerepo prasad.repo list all

935 yum --disablerepo "*" --enablerepo prasadlocal.repo list all

936 clear

937 history

[root@masterserver ~]# ls -l /etc/yum.repos.d/

total 16

-rw-r--r--. 1 root root 95 Feb 4 10:13 local.repo

-rw-r--r--. 1 root root 109 Feb 19 21:01 packagekit-media.repo


-rw-r--r--. 1 root root 74 Feb 23 17:16 prasad.repo

-rw-r--r--. 1 root root 2545 Dec 24 19:24 public-yum-ol6.repo.old

[root@masterserver ~]# cat /etc/yum.repos.d/prasad.repo

[prasad.repo]

name=prasad.repo

baseurl=file:///dump1

gpgcheck=0

enabled=1

[root@masterserver ~]# cat /etc/yum.repos.d/local.repo

[prasadlocal.repo]

name=prasadlocal.repo

baseurl=file:///var/ftp/pub/dump

gpgcheck=0

enabled=1

yum --disablerepo="*" --enablerepo="Prasad.repo" install rsyslog4

Configure yum server

RHCE EXAM QUESTION


Backup of the Redhat Enterprise Linux 5 is taken in /var/ftp/pub on server named
Server.example.com. You can install all required packages using yum by creating the
repository file.

Pre quest of yum server

we assume that you have completed these pre quest of yum server

A Linux system with hostname Server.example.com and with ip address of 192.168.0.254


Dump of RHEL disk on /var/ftp/pub location

Once you have completed these pre quests follow this guide.
change directory to /var/ftp/pub/Server

yum and createrepo rpm are required for yum server install them

Now install createrepo rpm

After installing necessary package change directory to /var/ftp/pub

Now create repository of Server directory

repository of all rpm will be created in few minute

Now create repository for VT


In few second all necessary repository will be created for VT

Now create errata directory and repository for it

During the process of creating repository two hidden directory with named .olddata is
created automatically remove them

Now check hostname and change directory to /etc/yum.repos.d. copy sample repository file
to the file with hostname And open it

Default repository file look like these

Remove defaults line and set new location of Sever and VT as shown here
Save file with :wq and exit

Now remove all temporary data file with yum clean all command

Congratulation You have successful create yum server

To test yum server remove telnet package

After checking all dependences it will ask for conformation press y

Now install telnet package from yum server


After checking all dependences it will ask for conformation press y

Configure and Install YUM Server In


Redhat(RHEL5/6)
May 22, 2008

In Linux you can install packages through many ways like.

1. Through RPM,

2. Through shell script

3. Through source tar balls etc.

YUM(Yellow-dog Updater and Modifier) is another and advanced way of installing the
packages in Linux distro's such as Red-hat, Fedora and CenOS.

In RHEL4 installing packages is a tedious process, some times its headache to install all the
dependencies. So Red-hat come with a solution to overcome this dependencies problem in
most situations, the solution for this is nothing but YUM implementation. This will resolve
this dependency issue and other known issues. Here we are going to present some basic way
how to use YUM utility to install packages locally(there are so many ways to install packages
from different sources either local or remote such as ftp, http).

Basic YUM implementation locally:

Step1 :Copy the entire OS cd's content to Hard-drive as below.


#cp -ar /media/cdrom/Server/* /destinationfolder

Example :

server1#cp -ar /media/cdrom/Server/* /var/ftp/pub/Server/

Note :
1. From second cd too Server content in to our /var/ftp/pub/Server/ folder as shown below.
2. Here please take destination folder as /var/ftp/pub so that we can implement FTP server to
share our repository.
3. If you have RHEL5 DVD then execute below command once.

server1#cp -ar /media/cdrom/Server/* /var/ftp/pub/Server/

Step2 : Now change the directory to /var/ftp/pub/Server and install the createrepo package

server1#cd /var/ftp/pub/Server
server1#rpm -ivh createrepo*

Step3 : Specify the repository location to YUM.

server1#createrep -v .

Note:There is the dot in the above command.


Step4 : Create a file with repo as extension and specify the YUM details in /etc/yum.repos.d
folder

server1#cd /etc/yum.repos.d/
server1#vi testing.repo

Note : The directory /etc/yum.repos.d/ contaions two .repo files which should be removed or
moved to other directory, so that YUM server will check default .repo file it self.Q. What if I
don't move or remove the default .repo files from /etc/yum.repos.d/ folder?A: Every time
when you try to install packages through YUM, your yum will check all these files for
repositories for getting packages which will or will not work and most probably delay is
increased in getting those packages from online servers.

The new file which is created contains as follows.

[server1.linuxnix.com] comment ="test"


baseurl=file:///var/ftp/pub/Server
gpgcheck=0

After entering these entries save and exit from the file.

Let me explain what actually these four entries mean.

[server1.example.com] ==>This informs what is the repository name.


comment ==> Its used to see the information about the repo.

baseurl ==> This is the server and path of the repo(here its a local repo so the base url is just
a file:///
For example you are creating YUM client through FTP then base url should be like this

baseurl=ftp://station1.example.com/pub/Server

gpgcheck ==> This is to check the authentication of the repository, which is disabled in this
case.
Local YUM repository is created, now you can install any package you want with yum
command. In order to know more about YUM, Please see man pages for YUM.
Note:In-order to use yum repository we have to clean the yum meta data, so before installing
any package first time use yum clean all command as shown below.

server1#yum clean all

Basic YUM Server Repository through FTP server :

So what about Installing packages remotely by using this repository?

Let us see how to configure client to access this repository. Before doing client configuration
we have to share this repository through FTP or HTTP.

Step1 : Install vsftpd server on server

server1#yum install vsftpd

Step2 : Start the ftp service and on it

server1#service vsftpd restart

server1#chkconfig vsftpd on

That's it on the server side every thing configured properly, Now move on to client machine.

Conflagration Yum client in Linux


Step3 : Remove/move the local repository file from /etc/yum.repo.d/ folder to some other
location #mv /etc/yum.repo.d/* /tmp/

Step4 : Create server.repo file in /etc/yum.repo.d/ with following contents

[server1.linuxnix.com]
comment ="test"
baseurl=ftp://server1.example.com/pub/Server
gpgcheck=0

Save and exit the file Now start using yum to install packages, as follows.
client1#yum clean all
client1#yum install packagename

Example :

client1#yum install httpd

To uninstall a package through YUM

client1#yum remove httpd

To see the info of a package

client1#yum info packagename

To see the package is already installed or not

client1#rpm -qa grep packagename

Hope this helps to setup basic YUM server locally.

register with rhn:

443 Port should be opened from your server

Rhn.redhat.com

[prasadbs@altipayapp ~]$ telnet rhn.redhat.com 443

Trying 209.132.183.42...

Connected to rhn.redhat.com.

Escape character is '^]'.

^]

telnet> quit

Connection closed.

# rhn_register
# rhnreg_ks --username=<RHN or Satellite login> --password=<RHN or
Satellite password> --force

Or

subscription-manager register --username your_username --password


your_password

[root@altipayapp rhn]# pwd

/etc/sysconfig/rhn

[root@altipayapp rhn]# ls

allowed-actions clientCaps.d rhnsd systemid up2date up2date.rpmnew

[root@altipayweb rhn]# /etc/init.d/rhnsd status

rhnsd (pid 5167) is running...

[root@altipayweb rhn]# /etc/init.d/rhnsd status

rhnsd (pid 5167) is running...

[root@altipayweb rhn]# rpm -qa | grep rhn

rhnlib-2.5.22-15.el6.noarch

yum-rhn-plugin-0.9.1-49.el6.noarch

rhn-setup-1.0.0.1-16.el6.noarch

rhn-client-tools-1.0.0.1-16.el6.noarch

rhn-setup-gnome-1.0.0.1-16.el6.noarch

rhn-check-1.0.0.1-16.el6.noarch

rhnsd-4.9.3-2.el6.x86_64

Unregistering a system
Raw

# subscription-manager remove --all


# subscription-manager unregister
# subscription-manager clean

how to see subscription details:

more /etc/sysconfig/rhn/systemid
<name>profile_name</name>

<value><string>altipayweb.altimetrik.com</string></value>

</member>

<member>

<name>system_id</name>

<value><string>ID-1027843310</string></value>

Other tool for register and manage rhn registration:

COMMANDS AND OPTIONS

Subscription-manager has specific options available for each command, depending on what
operation is being performed. Subscription Manager com-

mands are related to the different subscription operations:

1. register

2. unregister

3. attach

4. auto-attach

5.remove

6. release

7. service-level

8. import
9. redeem

10. list

11. refresh

12. environments

13. repos

14. orgs

15. plugins

16. identity

17. facts

18. clean

19. config

20. version

21. status

[root@altipayweb ~]# subscription-manager status


+-------------------------------------------+

System Status Details

+-------------------------------------------+

Overall Status: Current

[root@altipayweb ~]# subscription-manager register

WARNING

This system has already been registered with Red Hat using RHN Classic.

Your system is being registered again using Red Hat Subscription Management. Red Hat
recommends that customers only register once.

To learn how to unregister from either service please consult this Knowledge Base Article:
https://access.redhat.com/kb/docs/DOC-45563

This system is already registered. Use --force to override

[root@altipayweb ~]#

How to install only security packages.

Install Plugin
Type the following command:
# yum install yum-security

How Do I Display Available Security Updates?

Type the following command:


# yum list-security

# yum --security check-update

To get the information on advisory RHSA-2009:1148-1 use:


# yum info-security RHSA-2009:1148-1
How Do I Install All The Security Updates Only?

Type the following command to download and install all the available security updates:
# yum update --security

yum --security update

In Enterprise Linux, it is often desirable to minimize the number of updates to install. Many
admins just want to apply security-related updates. This is easily done using yum security
plugin. First, install the plugin:

yum install yum-plugin-security

To install only the security updates :

yum --security update

Youll see something similar to:

===========================================================================
========
Package Arch Version Repository
Size
===========================================================================
========
Updating:
mysql x86_64 5.1.69-1.el6_4 rhel-x86_64-server-6
907 k
mysql-libs x86_64 5.1.69-1.el6_4 rhel-x86_64-server-6
1.2 M
mysql-server x86_64 5.1.69-1.el6_4 rhel-x86_64-server-6
8.7 M

Transaction Summary
===========================================================================
========

Thats it. But there are many other things you can do. For example, yum updateinfo has
some handy options. Try the following:

yum updateinfo summary


yum updateinfo list security
yum updateinfo list available
yum updateinfo list bugzillas

The first command may show:

Updates Information Summary: available


3 Important Security notice(s)
2 Bugfix notice(s)
updateinfo summary done

The second command will display the advisory info such as:
RHSA-2013:0772 Important/Sec. mysql-5.1.69-1.el6_4.x86_64

Then you can apply the update based on the advisory:

yum update --advisory RHSA-2013:0772

Notes for CentOS users


At the time of this writing, CentOS does not have the yum security feature implemented. This
might change in a future. Stay tuned.

Notes for Scientific Linux users


Scientific Linux has been providing the package updates in two repositories, sl-security and

sl-fastbugs. The sl-security repo contains security-related packages plus their dependencies
and is shipped enabled by default. The sl-fastbugs repository is for non-security updates
which is shipped disabled. Thus, applying security only updates is the default behavior.

Downgrade

[Nagios-server@root ~]# cat /etc/redhat-release

CentOS release 6.7 (Final)

[Nagios-server@root ~]# uname -r

2.6.32-573.el6.i686

[Nagios-server@root ~]# yum downgrade redhat-release

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Downgrade Process

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package centos-release.i686 0:6-5.el6.centos.11.1 will be a downgrade

---> Package centos-release.i686 0:6-7.el6.centos.12.3 will be erased

--> Finished Dependency Resolution


Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Downgrading:

centos-release i686 6-5.el6.centos.11.1 centos6.7 20 k

Transaction Summary

================================================================================

Downgrade 1 Package(s)

Total download size: 20 k

Is this ok [y/N]: y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : centos-release-6-5.el6.centos.11.1.i686 1/2

Cleanup : centos-release-6-7.el6.centos.12.3.i686 2/2

Verifying : centos-release-6-5.el6.centos.11.1.i686 1/2

Verifying : centos-release-6-7.el6.centos.12.3.i686 2/2

Removed:

centos-release.i686 0:6-7.el6.centos.12.3
Installed:

centos-release.i686 0:6-5.el6.centos.11.1

Complete!

[Nagios-server@root ~]# yum downgrade redhat-release

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Downgrade Process

Loading mirror speeds from cached hostfile

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os error was

14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

Error: Cannot find a valid baseurl for repo: base

[Nagios-server@root ~]# cat /etc/redhat-release

CentOS release 6.5 (Final)

yum list updates

List all packages with updates available in the yum repositories

yum list recent

List packages recently added into the repositories. This is often not helpful,

but what you may really want to use is "yum list-updateinfo new" from the secu-

rity yum plugin


yum -y install

Check for Available Updates using Yum


# yum check-update

11. Update System using Yum


# yum update

[root@openldapser centos6.5]# uname -r


2.6.32-431.el6.i686

[root@openldapser centos6.5]# yum update


Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.i686 1:0.8.1-66.el6 will be updated
---> Package NetworkManager.i686 1:0.8.1-99.el6 will be an update
Transaction Summary
================================================================================
Install 29 Package(s)
Upgrade 551 Package(s)
Total download size: 679 M
Is this ok [y/N]:

Excluding some packages

# yum update --exclude=PACKAGENAME

For example, to exclude all kernel related packages:

# yum update --exclude=kernel*

To make permanent changes, edit the /etc/yum.conf file and following entries to it:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exclude=kernel* redhat-release*

NOTE: If there are multiple package to be excluded then separate them using a single space
or comma. Also, do not add multiple exclude= lines in the configuration file
because yum only considers the last exclude entry.

To exclude 32 bit packages edit /etc/yum.conf file.

exclude=*.i?86 *.i686

yum -x php,httpd update

Potrebbero piacerti anche