Nethence Newdoc Olddoc Lab Your IP BBDock  


Warning: those guides are mostly obsolete, please have a look at the new documentation.

UnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigs

Redhat package management
 
http://pbraun.nethence.com/doc/sysutils_linux/redhat.html
http://pbraun.nethence.com/doc/sysutils_linux/redhat_packages.html
http://pbraun.nethence.com/doc/sysutils_linux/logwatch.html
http://pbraun.nethence.com/doc/sysutils/log_rotation.html
 
 
Red Hat Network
Note. you need to register some user to log into RHN
 
On RHEL3,4
rpm --import /usr/share/rhn/RPM-GPG-KEY
up2date-nox --register
Note. if using a proxy, add,
  --proxy proxy.example.net:8080 \
  --proxyUser USERNAME \
  --proxyPassword PASSWORD
 
Later, you will then be able to synchronize your package profile by doing,
up2date-nox -p
 
Update some packages,
up2date-nox -u openssh httpd samba
 
Update everything (proceeds minor release update),
up2date-nox -u
 
Other commands,
up2date --nox --show-channels
up2date --nox --showall | grep ssh
Note. also,
--show-orphans
--show-available
 
 
On RHEL5
rhn_register --nox
Note. if using a proxy, add,
--proxy=proxy.example.net:8080 \
--proxyUser=USERNAME \
--proxyPassword=PASSWORD
 
Later, you will then be able to synchronize your package profile by doing,
rhn-profile-sync
 
Update some packages,
yum update openssh httpd samba
 
Update everything (proceeds minor release update),
yum update
 
 
32 vs 64 bit
For 32 / 64bit compatibility on x86_64 machines, those packages might help,
compat-arch-development
compat-arch-support
x86-compat-libs
 
You might want to add this macro to differentiate 32 and 64bit packages,
echo "%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}" >> ~/.rpmmacros
 
 
RPM usage
Install some package,
rpm -ivh package.rpm
 
Delete some package,
rpm -qa | grep -i package
rpm -e packagename
 
List some installed package's content,
rpm -qa | grep -i package
rpm -ql packagename
 
Find out what package some files belongs to,
rpm -qf /etc/passwd
 
Look for non Redhat packages,
rpm -qa --qf '%{NAME} %{VENDOR}\n' | grep -v 'Red Hat, Inc.'
 
 
YUM usage
Check,
yum clean all
yum search screen
 
Look for a precise package,
yum search PACKAGE | grep base
Note "base" being the repo name.
 
Look for available package groups,
cd /mnt/cdrom/repodata
grep '<id>' comps.xml
install a package group,
yum groupinstall base-x
 
up2date usage
Download some package,
up2date --get packagename
 
Delete some package,
up2date -d packagename
 
 
YUM configuration
YUM / Exclude kernel
Exclude kernel from updates,
cd /etc
vi yum.conf
add,
exclude=kernel*
 
YUM / Proxy
cat >> /etc/yum.conf <<EOF9
proxy=http://proxy.example.net:8080
proxy_username=USERNAME
proxy_password=PASSWORD
EOF9
 
YUM against DVD/CDrom
To easyly deal with dependencies on an isolated network, use your own (nfs,ftp,http) repository or simply your installation DVD (no updates),
cd /mnt
mkdir -p cdrom
mount /dev/cdrom cdrom
 
Configure your repository,
cd /etc/yum.repos.d
mv rhel-debuginfo.repo rhel-debuginfo.repo.dist
vi cdrom.repo
like,
[cdrom]
name=cdrom
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
Or,
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.dist
mv CentOS-Media.repo CentOS-Media.repo.dist
cat > rhel55.repo <<EOF9
[rhel55]
name=rhel55
baseurl=ftp://ftp.free.fr/mirrors/ftp.centos.org/5.5/os/i386
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
[updates55]
name=updates55
baseurl=ftp://ftp.free.fr/mirrors/ftp.centos.org/5.5/updates/i386
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
EOF9
 
Self-made Redhat repositories
Simple copy of the install media or online repository
To create a repository from the installation CD by HTTP,
rmdir /var/www/html
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
ln -s /mnt/cdrom /var/www/html
service httpd start
or by NFS,
vi /etc/exports
in example,
/mnt/cdrom  *(ro,no_root_squash)
then,
service nfs start
 
Get the repo by rsync using a local mirror,
cd /var/ftp/
rsync -avz rsync://centos.mirrors.ovh.net/ftp.centos.org/6.7/os/x86_64 CentOS6.7
 
