June 27, 2012

Yum update from specific repository

To run your yum packages updates from a specific yum repo you need to list your installed repo IDs by issuing this command:

# yum repolist
Which generates the example output below (obviously depends on what repos you have installed):

repo id                        repo name  
base                           CentOS-5 - Base
epel                           Extra Packages for Enterprise Linux 5 - x86_64  
extras                         CentOS-5 - Extras  
ius                            IUS Community Packages for Enterprise Linux 5 - x86_64  
rpmforge                       RHEL 5 - RPMforge.net - dag  
updates                        CentOS-5 - Updates      

Then you can force yum to ignore all repos except the one you need (the IUS repo in this example) to list its available packages by issuing the following:

yum --disablerepo="*" --enablerepo="ius" list available


Which returns available packages that are only in that particular repo



 Loaded plugins: fastestmirror, replace, security  
 Loading mirror speeds from cached hostfile  
  * ius: archive.linux.duke.edu  
 Excluding Packages in global exclude list  
 Finished  
 Available Packages  
 autoconf26x.noarch                                      2.63-4.ius.el5                               ius  
 mysql50.x86_64                                        5.0.96-2.ius.el5                              ius  
 mysql50-bench.x86_64                                     5.0.96-2.ius.el5                              ius  
 mysql50-debuginfo.x86_64                                   5.0.96-2.ius.el5                              ius  
 mysql50-devel.x86_64                                     5.0.96-2.ius.el5                              ius  
 mysql50-server.x86_64                                     5.0.96-2.ius.el5                              ius  
 mysql51.x86_64                                        5.1.63-1.ius.el5                              ius  
 mysql51-bench.x86_64                                     5.1.63-1.ius.el5                              ius  
 mysql51-debuginfo.x86_64                                   5.1.63-1.ius.el5                              ius  
 mysql51-devel.x86_64                                     5.1.63-1.ius.el5                              ius  
 mysql51-embedded.x86_64                                    5.1.63-1.ius.el5                              ius  

You can replace the yum option "list available" used above by any of yum's command options like  update, install etc..

For example, installing the rsyslog package from the IUS repo:


 yum --disablerepo="*" --enablerepo="ius" install rsyslog4  
 Loaded plugins: fastestmirror, replace, security  
 Loading mirror speeds from cached hostfile  
  * ius: archive.linux.duke.edu  
 Excluding Packages in global exclude list  
 Finished  
 Setting up Install Process  
 Resolving Dependencies  
 --> Running transaction check  
 ---> Package rsyslog4.x86_64 0:4.8.0-1.ius.el5 set to be updated  
 --> Finished Dependency Resolution  
 Dependencies Resolved  
 ============================================================================================================================================================================  
  Package                 Arch                  Version                     Repository              Size  
 ============================================================================================================================================================================  
 Installing:  
  rsyslog4                 x86_64                 4.8.0-1.ius.el5                 ius                 446 k  
 Transaction Summary  
 ============================================================================================================================================================================  
 Install    1 Package(s)  
 Upgrade    0 Package(s)  
 Total download size: 446 k  


Share:

June 25, 2012

Standard I/O redirection

The shell and many UNIX commands take their input from standard input (stdin), write output to standard output (stdout), and write error output to standard error (stderr). By default, standard input is connected to the terminal keyboard and standard output and error to the terminal screen.

The way of indicating an end-of-file on the default standard input, a terminal, is usually <Ctrl-d>.
Redirection of I/O, for example to a file, is accomplished by specifying the destination on the command line using a redirection metacharacter followed by the desired destination.

C Shell Family

Some of the forms of redirection for the C shell family are:
Character
Action
>
Redirect standard output
>&
Redirect standard output and standard error
<
Redirect standard input
>!
Redirect standard output; overwrite file if it exists
>&!
Redirect standard output and standard error; overwrite file if it exists
|
Redirect standard output to another command (pipe)
>>
Append standard output
>>&
Append standard output and standard error


The form of a command with standard input and output redirection is:
% command -[options] [arguments] < input file  > output file
If you are using csh and do not have the noclobber variable set, using > and >& to redirect output will overwrite any existing file of that name. Setting noclobber prevents this. Using >! and >&! always forces the file to be overwritten. Use >> and >>& to append output to existing files.
Redirection may fail under some circumstances: 1) if you have the variable noclobber set and you attempt to redirect output to an existing file without forcing an overwrite, 2) if you redirect output to a file you don't have write access to, and 3) if you redirect output to a directory.

Examples:

% who > names
Redirect standard output to a file named names

% (pwd; ls -l) > out

Redirect output of both commands to a file named out

% pwd; ls -l > out
Redirect output of ls command only to a file named out

Input redirection can be useful, for example, if you have written a FORTRAN program which expects input from the terminal but you want it to read from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout:

% myprog < myin > myout

