Feeds:
Posts
Comments

Archive for the ‘Fedora’ Category

RPM package database /var/lib/rpm

*.rpm – Used to install, uninstall, upgrade, query, verify a package in Redhat and SuSe Linux

rpm [option] [package_name(PN)/ package_filename(PFN)]

 

-i <PFN> : To install the package if not installed

-F <PFN> : To upgrade the package if older version already exists

-U <PFN> : To install/upgrade the package

-e <PN> : To remove the package (if no dependencies exist)

–nodeps : ignores dependency check while installing/upgrading/removing packages

–force : Replace package dependencies automatically while installing packages

-v : Verbose

-h : Shows installation program bar in terms of hash symbol

q [sub-options] <PN> : to determine whether the package is installed or not

Query [sub-options]

-a : Displays the list of all installed packages

-f <file-name: Displays the name of the package which contains the file

-i <PN> : Displays brief information about the package

-l <PN> : Displays the list of all the files that are contained in the package

-p <PFN> : To query an uninstalled package

–requires <PN> : Displays the dependencies of the package

–scripts <PN>: Displays the scripts executed while installing the package

–changelog <PN> : Displays package revision history.

–whatrequires <capability> : Displays the list of packages that requires the capability

–whatprovides <capability> : Displays the list of package that provides that capability (library file search)

History

[root@localhost ~]# rpm -q –changelog httpd | less
* Wed Mar 21 2007 Karanbir Singh <kbsingh@centos.org> 2.2.3-6.el5.centos.1
– Roll in the CentOS Mods

