RSS2.0

Monday, March 16, 2009

rpm command cheat sheet for Linux

rpm command cheat sheet for Linux

rpm is a powerful Package Manager for Red Hat, Suse and Fedora Linux. It can be used to build, install, query, verify, update, and remove/erase individual software packages. A Package consists of an archive of files, and package information, including name, version, and description:

Syntax Description Example(s)
rpm -ivh {rpm-file} Install the package rpm -ivh mozilla-mail-1.7.5-17.i586.rpm
rpm -ivh --test mozilla-mail-1.7.5-17.i586.rpm
rpm -Uvh {rpm-file} Upgrade package rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm
rpm -Uvh --test mozilla-mail-1.7.6-12.i586.rpm
rpm -ev {package} Erase/remove/ an installed package rpm -ev mozilla-mail
rpm -ev --nodeps {package} Erase/remove/ an installed package without checking for dependencies rpm -ev --nodeps mozilla-mail
rpm -qa Display list all installed packages rpm -qa
rpm -qa | less
rpm -qi {package} Display installed information along with package version and short description rpm -qi mozilla-mail
rpm -qf {/path/to/file} Find out what package a file belongs to i.e. find what package owns the file rpm -qf /etc/passwd
rpm -qf /bin/bash
rpm -qc {pacakge-name} Display list of configuration file(s) for a package rpm -qc httpd
rpm -qcf {/path/to/file} Display list of configuration files for a command rpm -qcf /usr/X11R6/bin/xeyes
rpm -qa --last Display list of all recently installed RPMs rpm -qa --last
rpm -qa --last | less
rpm -qpR {.rpm-file}
rpm -qR {package}
Find out what dependencies a rpm file has rpm -qpR mediawiki-1.4rc1-4.i586.rpm
rpm -qR bash

{package} - Replace with actual package name

Linux Kernel Magic SysRq keys in openSUSE for crash recovery




The
Linux Kernel offers you something that allows you to recover your
system from a crash or at the least lets you to perform a proper
shutdown using the Magic SysRq Keys. The magic SysRq key is a select
key combination in the Linux kernel which allows the user to perform
various low level commands regardless of the system’s state using the
SysRq key. It is often used to recover from freezes, or to reboot a
computer without corrupting the filesystem.



The magic Sysrq key basically has a key combination of <ALT>
+ <SysRq or Prnt Scrn> + <Command key>
.


The command key can be one
of the following providing a specific functionality:




  • ‘b’ - Will
    immediately reboot the system without syncing or unmounting your disks.



  • ‘c’ - Will perform
    a kexec reboot in order to take a crashdump.



  • ‘d’ - Shows all
    locks that are held.



  • ‘e’ - Send a
    SIGTERM to all processes, except for init.



  • ‘f’ - Will call
    oom_kill to kill a memory hog process.



  • ‘g’ - Used by kgdb
    on ppc and sh platforms.



  • ‘h’ - Will display
    help (actually any other key than those listed here will display help.
    but ‘h’ is easy to remember :-)



  • ‘i’ - Send a
    SIGKILL to all processes, except for init.



  • ‘k’ - Secure
    Access Key (SAK) Kills all programs on the current virtual console.
    NOTE: See important comments below in SAK section.



  • ‘m’ - Will dump
    current memory info to your console.



  • ‘n’ - Used to make
    RT tasks nice-able



  • ‘o’ - Will shut
    your system off (if configured and supported).



  • ‘p’ - Will dump
    the current registers and flags to your console.



  • ‘q’ - Will dump a
    list of all running timers.



  • ‘r’ - Turns off
    keyboard raw mode and sets it to XLATE.



  • ’s’ - Will attempt
    to sync all mounted filesystems.



  • ‘t’ - Will dump a
    list of current tasks and their information to your console.



  • ‘u’ - Will attempt
    to remount all mounted filesystems read-only.



  • ‘v’ - Dumps
    Voyager SMP processor info to your console.



  • ‘w’ - Dumps tasks
    that are in uninterruptable (blocked) state.



  • ‘x’ - Used by xmon
    interface on ppc/powerpc platforms.



  • ‘0′-’9′ - Sets the
    console log level, controlling which kernel messages will be printed to
    your console. (’0′, for example would make it so that only emergency
    messages like PANICs or OOPSes would make it to your console.)