No need to use 'createrepo', the repo is already recorded into the copied folder (repodata/).
 
Customized repository
To create your own repository,
yum install createrepo
createrepo <repodir>
 
Replicating a Redhat repository with updates
Quoting redhat,
NOTE: Please change the --repoid=<REPO_ID> according to what repo id the system is currently using.
So you will need several boxes and send the files to one NFS share if you want several releases (or buy RH Sattelite)...
 
For RHEL7,
yum install yum-utils createrepo
yum repolist all | grep enabled
#subscription-manager repos --list
(copy/paste the repo id)
reposync --gpgcheck -l --repoid=rhel-7-server-rpms --download_path=/var/www 
ls -l rhel-7-server-rpms/
Ref. How to create a local mirror of the latest update for Red Hat Enterprise Linux 5, 6, 7 without using Satellite server?: https://access.redhat.com/solutions/23016
 
RPM Repositories
- CentOS RPMS : http://ftp.free.fr/mirrors/ftp.centos.org/
- RHEL SRPMS : ftp://ftp.redhat.com/
- EPEL RPMs : http://fedoraproject.org/wiki/EPEL
- DAG RPMs : http://dag.wieers.com/rpm/packages/
- Pbone RPMs : http://rpm.pbone.net/
- Karanbir RPMs : http://centos.karan.org/
- Macromedia Flash Tips : http://macromedia.mplug.org/
 
 
RPM advanced maintainance
Rebuild the RPM database,
cd /var/lib/rpm
rm -f __db*
db_verify Packages
rpm -vv --rebuilddb
#up2date -p
Note. db_verify on rhel4
 
 
Redhat upgrades
Major release upgrade
From e.g. RHEL4.4 to RHEL5,
 
Configure the new GPG key,
wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
rpm --import RPM-GPG-KEY-CentOS-5
 
Install the release RPMs,
wget http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i386.rpm
wget http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm
rpm -Uvh centos-release-5-0.0.el5.centos.2.i386.rpm centos-release-notes-5.0.0-2.i386.rpm
 
Install the new kernel,
wget http://mirror.centos.org/centos/5/os/i386/CentOS/initscripts-8.45.14.EL-1.el5.centos.1.i386.rpm
wget http://mirror.centos.org/centos/5/os/i386/CentOS/kernel-2.6.18-8.el5.i686.rpm
wget http://mirror.centos.org/centos/5/os/i386/CentOS/SysVinit-2.86-14.i386.rpm
rpm -Uvh --nodeps SysVinit-2.86-14.i386.rpm initscripts-8.45.14.EL-1.el5.centos.1.i386.rpm kernel-2.6.18-8.el5.i686.rpm
 
Configure /etc/yum.repos.d/* and upgrade,
yum clean all
yum upgrade
 
Minor release upgrade
From e.g. 5.1 to 5.2 just configure /etc/yum.repos.d/* and upgrade,
yum cleanall
yum update
note. if you have SAN and are using third-parity tool which changed initrd, you might want to avoid changing the kernel,
#yum --exclude=kernel update
check,
cat /etc/redhat-release
 
 
YUM on RHEL3
We will be using an old version of YUM, using headers (yum-arch) instead of repodata (createrepo).
 
Install YUM,
cd ~/
wget http://dag.wieers.com/rpm/packages/yum/yum-2.0.8-0.1.el3.rf.noarch.rpm
rpm -ivh yum-2.0.8-0.1.el3.rf.noarch.rpm
 
Prepare YUM,
mkdir -p /var/cache/yum/base/packages  
cd /mnt/nfs
yum-arch -q RedHat
cd RedHat
cp headers/header.info /var/cache/yum/base
cp -R headers /var/cache/yum/base
 
Configure YUM,
cd /etc
cp yum.conf yum.conf.dist
vi yum.conf
remove all repos and configure this one,
[base]
name=base
baseurl=file:///mnt/nfs/RedHat
gpgcheck=0
 
Ready to go,
yum clean all
yum search screen
yum install screen
 
 
References
http://www.centos.org/docs/5/html/yum/sn-yum-maintenance.html
http://wiki.centos.org/AdditionalResources/Repositories?action=show&redirect=Repositories
http://kbase.redhat.com/faq/docs/DOC-9733
YUM: Setup and Usage : http://sial.org/howto/yum/
yum RPM packages for Red Hat, CentOS and Fedora : http://dag.wieers.com/rpm/packages/yum/
http://kbase.redhat.com/faq/docs/DOC-6904
 

(obsolete, see the new doc)