* Wed Nov 29 2006 Joe Orton <jorton@redhat.com> 2.2.3-6.el5
– fix path to instdso.sh in special.mk (#217677)
– fix detection of links in “apachectl fullstatus”

* Tue Sep 19 2006 Joe Orton <jorton@redhat.com> 2.2.3-5.el5
– rebuild

* Fri Aug 11 2006 Joe Orton <jorton@redhat.com> 2.2.3-3.el5
– use RHEL branding

* Thu Aug 03 2006 Joe Orton <jorton@redhat.com> 2.2.3-3
– init: use killproc() delay to avoid race killing parent

* Fri Jul 28 2006 Joe Orton <jorton@redhat.com> 2.2.3-2
– update to 2.2.3
– trim %changelog to >=2.0.52

* Thu Jul 20 2006 Joe Orton <jorton@redhat.com> 2.2.2-8
– fix segfault on dummy connection failure at graceful restart (#199429)

Script check

[root@localhost ~]# rpm -q –scripts httpd
preinstall scriptlet (using /bin/sh):
# Add the “apache” user
/usr/sbin/useradd -c “Apache” -u 48 \
        -s /sbin/nologin -r -d /var/www apache 2> /dev/null || :
postinstall scriptlet (using /bin/sh):
# Register the httpd service
/sbin/chkconfig –add httpd
preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
        /sbin/service httpd stop > /dev/null 2>&1
        /sbin/chkconfig –del httpd
fi

To find the package dependencies

[root@localhost ~]# rpm -q –requires httpd
/bin/bash
/bin/mktemp
/bin/mv
/bin/rm
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/etc/mime.types
/sbin/chkconfig
/usr/bin/find
/usr/sbin/useradd
/usr/share/magic.mime
config(httpd) = 2.2.3-6.el5.centos.1
gawk
initscripts >= 8.36
libapr-1.so.0
libaprutil-1.so.0
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.2)
libc.so.6(GLIBC_2.3)
libc.so.6(GLIBC_2.3.4)
libc.so.6(GLIBC_2.4)
libcrypt.so.1
libcrypt.so.1(GLIBC_2.0)
libcrypto.so.6
libdb-4.3.so
libdl.so.2
libexpat.so.0
liblber-2.3.so.0
libldap-2.3.so.0
libm.so.6
libm.so.6(GLIBC_2.0)
libpcre.so.0
libpthread.so.0
libpthread.so.0(GLIBC_2.0)
libselinux.so.1
libssl.so.6
libz.so.1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(VersionedDependencies) <= 3.0.3-1
rtld(GNU_HASH)
sh-utils
textutils

To find library or packages or filename

[root@localhost ~]# rpm -q –whatprovides libssl.so.6
openssl-0.9.8b-8.3.el5

[root@localhost ~]# rpm -q openssl
openssl-0.9.8b-8.3.el5

Opposite of Dependencies

[root@localhost ~]# rpm -q –whatrequires libssl.so.6
openssl-0.9.8b-8.3.el5
python-2.4.3-19.el5
openldap-2.3.27-5
curl-7.15.5-2.el5
postgresql-libs-8.1.4-1.1
php-cli-5.1.6-5.el5
python-ldap-2.2.0-2.1
m2crypto-0.16-6.el5.1
httpd-2.2.3-6.el5.centos.1
sendmail-8.13.8-2.el5
php-5.1.6-5.el5
stunnel-4.15-2
distcache-1.4.5-14.1
wpa_supplicant-0.4.8-10.1.fc6
neon-0.25.5-5.1
mysql-5.0.22-2.1
perl-Net-SSLeay-1.30-4.fc6
tog-pegasus-2.5.2-5.el5
spamassassin-3.1.7-4.el5
dovecot-1.0-1.2.rc15.el5
cadaver-0.22.3-4.el5
mod_ssl-2.2.3-6.el5.centos.1
fetchmail-6.3.6-1.el5
squid-2.6.STABLE6-3.el5
gnupg-1.4.5-12
openldap-clients-2.3.27-5
lftp-3.5.1-2.fc6
wget-1.10.2-7.el5
slrn-0.9.8.1pl1-1.2.2
elinks-0.11.1-5.1.el5
nmap-4.11-1.1
gnome-vfs2-2.16.2-4.el5
modcluster-0.8-27.el5.centos
mutt-1.4.2.2-3.el5
ricci-0.8-30.el5
cluster-snmp-0.8-27.el5.centos
cluster-cim-0.8-27.el5.centos

To find the location of installed packages

[root@localhost ~]# rpm -ql nmap
/usr/bin/nmap
/usr/share/doc/nmap-4.11
/usr/share/doc/nmap-4.11/COPYING
/usr/share/doc/nmap-4.11/COPYING.OpenSSL
/usr/share/doc/nmap-4.11/README
/usr/share/doc/nmap-4.11/nmap.usage.txt
/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
/usr/share/nmap/nmap.dtd
/usr/share/nmap/nmap.xsl

To remove package

[root@localhost ~]# rpm -e httpd
error: Failed dependencies:
        httpd-mmn = 20051115 is needed by (installed) php-5.1.6-5.el5.i386
        httpd-mmn = 20051115 is needed by (installed) mod_ssl-2.2.3-6.el5.centos.1.i386
        httpd-mmn = 20051115 is needed by (installed) mod_python-3.2.8-3.1.i386
        httpd-mmn = 20051115 is needed by (installed) mod_perl-2.0.2-6.1.i386
        webserver is needed by (installed) webalizer-2.01_10-30.1.i386
        httpd = 0:2.2.3-6.el5.centos.1 is needed by (installed) mod_ssl-2.2.3-6.el5.centos.1.i386
        httpd is needed by (installed) piranha-0.8.4-7.el5.i386
        httpd >= 2.2.0 is needed by (installed) gnome-user-share-0.10-6.el5.i386
        httpd >= 2.0.40 is needed by (installed) mod_python-3.2.8-3.1.i386
        httpd = 2.2.3-6.el5.centos.1 is needed by (installed) httpd-manual-2.2.3-6.el5.centos.1.i386
        httpd is needed by (installed) system-config-httpd-1.3.3.1-1.el5.noarch

use

# rpm -e –nodeps httpd

Package Verification

# rpm -V package name : Checks the integrity of the package against the installed database.

# rpm -Va : Checks the integrity of all installed packages against the installed database.

# rpm –import /mnt/cdrom/RPM-GPG-KEY (imports {installs} the public key for package verification)

# rpm –checksig package_file_name : Verifies the signature of the package.

Advertisements

Read Full Post »

Under Red Hat Enterprise Linux, it is possible to change the default runlevel at boot time.

To change the runlevel of a single boot session, use the following instructions:

  • When the GRUB menu bypass screen appears at boot time, press any key to enter the GRUB menu (within the first three seconds).

  • Press the [a] key to append to the kernel command.

  • Add <space><runlevel> at the end of the boot options line to boot to the desired runlevel. For example, the following entry would initiate a boot process into runlevel 3:

    grub append> ro root=/dev/VolGroup00/LogVol00 rhgb quiet 3

Read Full Post »

Introduction

This guide is intended to provide you with simple instructions on how to install Nagios from source (code) on Fedora and have it monitoring your local machine inside of 20 minutes. No advanced installation options are discussed here – just the basics that will work for 95% of users who want to get started.

These instructions were written based on a standard Fedora Core 6 Linux distribution.

What You’ll End Up With

If you follow these instructions, here’s what you’ll end up with:

* Nagios and the plugins will be installed underneath /usr/local/nagios
* Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)
* The Nagios web interface will be accessible at http://localhost/nagios/