You can suppress redirected output and/or errors by sending it to the null device, /dev/null. The example shows redirection of both output and errors:
% who >& /dev/null

To redirect standard error and output to different files, you can use grouping:
% (cat myfile > myout) >& myerror


Bourne Shell Family

The Bourne shell uses a different format for redirection which includes numbers. The numbers refer to the file descriptor numbers (0 standard input, 1 standard output, 2 standard error). For example, 2> redirects file descriptor 2, or standard error. &n is the syntax for redirecting to a specific open file. For example 2>&1 redirects 2 (standard error) to 1 (standard output); if 1 has been redirected to a file, 2 goes there too. Other file descriptor numbers are assigned sequentially to other open files, or can be explicitly referenced in the shell scripts. Some of the forms of redirection for the Bourne shell family are:


Character
Action
>
Redirect standard output
2>
Redirect standard error
2>&1
Redirect standard error to standard output
<
Redirect standard input
|
Pipe standard output to another command
>>
Append to standard output
2>&1|
Pipe standard output and standard error to another command


Note that < and > assume standard input and output, respectively, as the default, so the numbers 0 and 1 can be left off.
The form of a command with standard input and output redirection is:
$ command -[options] [arguments] < input file > output file

Redirection may fail under some circumstances:
1) if you have the variable noclobber set and you attempt to redirect output to an existing file without forcing an overwrite
2) if you redirect output to a file you don't have write access to, and 3) if you redirect output to a directory.

Examples:

$ who > names
Direct standard output to a file named names
$ (pwd; ls -l) > out

Direct output of both commands to a file named out
$ pwd; ls -l > out

Direct output of ls command only to a file named out
Input redirection can be useful if you have written a program which expects input from the terminal and you want to provide it from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout.
$ myprog < myin > myout

You can suppress redirected output and/or error by sending it to the null device, /dev/null. The example shows redirection of standard error only:
$ who 2> /dev/null

To redirect standard error and output to different files (note that grouping is not necessary in Bourne shell):
$ cat myfile > myout 2> myerror


A. Bash and other modern shell provides I/O redirection facility. There are 3 default standard files (standard streams) open:
[a] stdin - Use to get input (keyboard) i.e. data going into a program.
[b] stdout - Use to write information (screen)
[c] stderr - Use to write error message (screen)
Understanding I/O streams numbers



The Unix / Linux standard I/O streams with numbers:
Handle
Name
Description
0
stdin
Standard input
1
stdout
Standard output
2
stderr
Standard error

Redirecting the standard error stream to a file

The following will redirect program error message to a file called error.log:
$ program-name 2> error.log
$ command1 2> error.log

Redirecting the standard error (stderr) and stdout to file

Use the following syntax:
$ command-name &>file
OR
$ command > file-name 2>&1
Another useful example:
# find /usr/home -name .profile 2>&1 | more

Redirect stderr to stdout

Use the command as follows:
$ command-name 2>&1
Share:

June 13, 2012

32Bit ODBC driver on Windows 2008 R2 64Bit OS Error

Problem: I received the following error message upon trying to create a system DSN using a 32Bit ODBC driver I had just installed on a Win2088 R2 64Bit Server (with SP1):

"You are logged on with non-Administrative privileges. System DSNs could not be created or modified"

Solution: Make sure to use the 32Bit ODBC console instead of the standard ODBC console located under Control Panel/Administrative Tools:

"C:\windows\sysWOW64\odbcad32.exe"
Share:

June 07, 2012

DNSChanger Check

Check to see if your computer is a victim of "DNS Changer" by visiting one of the following sites:



URL Language
http://www.dns-ok.us/ English
http://www.dns-ok.de/ German
http://www.dns-ok.fi/ Finish
http://www.dns-ok.ax/ Swedish
http://www.dns-ok.fr/ French
http://www.dns-ok.ca/ English/French
http://www.dns-ok.lu/ English
http://dns-ok.nl/ Dutch/English


Source: https://forms.fbi.gov/check-to-see-if-your-computer-is-using-rogue-DNS

More about DNSChanger on the FBI site:
http://www.fbi.gov/news/stories/2011/november/malware_110911

http://www.fbi.gov/news/stories/2011/november/malware_110911/DNS-changer-malware.pdf
Share:

Yum Error: Unable to read consumer identity

Problem:

Yum update throws the error: "Unable to read consumer identity"


Resolution:

Please note: This solution was applied to fix the above yum update error on a machine running RedHat Enterprise release 5.8 Tikanga.

The solution is to use RHN Classic and to disable subscription-manager by editing the katello plugin configuration file and set "enabled" value to '0'

Disable the plugin by editing the file /etc/yum/pluginconf.d/katello.conf  then change the value "enabled=1" to "enabled=0" and save file.

Once the change is performed and saved, execute following commands:

rm -rf /var/cache/yum/*
yum clean all
Share: