Sunday, September 30, 2012

Prevent an upstart / lightdm / gdm service from running at boot on Ubuntu


You can use an override:

    sudo echo "manual" >> /etc/init/lightdm.override  

To start lightdm on command:

    sudo start lightdm  

To restore your system so that lightdm is always started on boot:

    sudo rm /etc/init/lightdm.override  

For more information, the upstart cookbook is your friend:

Overview of RPM commands

Source: http://www.idevelopment.info/data/Unix/Linux/LINUX_RPMCommands.shtml

Purpose
Description / Example
Install an RPM Package
RPM packages have file naming conventions like foo-2.0-4.i386.rpm, which include the package name (foo), version (2.0), release (4), and architecture (i386). Also notice that RPM understands FTP and HTTP protocols for installing and querying remote RPM files.
rpm -ivh foo-2.0-4.i386.rpm  rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm  rpm -i http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
Un-install an RPM Package
To un-install an RPM package, we use the package name foo, not the name of the original package file foo-2.0-4.i386.rpm above.
rpm -e foo
Upgrade an RPM Package
To upgrade an RPM package, RPM automatically un-installs the old version of the foo package and installs the new package. It is safe to always use rpm -Uvhto install and upgrade packages, since it works fine even when there are no previous versions of the package installed! Also notice that RPM understands FTP and HTTP protocols for upgrading from remote RPM files.
rpm -Uvh foo-1.0-2.i386.rpm  rpm -Uvh ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm  rpm -Uvh http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
Query all Installed Packages
Use RPM to print the names of all installed packages installed on your Linux system.
rpm -qa
Query an RPM Package
Querying an RPM package will print the package name, version, and release number of the package foo only if it is installed. Use this command to verify that a package is or is not installed on your Linux system.
rpm -q foo
Display Package Information
RPM can display package information including the package name, version, and description of the installed program. Use this command to get detailed information about the installed package.
rpm -qi foo
List Files in Installed Package
The following command will list all of files in an installed RPM package. It works only when the package is already installed on your Linux system.
rpm -ql foo
Which package owns a file?
Use the following command to determine which installed package a particular file belongs to.
rpm -qf /usr/bin/mysql
For example:
    # rpm -qf /usr/bin/mysql  mysql-3.23.52-3
List Files in RPM File
Use RPM to query a (possibly) un-installed RPM file with the use of the the "-p" option. You can use the "-p" option to operate on an RPM file without actually installing anything. This command lists all files in an RPM file you have in the current directory. Also note that RPM can query remote files through the FTP and HTTP protocols.
rpm -qpl kernel-2.4.20-18.10.1.i686.rpm  rpm -qpl ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm  rpm -qpl http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
Verify an Installed Package
Use RPM to list all files that do NOT pass the verify tests (done on size, MD5 signature, etc).
rpm --verify mysql
Where a file does NOT pass, the output is listed using the following codes that signify what failed:
S File size  M Mode (includes permissions and file type)  5 MD5 sum  L Symlink   D Device   U User   G Group   T Mtime
Take for example the following:
# rpm --verify mysql  S.5....T c /etc/my.cnf
This example indicates that file /etc/my.cnf failed on:
File size  MD5 Sum  Modified Time
However, the "c" tells us this is a configuration file so that explains the changes. It should still be looked at to determine what the changes were.
Check an RPM Signature Package
RPM can be used to check the PGP signature of specified packages to ensure its integrity and origin. Always use this command first before installing a new RPM package on your system. Also, GnuPG or Pgp software must be already installed on your system before you can use this command.
rpm --checksig foo

How do you uninstall programs installed using make?



In case if you were wondering how one would go about uninstalling something that was installed with ./configure -> make -> make install. Makefiles don't seems to have a 'remove' section, and make does not seem to have a built in 'sudo make remove <program>' feature.

Your options are
  1. To search the application install folder for a file that may have a comprehensive list of binaries and its locations
  2. Run following command inside the installer directory
    • Su to root and then type #make uninstall
    • $sudo make uninstall

Saturday, September 29, 2012

wireshark change menu fonts xquartz osx

  1. Edit the pre-gtkrc and gtkrc files included in the Wireshark installation. 
    • Open up these files in your favorite text editor, which are located inside/Applications/Wireshark.app/Contents/Resources/themes/Clearlooks-Quicksilver-OSX/gtk-2.0
    • Search for the entry in each configuration file named "gtk-font-name"  
    • Set it to whatever font you want.  NOTE: OpenType fonts don't seem to display as well as TrueType fonts do, 
    • For this example, I've changed this value to "Verdana 10" from the theme default
  2. Enable Font Smoothing
      • Go to /Applications/Wireshark.app/Contents/Resources/etc/fonts 
      • Adding the following text:
          <match target="font">
              <edit mode="assign" name="autohint">
              <bool>true</bool>
              </edit>
          </match>

  3. Restart / Start the wireshark

Friday, September 28, 2012

Installing PUPPET on Red Hat, CentOS and Fedora

To get the latest releses of Puppet, you will need to add the EPEL repository.
 
 
(EPEL is a volunteer-based community from the Fedora project to create a repo of high-quality add-on packages for RHEL and clones)
Further details can be found at http://fedoraproject.org/wiki/EPEL/FAQ#hotouse
 
 
To Install the PUPPET MASTER on Redhat based system
 
1. Install pre-requisit library
 
      root@host# yum install ruby ruby-libs ruby-shadow
 
2a. Install Puppet Master (Server)
 
      root@host# yum install puppet puppet-server facter
 
 
2.b. Install Puppet Agent(Client)
       root@host# yum install puppet facter
 
 

Wednesday, September 26, 2012

Bash Script Template for writing bash utilities

The following code can serve as a template for creating a bash utility.  The purpose of this wrapper utility is to checkout a file, edit in an editor and check the file back in. 


The following is the command usage

root@host# ./rcwrapper [-c "comment goes here"] filename1 [filename2 filename3 ...]

 


#!/bin/bash

#########################

## Author: Nirav Doshi ##

## Date: Sept 25, 2012 ##

## Purpose:

##      Facilitate checkout, edit 

## and checkin process for code viewing, 

##      and editing.

#############################


export EDITOR=vim


while [ $# -gt 0 ]; do  #until run out of parameters

case "$1" in


   -c)

# Move the cursor to next argument which has comment information

shift


# set the comment value

if [ -n "$1"#compare if -c is passed with an argument

then

COMMENT=$1

echo "comment is \"$COMMENT\""

else

COMMENT="no comment supplied"

echo $COMMENT

fi

;;


*)

# Check out the file from repository

echo "CO -c \"$COMMENT\" $1"

# Calls the Editor program varriable along with filename

$EDITOR $1


# Checking file into the repository

echo "CI -c \"$COMMENT\" $1"

;;


esac

 shift

done




Monday, September 24, 2012

How can I install the packages from the EPEL software repository?


There are repository rpm packages for RHEL5 and RHEL6. The repository package installs the repo details on your local system for yum or up2date to use. Then you can install packages with your usual method, and the EPEL repository is included.
For EL5:
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm'  ...  su -c 'yum install foo'  
For EL6:
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm'  ...  su -c 'yum install foo'  


http://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

Thursday, September 13, 2012

Adding new Initscripts with Red Hat's chkconfig (init scripts) At Boot - autostart

Place the script in /etc/rc.d/init.d and run (as root)

chmod +x /etc/rc.d/init.d/oracle  

to make the script executable. If you are concerned about normal users seeing the script, you could try more restrictive file permissions, as long as the script is executable by root as a standalone script.

Notice the two comments lines in the script:

#chkconfig: 2345 80 05  #description: Oracle 8 Server  

These lines are needed by chkconfig to determine how to establish the initial runlevels to add the service as well as set the priority for the start-and-stop script execution order. These lines denote the script will start Oracle 8 server for the runlevels 2, 3, 4 and 5. In addition, the start priority will be set to 80 while the stop priority will be 05.

Now that the script is in place with the appropriate execute permissions and the required chkconfig comments are in place, we can add the initscript to the chkconfig configuration by typing, as root, chkconfig --add oracle.

Using chkconfig's query feature, we can verify our addition:

[root]# chkconfig --list | grep oracle