Prerequisites

During portions of the installation you’ll need to have root access to your machine.

Make sure you’ve installed the following packages on your Fedora installation before continuing.

* Apache
* GCC compiler
* GD development libraries

You can use yum to install these packages by running the following commands (as root):

yum install httpd
yum install gcc
yum install glibc glibc-common
yum install gd gd-devel

1) Create Account Information

Become the root user.

su -l

Create a new nagios user account and give it a password.

/usr/sbin/useradd nagios
passwd nagios

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd apache

2) Download Nagios and the Plugins

Create a directory for storing the downloads.

mkdir ~/downloads
cd ~/downloads

Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions). At the time of writing, the latest versions of Nagios and the Nagios plugins were 3.0rc1 and 1.4.11, respectively.

wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0rc1.tar.gz
wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

3) Compile and Install Nagios

Extract the Nagios source code tarball.

cd ~/downloads
tar xzf nagios-3.0rc1.tar.gz
cd nagios-3.0rc1

Run the Nagios configure script, passing the name of the group you created earlier like so:

./configure –with-command-group=nagcmd

Compile the Nagios source code.

make all

Install binaries, init script, sample config files and set permissions on the external command directory.

make install
make install-init
make install-config
make install-commandmode

Don’t start Nagios yet – there’s still more that needs to be done…

4) Customize Configuration

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You’ll need to make just one change before you proceed…

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

vi /usr/local/nagios/etc/objects/contacts.cfg

5) Configure the Web Interface

Install the Nagios web config file in the Apache conf.d directory.

make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

service httpd restart

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

cd ~/downloads
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11

Compile and install the plugins.

./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install

7) Start Nagios

Add Nagios to the list of system services and have it automatically start when the system boots.

chkconfig –add nagios
chkconfig nagios on

Verify the sample Nagios configuration files.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.

service nagios start

8) Modify SELinux Settings

Fedora ships with SELinux (Security Enhanced Linux) installed and in Enforcing mode by default. This can result in “Internal Server Error” messages when you attempt to access the Nagios CGIs.

See if SELinux is in Enforcing mode.

getenforce

Put SELinux into Permissive mode.

setenforce 0

To make this change permanent, you’ll have to modify the settings in /etc/selinux/config and reboot.

Instead of disabling SELinux or setting it to permissive mode, you can use the following command to run the CGIs under SELinux enforcing/targeted mode:

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

For information on running the Nagios CGIs under Enforcing mode with a targeted policy, visit the NagiosCommunity.org wiki at http://www.nagioscommunity.org/wiki.

9) Login to the Web Interface

You should now be able to access the Nagios web interface at the URL below. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.

http://localhost/nagios/

Click on the “Service Detail” navbar link to see details of what’s being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.

10) Other Modifications

Make sure your machine’s firewall rules are configured to allow access to the web server if you want to access the Nagios interface remotely.
Configuring email notifications is out of the scope of this documentation. While Nagios is currently configured to send you email notifications, your system may not yet have a mail program properly installed or configured. Refer to your system documentation, search the web, or look to the NagiosCommunity.org wiki for specific instructions on configuring your system to send email messages to external addresses. More information on notifications can be found here.

Read Full Post »