UPWORK/ODESK guru: Tips and Tricks for clients

skype: odesk.by / upwork.link , email: [email protected]/upwork.link

Archive for June, 2012

Extra Packages for Enterprise Linux (EPEL)

without comments

Home page: http://fedoraproject.org/wiki/EPEL

RHEL 6
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
RHEL 5
# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
RHEL 4
# rpm -Uvh http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm

 

Written by spectre

June 27th, 2012 at 10:19 am

Posted in Tips and Tricks

Creating a new rootfs.cgz for RIP Linux. Short tips.

without comments

# mkdir /tmp/rip1 /tmp/rip2
# mount -o loop RIPLinuX-13.7.iso /tmp/rip1
# cp -a /tmp/rip1/* /tmp/rip2
# umount /tmp/rip1 ; rmdir /tmp/rip1
# mkdir /tmp/rip2/boot/1
# cd /tmp/rip2/boot/1
/tmp/rip2/boot/1# gzip -dc ../rootfs.cgz | cpio -iumdv

Make the changes and remove the old system.

/tmp/rip2/boot/1# rm ../rootfs.cgz

Then cpio/gzip the new system.

/tmp/rip2/boot/1# find . | bin/cpio -v -o -H newc | gzip -9 >../rootfs.cgz
                             ^^^
                     "Use 'bin/cpio' from rootfs, because the version
                      on your system may cause a problem!"

Written by spectre

June 21st, 2012 at 8:39 am

Posted in Tips and Tricks

The bluetooth agent for pairing device on Linux with Perl.

without comments

in process …

Written by spectre

June 9th, 2012 at 12:47 pm

Posted in Perl

Testing of the mail function of PHP from shell on the server.

without comments

1. Download little script – http://it.sysnet.by/scripts/mail-test.script
 

<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
printf("Mail Sent.\n");
?>

 
2. Open file and change variables $to and/or $from
3. Execute in shell:
 

[email protected] [~/]# php mail-test.php
Mail Sent.
[email protected] [~/]#

 
4. If you have correctly installed mail daemon, then you should get message.
If the mail message,that was sent from the form of site (PHP) still don’t accepted, then problem only in logic of the site.

 

Written by spectre

June 7th, 2012 at 4:49 pm

Posted in Tips and Tricks

How To Install Perl Modules Manually and Using CPAN command

without comments

Installing Perl modules required by various open source software is a routine tasks for sysadmins. Installing Perl modules manually by resolving all the dependencies is tedious and annoying process.

Installing Perl modules using CPAN is a better solution, as it resolves all the dependencies automatically. In this article, let us review how to install Perl modules on Linux using both manual and CPAN method.

When a Perl module is not installed, application will display the following error message. In this example, XML::Parser Perl module is missing.

 

Install Perl Modules Manually


Download Perl module

 

Go to CPAN Search website and search for the module that you wish to download. In this example, let us search, download and install XML::Parser Perl module. I have downloaded the XML-Parser-2.36.tar.gz to /home/download.

 

# cd /home/download
# gzip -d XML-Parser-2.36.tar.gz
# tar xvf XML-Parser-2.36.tar
# cd XML-Parser-2.36

 

Build the perl module and install the perl module

# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
# make
# make test
# make install

 

This is very simple for one module with no dependencies. Typically, Perl modules will be dependent on several other modules. Chasing all these dependencies one-by-one can be very painful and annoying task. I recommend the CPAN method of installation as shown below. Use the manual method only if the server is not connected to the Internet.

 

Install Perl Modules using CPAN automatically

 

Verify whether CPAN is already installed

 

To install Perl modules using CPAN, make sure the cpan command is working. You should have the CPAN perl module installed before you can install any other Perl modules using CPAN. In this example, CPAN module is not installed.

# cpan
-bash: cpan: command not found

# perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (@INC contains:
/usr/lib/perl5/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0
/usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.10.0 .).
BEGIN failed--compilation aborted.

 

Install the CPAN module using yum

# yum install perl-CPAN

 

Configure cpan the first time

 

The first time when you execute cpan, you should set some configuration parameters as shown below. I have shown only the important configuration parameters below. Accept all the default values by pressing enter.

Note: Make sure to execute “o conf commit” in the cpan prompt after the configuration to save the settings.

# cpan

Sorry, we have to rerun the configuration dialog for CPAN.pm due
to some missing parameters...

CPAN build and cache directory? [/root/.cpan]
Download target directory? [/root/.cpan/sources]
Directory where the build process takes place? [/root/.cpan/build]

Always commit changes to config variables to disk? [no]
Cache size for build directory (in MB)? [100]
Let the index expire after how many days? [1]

Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Policy on building prerequisites (follow, ask or ignore)? [ask]

Parameters for the 'perl Makefile.PL' command? []
Parameters for the 'perl Build.PL' command? []

Your ftp_proxy? []
Your http_proxy? []
Your no_proxy? []
Is it OK to try to connect to the Internet? [yes]

First, pick a nearby continent and country by typing in the number(s)
(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 5

(1) Bahamas
(2) Canada
(3) Mexico
(4) United States
Select your country (or several nearby countries) [] 4

(2) ftp://carroll.cac.psu.edu/pub/CPAN/
(3) ftp://cpan-du.viaverio.com/pub/CPAN/
(4) ftp://cpan-sj.viaverio.com/pub/CPAN/
(5) ftp://cpan.calvin.edu/pub/CPAN
(6) ftp://cpan.cs.utah.edu/pub/CPAN/
e.g. '1 4 5' or '7 1-4 8' [] 2-16

cpan[1]> o conf commit
commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'

cpan[2]> quit
No history written (no histfile specified).
Lockfile removed.

 

Install Perl Modules using CPAN

 

You can use one of the following method to install a Perl module using cpan.

# /usr/bin/perl -MCPAN -e 'install Email::Reply'

(or)

# cpan
cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> install "Email::Reply";

In the example above, Email::Reply is dependent on the several other modules. CPAN automatically resolves the dependencies and installs Email::Reply and all the dependent Perl modules.

Written by spectre

June 3rd, 2012 at 3:41 pm

Posted in Tips and Tricks