List rpm package content

To list the contents of a package just run the command

# rpm -ql packagename

Example

# rpm -ql nmap

/usr/bin/nmap
/usr/share/doc/nmap-3.70
/usr/share/doc/nmap-3.70/COPYING
/usr/share/doc/nmap-3.70/COPYING.OpenSSL
/usr/share/doc/nmap-3.70/README
/usr/share/doc/nmap-3.70/nmap-fingerprinting-article.txt
/usr/share/doc/nmap-3.70/nmap.deprecated.txt
/usr/share/doc/nmap-3.70/nmap.usage.txt
/usr/share/doc/nmap-3.70/nmap_doc.html
/usr/share/doc/nmap-3.70/nmap_manpage.html
/usr/share/man/man1/nmap.1.gz
/usr/share/nmap
/usr/share/nmap/nmap-mac-prefixes
/usr/share/nmap/nmap-os-fingerprints
/usr/share/nmap/nmap-protocols
/usr/share/nmap/nmap-rpc
/usr/share/nmap/nmap-service-probes
/usr/share/nmap/nmap-services

Rotate logs manually

Today I had to manually rotate a couple of logs since they had generated a filesize of over 1.8GB of pure text.

This was done by issuing the command

logrotate /etc/logrotate.d/file_to_be_rotated

In my case I had to rotate my firewall log /var/log/firewall described in a custom made file, /etc/logrotate.d/firewall

logrotate -v -f /etc/logrotate.d/firewall

-v Verbose logging
-f Force rotation of logs even if not needed

Upgrade from Fedora Core 7 to Core 8

This is the steps I took to upgrade a running Fedora Core 7 installation to Core 8 using yum from the command line. Please note that live upgrades are not recommended by the Fedora Project.

Make a list of the systems current packages for later reference:

rpm -qa --qf '%{NAME}\n' | sort | uniq > ~/new-pkgnames.txt

Make a backup of any system configuration data (as root):

tar czf ~/etc-`date +%F`.tar.gz /etc


yum clean all

Make sure the new repo files isn’t placed as .rpmnew files, perhaps by

mv /etc/yum.repos.d/fedora-updates.repo.rpmnew /etc/yum.repos.d/fedora-updates.repo
mv /etc/yum.repos.d/fedora.repo.rpmnew /etc/yum.repos.d/fedora.repo

Also make sure that all the 3rd party repos you normally use point to the repository for the new Fedora release.

Next the upgrade.
Make sure you are in runlevel 3

telinit 3

Run the following command to update the yum repo on your box:

rpm -Uhv rpm -Uvh rpm -Uvh http://mirror.anl.gov/pub/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-release-8-3.noarch.rpm http://mirror.anl.gov/pub/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-release-notes-8.0.0-3.noarch.rpm

yum might complain about conflicts or requirements. That is probably because you have used non-standard repositories or installed non-standard packages manually. Try to guess which packages cause the problem (or at least is a part of the dependency chain) – uninstall them and try again. Remember to install the packages again if they are essential.

Tip: Find and review “lost” packages.
You can find orphaned packages (ie packages not in the repositories anymore) after the upgrade with the tool package-cleanup from the yum-utils package

yum install yum-utils; package-cleanup --orphans

It’s often helpful to run this command before the update, too. For packages with a failing “%postun” script the old package will remain partly installed. Remove it with

rpm -e package-name-and-version

If you forget to remove the avahi package it will refuse to be removed from the system with a error message “error: %postun(avahi-0.6.17-1.fc7.i386) scriptlet failed, exit status 1”. I haven’t looked up this error message any further.

I had to clean yum to make it aware of the recent package change, this might not be necessary.

yum clean all
yum upgrade

Ensure that all (new) essential packages from the new version is installed with

yum groupupdate Base

You might want to update other groups too, see

yum grouplist

The system had to upgrade 937 packages before fedora Core 7 is a fedora Core 8 installation.

After the upgrade has finished a reboot is required and it was time to check for orphaned packages

package-cleanup --orphans

The command for removing these packages is described earlier.

Source: http://docs.fedoraproject.org/install-guide/f8/en_US/sn-upgrade-tree.html, http://www.ioncannon.net/system-administration/133/upgrading-from-fedora-7-to-fedora-8-with-yum/ and http://fedoraproject.org/wiki/YumUpgradeFaq

Enabling Remote Access to the Installation System

You may access either graphical or text interfaces for the Redhat installation system from any other system. Access to a text mode display requires telnet, which is installed by default on Fedora systems. To remotely access the graphical display of an installation system, use client software that supports the VNC (Virtual Network Computing) display protocol. A number of providers offer VNC clients for Microsoft Windows and Mac OS, as well as UNIX-based systems.

The installation system supports two methods of establishing a VNC connection. You may start the installation, and manually login to the graphical display with a VNC client on another system. Alternatively, you may configure the installation system to automatically connect to a VNC client on the network that is running in listening mode.

Enabling Remote Access with VNC
To enable remote graphical access to the installation system, enter two options at the prompt:

linux vnc vncpassword=astrongpassword

The vnc option enables the VNC service. The vncpassword option sets a password for remote access. The example shown above sets the password as astrongpassword. The VNC password must be at least six characters long.

Specify the language, keyboard layout and network settings for the installation system with the screens that follow. You may then access the graphical interface through a VNC client. The installation system displays the correct connection setting for the VNC client:

Starting VNC...
The VNC server is now running.
Please connect to computer.mydomain.com:1 to begin the install...
Starting graphical installation...
Press <enter> for a shell

You may then login to the installation system with a VNC client. Start the VNC client Enter the server and display number in the VNC Server dialog. For the example above, the VNC Server is computer.mydomain.com:1.

This is possible on RedHat, Fedora and probably other distributions derived on these distributions like CentOS.