The most useful combination is the <ALT>+<SysRq
or Prnt Scrn> + R-E-I-S-U-B


The above basically means while you Press and Hold
<ALT>+<SysRq or Prnt Scrn> Press R, E, I,
S, U, B giving sufficient time between each of these key to ensure they
perform the required job.


REISUB will:




  • Release the Keyboard of the XServer control (in
    the event your XServer crashes)



  • Try to gratiously shutdown processes (SIGTERM)



  • Forcibly shutsdown the processes (SIGKILL)



  • Sync the mounted File Systems immediatly



  • Umount the mounted File Systems



  • Reboot the system



This could avert or atleast reduce the impact of system
crashes.


Magic SysRq key
is not enabled by default in openSUSE
.


To enable SysRq in openSUSE, click Computer and
YaST
.



Click System and Kernel Settings.



Click the Kernel Settings tab and place a
tick in “Enable SysRq Keys” and click Finish.


Alterntaively, click System - “/etc/sysconfig
editor
“. Navigate down to “System - Kernel
- ENABLE_SYSRQ
” and set it to “Yes” and click Finish.



Another option would be to edit the



/etc/sysctl.conf file and add “kernel.sysrq =
1″



or edit



/etc/sysconfig/sysctl and set
ENABLE_SYSRQ=”yes”



To temporarily enable SysRq at runtime,



opensuse11:~ # echo “1″ >
/proc/sys/kernel/sysrq



To disable



opensuse11:~ # echo “0″ >
/proc/sys/kernel/sysrq



The possible values you can
pass are:




  • 0: disable sysrq completely

  • 1: enable all functions of sysrq

  • >1 bitmask of allowed sysrq functions:

  • 2 - enable control of console logging level

  • 4 - enable control of keyboard (SAK, unraw)

  • 8 - enable debugging dumps of processes etc.

  • 16 - enable sync command

  • 32 - enable remount read-only

  • 64 - enable signalling of processes (term, kill, oom-kill)

  • 128 - allow reboot/poweroff

  • 256 - allow nicing of all RT tasks






Tuesday, March 3, 2009

Linux Foundation Launches Linux Training Program

Here's some news I though was interesting and wanted to share with all of my faithful blog followers/subscribers out there :

The Linux Foundation, the nonprofit organization dedicated to accelerating the growth of Linux, has announced the Linux Foundation Training Program. The Linux server market is predicted to reach $50 billion in three years, and the embedded and mobile Linux markets continue to explode, which increases the demand for developers and users with Linux expertise.

The Linux Foundation, the nonprofit organization dedicated to accelerating the growth of Linux, has announced the Linux Foundation Training Program, which will kick off with courses taught at the Linux Foundation’s Annual Collaboration Summit April 8-10 in San Francisco.
The effort comes at a time when developers in other sectors are being cut from work rosters and laid off due to the recession. Yet the Linux server market is predicted to reach $50 billion in three years, and the embedded and mobile Linux markets continue to explode, Linux Foundation officials said.

In fact, the freelance marketplace Odesk recently reported that the number of Linux-related jobs posted on its boards has increased more than 1,400 percent since 2006. The Linux Foundation’s Training Program will help meet this demand for industry and provide the tools for a new generation of programmers.

Resource Library:
Microsoft and Novell: Customer Success through a Ground-breaking Partnership
Heterogeneous Virtualization: Optimization for Effective Cost Reduction
Reduce Cost and Complexity in your IT Environment with Microsoft System Center C
Drive down IP storage costs: Effortlessly Secure, Monitor AND Control file share
“We’ve received consistent feedback from companies worldwide that the rising number of Linux deployments is putting new demands on a talent pool that needs more Linux-related developers,” said Jim Zemlin, executive director at the Linux Foundation. “We believe the Linux Foundation can provide a vendor-neutral forum in which students can learn from the community’s most influential contributors in order to drive their careers in more lucrative directions.”

Built in concert with its Technical Advisory Board -- which comprises leading maintainers from the Linux community -- the Linux Foundation's Training Program will feature courses taught by some of the community developers. The Linux Foundation's Training program will be vendor-neutral. The Training Program will debut with the following classes: Essential Linux Device Driver Development Skills, Creating Applications for Linux and Kernel Debugging and Performance.

The Training Program will consist of in-person courses at the Linux Foundation’s events, including its Collaboration Summit, End User Summit and LinuxCon, in-person classes in cities around the United States and onsite, custom courses for companies that want to ensure their developer core remains current.

Students who register for these first program offerings will get an automatic attendee pass for the Collaboration Summit. For more details, please visit: http://events.linuxfoundation.org/training

Saturday, February 28, 2009

Rpm Program Installation - Tips

Please Note: This is mostly for openSUSE Linux but can be applied to other Linux Distributions as well.

To install RPM files with Yast, simply type the following at the command line : yast -i blabla.rpm

Afterwards you can easily remove these packages from within Yast.

If you downloaded source code from a program (tar.gz files) you can quickly make an RPM file from it to install it later on your or another pc (if dependencies are OK).
To do this, first of all install the package checkinstall from the SuSE 9.x dvd (I don't know if it exists on other suse versions)..
Then unpack you source package and cd to the directory where you unpacked the tar.gz file.
Run the following two commands:

./configure
make

But now instead of running make install you run checkinstall.
Answer the questions, edit some values if they are not appropriate and let the program run.
When finished, you'll find your uninstalled RPM in /usr/src/packages/RPMS/i686

Now you can install it where you want with yast - i your_package.rpm or with rpm -i your_package.rpm. This allows you to easily uninstall it afterwards because it's impossible or almost impossible to completely uninstall packages installed from source.

Saturday, December 13, 2008

Linux RPM Commands Quick Reference



































































Syntax Description Example(s)
rpm -ivh {rpm-file} Install the package rpm -ivh
mozilla-mail-1.7.5-17.i586.rpm

rpm -ivh --test mozilla-mail-1.7.5-17.i586.rpm
rpm -Uvh {rpm-file} Upgrade package rpm -Uvh
mozilla-mail-1.7.6-12.i586.rpm

rpm -Uvh --test mozilla-mail-1.7.6-12.i586.rpm
rpm -ev {package} Erase/remove/ an installed package rpm -ev mozilla-mail
rpm -ev --nodeps {package} Erase/remove/ an installed package
without checking for dependencies
rpm -ev --nodeps mozilla-mail
rpm -qa Display list all installed packages rpm -qa

rpm -qa | less
rpm -qi {package} Display installed information along
with package version and short description
rpm -qi mozilla-mail
rpm -qf {/path/to/file} Find out what package a file belongs
to i.e. find what package owns the file
rpm -qf /etc/passwd

rpm -qf /bin/bash
rpm -qc {pacakge-name} Display list of configuration
file(s) for a package
rpm -qc httpd
rpm -qcf {/path/to/file} Display list of configuration files
for a command
rpm -qcf /usr/X11R6/bin/xeyes
rpm -qa --last Display list of all recently
installed RPMs
rpm -qa --last

rpm -qa --last | less
rpm -qpR {.rpm-file}

rpm -qR {package}
Find out what dependencies a rpm
file has
rpm -qpR mediawiki-1.4rc1-4.i586.rpm

rpm -qR bash

{package} - Replace with actual
package name