<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-23490212</atom:id><lastBuildDate>Wed, 28 Oct 2009 22:58:01 +0000</lastBuildDate><title>Linux Tips and Stuff</title><description></description><link>http://derrick-caluag.blogspot.com/</link><managingEditor>noreply@blogger.com (derrick caluag)</managingEditor><generator>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-923240697852891243</guid><pubDate>Wed, 10 Sep 2008 09:17:00 +0000</pubDate><atom:updated>2008-09-10T17:26:36.362+08:00</atom:updated><title>Application failed to initialize 0xc0000135 Google Chrome known issue</title><description>&lt;div&gt;If you happened to encounter this error after installing Google Chrome on Windows XP / Vista "Application failed to initialize 0xc0000135". I have the solution.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Check if your PC have Microsoft .NET framework installed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Disable any antivirus program especially Symantec before running the application then enable it again while chrome is running.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If this doesn't do the trick.. put a comment on this blog.. thanks..&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-923240697852891243?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2008/09/application-failed-to-initialize.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-7297655455478069801</guid><pubDate>Thu, 31 Jan 2008 03:15:00 +0000</pubDate><atom:updated>2008-01-31T11:19:21.970+08:00</atom:updated><title>AIX commands you should not leave home without</title><description>&lt;p&gt;&lt;a name="h1"&gt;&lt;span class="atitle"&gt;Introduction&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;As you know, AIX® has a vast array of commands that enable you to do a multitude of tasks. Depending on what you need to accomplish, you use only a certain subset of these commands. These subsets differ from user to user and from need to need. However, there are a few core commands that you commonly use. You need these commands either to answer your own questions or to provide answers to the queries of the support professionals.&lt;/p&gt;    &lt;p&gt;In this article, I'll discuss some of these core commands. The intent is to provide a list that you can use as a ready reference. While the behavior of these commands should be identical in all releases of AIX, they have been only tested under AIX 5.3.&lt;/p&gt;    &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt; The &lt;code&gt;bootinfo&lt;/code&gt; command discussed in the following paragraphs is NOT a user-level command and is NOT supported in AIX 4.2 or later.&lt;/p&gt;    &lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table style="width: 100px; height: 18px;" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="h2"&gt;&lt;span class="atitle"&gt;Commands&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&lt;a name="N10069"&gt;&lt;span class="smalltitle"&gt;Kernel&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How would I know if I am running a 32-bit kernel or 64-bit kernel?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To display if the kernel is 32-bit enabled or 64-bit enabled, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;bootinfo -K&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How do I know if I am running a uniprocessor kernel or a multiprocessor kernel?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;&lt;code&gt;/unix&lt;/code&gt; is a symbolic link to the booted kernel. To find out what kernel mode is running, enter &lt;code&gt;ls -l /unix&lt;/code&gt; and see what file &lt;code&gt;/unix&lt;/code&gt; it links to. The following are the three possible outputs from the &lt;code&gt;ls -l /unix&lt;/code&gt; command and their corresponding kernels:  &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;/unix -&gt; /usr/lib/boot/unix_up   # 32 bit uniprocessor kernel&lt;br /&gt;/unix -&gt; /usr/lib/boot/unix_mp   # 32 bit multiprocessor kernel&lt;br /&gt;/unix -&gt; /usr/lib/boot/unix_64   # 64 bit multiprocessor kernel      &lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt; AIX 5L Version 5.3 does not support a uniprocessor kernel.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How can I change from one kernel mode to another?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;During the installation process, one of the kernels, appropriate for the AIX version and the hardware in operation, is enabled by default. Let us use the method from the previous question and assume the 32-bit kernel is enabled. Let us also assume that you want to boot it up in the 64-bit kernel mode. This can be done by executing the following commands in sequence: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;ln -sf /usr/lib/boot/unix_64    /unix&lt;br /&gt;ln -sf /usr/lib/boot/unix_64    /usr/lib/boot/unix&lt;br /&gt;&lt;br /&gt;bosboot -ad  /dev/hdiskxx&lt;br /&gt;shutdown -r&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;The /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located. To find out what xx is in hdiskxx, run the following command: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt; lslv -m hd5&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;In AIX 5.2, the 32-bit kernel is installed by default. In AIX 5.3, the 64-bit kernel is installed on 64-bit hardware and the 32-bit kernel is installed on 32-bit hardware by default.&lt;/p&gt;     &lt;p&gt;&lt;a name="N100BF"&gt;&lt;span class="smalltitle"&gt;Hardware&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How would I know if my machine is capable of running AIX 5L Version 5.3?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;AIX 5L Version 5.3 runs on all currently supported CHRP (Common Hardware Reference Platform)-based POWER hardware.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How would I know if my machine is CHRP-based?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;Run the &lt;code&gt;prtconf&lt;/code&gt; command.  If it's a CHRP machine, the string &lt;code&gt;chrp&lt;/code&gt; appears on the Model Architecture line.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How would I know if my System p machine (hardware) is 32-bit or 64-bit?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To display if the hardware is 32-bit or 64-bit, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;bootinfo -y&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How much real memory does my machine have?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To display real memory in kilobytes (KB), type one of the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;bootinfo -r    &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;    &lt;/p&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsattr -El sys0 -a realmem &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;Can my machine run the 64-bit kernel? &lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;64-bit hardware is required to run the 64-bit kernel. &lt;/p&gt;    &lt;p&gt;     &lt;b&gt;What are the values of attributes for devices in my system?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To list the current values of the attributes for the tape device, rmt0, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsattr -l rmt0 -E&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;To list the default values of the attributes for the tape device, rmt0, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsattr -l rmt0 -D&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;To list the possible values of the login attribute for the TTY device, tty0, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsattr -l tty0 -a login -R&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;To display system level attributes, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsattr -E -l sys0&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How many processors does my system have?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To display the number of processors on your system, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lscfg | grep proc&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How many hard disks does my system have and which ones are in use?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To display the number of hard disks on your system, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lspv&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;How do I list information about a specific physical volume?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;To find details about hdisk1, for example, run the following command:    &lt;/p&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lspv hdisk1  &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;        &lt;b&gt;How do I get a detailed configuration of my system?&lt;/b&gt;    &lt;/p&gt;&lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lscfg&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;The following options provide specific information:    &lt;/p&gt;&lt;table border="1" cellpadding="3"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;-p&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Displays platform-specific device information. The flag is applicable to AIX 4.2.1 or later.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;-v&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Displays the VPD (Vital Product Database) found in the customized VPD object class.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;        &lt;p&gt;For example, to display details about the tape drive, rmt0, type: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lscfg -vl rmt0&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;You can obtain very similar information by running the &lt;code&gt;prtconf&lt;/code&gt; command.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How do I find out the chip type, system name, node name, model number, and so forth?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;The &lt;code&gt;uname&lt;/code&gt; command provides details about your system. &lt;/p&gt;&lt;table border="1" cellpadding="3"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -p&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the chip type of the system. For example, PowerPC.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -r&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the release number of the operating system.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -s&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the system name. For example, AIX.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -n&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the name of the node. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -a&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the system name, nodename, version, machine ID.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -M&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the system model name. For example, IBM, 9114-275.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;       &lt;code&gt;uname -v&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the operating system version.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -m&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the machine ID number of the hardware running the system.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;        &lt;code&gt;uname -u&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Displays the system ID number. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;        &lt;p&gt;&lt;a name="N1021B"&gt;&lt;span class="smalltitle"&gt;AIX&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;What version, release, and maintenance level of AIX is running on my system?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;Type one of the following: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;oslevel -r&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;    &lt;/p&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lslpp -h bos.rte&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;b&gt;How can I determine which fileset updates are missing from a particular AIX level?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;To determine which fileset updates are missing from 5300-04, for example, run the following command:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;oslevel -rl 5300-04&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;What SP (Service Pack) is installed on my system?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;To see which SP is currently installed on the system, run the &lt;code&gt;oslevel -s &lt;/code&gt;command. Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed would be:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;oslevel –s&lt;br /&gt;5300-04-02&lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;Is a CSP (Concluding Service Pack) installed on my system?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;To see if a CSP is currently installed on the system, run the &lt;code&gt;oslevel -s&lt;/code&gt; command. Sample output for an AIX 5L Version 5.3 system, with TL3, and CSP installed would be:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;oslevel –s&lt;br /&gt;5300-03-CSP&lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;How do I create a file system?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;The following command will create, within volume group testvg, a jfs file system of 10MB with mounting point /fs1:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;crfs -v jfs -g testvg -a size=10M -m /fs1&lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;The following command will create, within volume group testvg, a jfs2 file system of 10MB with mounting point /fs2 and having read only permissions:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2 &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;        &lt;p&gt;     &lt;b&gt;How do I change the size of a file system?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To increase the &lt;code&gt;/usr&lt;/code&gt; file system size by 1000000 512-byte blocks, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;chfs -a size=+1000000 /usr&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;In AIX 5.3, the size of a JFS2 file system can be shrunk as well.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How do I mount a CD?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;Type the following: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;mount -V cdrfs -o ro /dev/cd0  /cdrom&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I mount a file system?&lt;/b&gt;&lt;/p&gt;   &lt;p&gt;The following command will mount file system /dev/fslv02 on the /test directory:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;mount /dev/fslv02 /test&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;How do I mount all default file systems (all standard file systems in the /etc/filesystems file marked by the mount=true attribute)?&lt;/b&gt;&lt;/p&gt; &lt;p&gt;The following command will mount all such file systems:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;mount {-a|all}&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I unmount a file system?&lt;/b&gt;&lt;/p&gt; &lt;p&gt;Type the following command to unmount /test file system:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;umount /test&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I display mounted file systems?&lt;/b&gt;&lt;/p&gt; &lt;p&gt;Type the following command to display information about all currently mounted file systems:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;mount&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I remove a file system?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Type the following command to remove the /test file system:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;rmfs /test&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;How can I defragment a file system?&lt;/b&gt;&lt;/p&gt; &lt;p&gt;The &lt;code&gt;defragfs&lt;/code&gt; command can be used to improve or report the status of contiguous space within a file system. For example, to defragment the file system /home, use the following command:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;defragfs /home&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;                       &lt;p&gt;     &lt;b&gt;Which fileset contains a particular binary?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To show &lt;code&gt;bos.acct&lt;/code&gt; contains &lt;code&gt;/usr/bin/vmstat&lt;/code&gt;, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lslpp -w /usr/bin/vmstat&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;Or to show &lt;code&gt;bos.perf.tools&lt;/code&gt; contains &lt;code&gt;/usr/bin/svmon&lt;/code&gt;, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;which_fileset svmon&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;b&gt;How do I display information about installed filesets on my system?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lslpp -l    &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;     &lt;b&gt;How do I determine if all filesets of maintenance levels are installed on my system?&lt;/b&gt;    &lt;/p&gt;&lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;instfix -i | grep ML&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How do I determine if a fix is installed on my system?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To determine if IY24043 is installed, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;instfix -ik IY24043&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;b&gt;How do I install an individual fix by APAR?&lt;/b&gt;&lt;/p&gt;        &lt;p&gt;To install APAR IY73748 from &lt;code&gt;/dev/cd0&lt;/code&gt;, for example, enter the command:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;instfix -k IY73748 -d /dev/cd0   &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;           &lt;p&gt;     &lt;b&gt;How do I verify if filesets have required prerequisites and are completely installed?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To show which filesets need to be installed or corrected, type:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lppchk -v&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How do I get a dump of the header of the loader section and the symbol entries in symbolic representation?&lt;/b&gt;    &lt;/p&gt;&lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;dump -Htv&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How do I determine the amount of paging space allocated and in use? &lt;/b&gt;    &lt;/p&gt;&lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsps -a&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;How do I increase a paging space?&lt;/b&gt;&lt;/p&gt;    &lt;p&gt;You can use the &lt;code&gt;chps -s&lt;/code&gt; command to dynamically increase the size of a paging space. For example, if you want to increase the size of hd6 with 3 logical partitions, you issue the following command:&lt;/p&gt;        &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;chps -s 3 hd6   &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;How do I reduce a paging space?&lt;/b&gt;&lt;/p&gt;        &lt;p&gt;You can use the chps &lt;code&gt;-d&lt;/code&gt; command to dynamically reduce the size of a paging space. For example, if you want to decrease the size of hd6 with four logical partitions, you issue the following command:&lt;/p&gt;        &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;chps -d 4 hd6   &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;     &lt;b&gt;How would I know if my system is capable of using Simultaneous Multi-threading (SMT)? &lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;Your system is capable of SMT if it's a POWER5-based system running AIX 5L Version 5.3.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How would I know if SMT is enabled for my system?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;If you run the &lt;code&gt;smtctl&lt;/code&gt; command without any options, it tells you if it's enabled or not.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;Is SMT supported for the 32-bit kernel?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;Yes, SMT is supported for both 32-bit and 64-bit kernel.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How do I enable or disable SMT?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;You can enable or disable SMT by running the &lt;code&gt;smtctl&lt;/code&gt; command.  The following is the syntax:  &lt;/p&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;smtctl [ -m off | on [ -w boot | now]]&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;The following options are available:&lt;/p&gt;    &lt;table border="1" cellpadding="3"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;-m off&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Sets SMT mode to disabled.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;-m on&lt;/code&gt; &lt;/td&gt;&lt;td&gt;Sets SMT mode to enabled.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;-w boot &lt;/code&gt;&lt;/td&gt;&lt;td&gt;Makes the SMT mode change effective on   next and subsequent reboots if you run the &lt;code&gt;bosboot&lt;/code&gt; command before the next system reboot.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;-w now&lt;/code&gt; &lt;/td&gt;&lt;td&gt;Makes the SMT mode change immediately but will not persist across reboot. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;    &lt;p&gt;If neither the &lt;code&gt;-w&lt;/code&gt; boot or the &lt;code&gt;-w&lt;/code&gt; now options are specified, then the mode change is made immediately. It persists across subsequent reboots if you run the &lt;code&gt;bosboot&lt;/code&gt; command before the next system reboot. &lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How do I get partition-specific information and statistics?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;The &lt;code&gt;lparstat&lt;/code&gt; command provides a report of partition information and utilization statistics. This command also provides a display of Hypervisor information.&lt;/p&gt;    &lt;p&gt;&lt;a name="N1041A"&gt;&lt;span class="smalltitle"&gt;Volume groups and logical volumes&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How do I know if my volume group is normal, big, or scalable?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;Run the &lt;code&gt;lsvg&lt;/code&gt; command on the volume group and look at the value for MAX PVs. The value is 32 for normal, 128 for big, and 1024 for scalable volume group.&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How to create a volume group?&lt;/b&gt;    &lt;/p&gt;  &lt;p&gt;Use the following command, where &lt;code&gt;s&lt;/code&gt; &lt;i&gt;partition_size&lt;/i&gt; sets the number of megabytes (MB) in each physical partition where the partition_size is expressed in units of MB from 1 through 1024. (It's 1 through 131072 for AIX 5.3.) The partition_size variable must be equal to a power of 2 (for example: 1, 2, 4, 8). The default value for standard and big volume groups is the lowest value to remain within the limitation of 1016 physical partitions per physical volume. The default value for scalable volume groups is the lowest value to accommodate 2040 physical partitions per physical volume.&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;mkvg -y &lt;i&gt;name_of_volume_group&lt;/i&gt; -s &lt;i&gt;partition_size&lt;/i&gt; &lt;i&gt;list_of_hard_disks&lt;/i&gt;&lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;How can I change the characteristics of a volume group? &lt;/b&gt;&lt;/p&gt; &lt;p&gt;You use the following command to change the characteristics of a volume group:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;chvg&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;              &lt;p&gt;     &lt;b&gt;How do I create a logical volume?&lt;/b&gt;    &lt;/p&gt;&lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;mklv -y &lt;i&gt;name_of_logical_volume&lt;/i&gt; &lt;i&gt;name_of_volume_group&lt;/i&gt; &lt;i&gt;number_of_partition&lt;/i&gt;&lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;&lt;b&gt;How do I increase the size of a logical volume?&lt;/b&gt;&lt;/p&gt;        &lt;p&gt;To increase the size of the logical volume represented by the lv05 directory by three logical partitions, for example, type:&lt;/p&gt;        &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;extendlv lv05 3&lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;How do I display all logical volumes that are part of a volume group (for example, rootvg)?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You can display all logical volumes that are part of rootvg by typing the following command:&lt;/p&gt;   &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsvg -l rootvg&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;b&gt;How do I list information about logical volumes?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Run the following command to display information about the logical volume lv1:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lslv lv1&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I remove a logical volume?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You can remove the logical volume lv7 by running the following command:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;rmlv lv7&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;The &lt;code&gt;rmlv&lt;/code&gt; command removes only the logical volume, but does not remove other entities, such as file systems or paging spaces that were using the logical volume.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;How do I mirror a logical volume?&lt;/b&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;mklvcopy &lt;i&gt;LogicalVolumeName Numberofcopies&lt;/i&gt; &lt;/li&gt;&lt;li&gt;syncvg &lt;i&gt;VolumeGroupName&lt;/i&gt; &lt;/li&gt;&lt;/ol&gt;   &lt;p&gt;&lt;b&gt;How do I remove a copy of a logical volume?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You can use the &lt;code&gt;rmlvcopy&lt;/code&gt; command to remove copies of logical partitions of a logical volume. To reduce the number of copies of each logical partition belonging to logical volume testlv, enter:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;rmlvcopy testlv 2&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;Each logical partition in the logical volume now has at most two physical partitions.&lt;/p&gt;       &lt;p&gt;     &lt;b&gt;Queries about volume groups&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;To show volume groups in the system, type: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsvg&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;To show all the characteristics of &lt;code&gt;rootvg&lt;/code&gt;, type: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsvg rootvg&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;To show disks used by &lt;code&gt;rootvg&lt;/code&gt;, type: &lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsvg -p rootvg&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How to add a disk to a volume group?&lt;/b&gt;    &lt;/p&gt;&lt;p&gt;Type the following:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;extendvg   &lt;i&gt;VolumeGroupName&lt;/i&gt;   hdisk0 hdisk1 ... hdiskn&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;     &lt;b&gt;How do I find out what the maximum supported logical track group (LTG) size of my hard disk?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;You can use the&lt;code&gt; lquerypv&lt;/code&gt; command with the &lt;code&gt;-M&lt;/code&gt; flag. The output gives the LTG size in KB. For instance, the LTG size for hdisk0 in the following example is 256 KB.&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;/usr/sbin/lquerypv -M hdisk0&lt;br /&gt;256&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;You can also run the &lt;code&gt;lspv&lt;/code&gt; command on the hard disk and look at the value for MAX REQUEST.&lt;/p&gt;        &lt;p&gt;&lt;b&gt;What does &lt;code&gt;syncvg&lt;/code&gt; command do?&lt;/b&gt;&lt;/p&gt;        &lt;p&gt;The &lt;code&gt;syncvg &lt;/code&gt;command is used to synchronize stale physical partitions. It accepts names of logical volumes, physical volumes, or volume groups as parameters.&lt;/p&gt;    &lt;p&gt;For example, to synchronize the physical partitions located on physical volumes hdisk6 and hdisk7, use:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;syncvg -p hdisk4 hdisk5   &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;To synchronize all physical partitions from volume group testvg, use:&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;syncvg -v testvg   &lt;br /&gt;   &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;       &lt;p&gt;     &lt;b&gt;How do I replace a disk?&lt;/b&gt;    &lt;/p&gt;    &lt;ol&gt;&lt;li&gt;      &lt;code&gt;extendvg&lt;/code&gt; &lt;i&gt;VolumeGroupName&lt;/i&gt;  &lt;i&gt;hdisk_new&lt;/i&gt;           &lt;/li&gt;&lt;li&gt;      &lt;code&gt;migratepv&lt;/code&gt; &lt;i&gt;hdisk_bad hdisk_new&lt;/i&gt;        &lt;/li&gt;&lt;li&gt;      &lt;code&gt;reducevg -d&lt;/code&gt; &lt;i&gt;VolumeGroupName&lt;/i&gt; &lt;i&gt;hdisk_bad&lt;/i&gt;         &lt;/li&gt;&lt;/ol&gt;        &lt;p&gt;     &lt;b&gt;How can I clone (make a copy of ) the rootvg?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;You can run the &lt;code&gt;alt_disk_copy&lt;/code&gt; command to copy the current rootvg to an alternate disk. The following example shows how to clone the rootvg to hdisk1.&lt;/p&gt;    &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;alt_disk_copy -d  hdisk1&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;   &lt;p&gt;&lt;a name="N10580"&gt;&lt;span class="smalltitle"&gt;Network&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;     &lt;b&gt;How can I display or set values for network parameters?&lt;/b&gt;    &lt;/p&gt;    &lt;p&gt;The &lt;code&gt;no&lt;/code&gt; command sets or displays current or next boot values for network tuning parameters.&lt;/p&gt;        &lt;p&gt;&lt;b&gt;How do I get the IP address of my machine?&lt;/b&gt;&lt;/p&gt;        &lt;p&gt;Type one of the following:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;ifconfig -a&lt;br /&gt;&lt;br /&gt;host Fully_Qualified_Host_Name&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;  &lt;p&gt;For example, type host cyclop.austin.ibm.com.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;How do I identify the network interfaces on my server?&lt;/b&gt;&lt;/p&gt;   &lt;p&gt;Either of the following two commands will display the network interfaces:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;lsdev -Cc if&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;ifconfig -a&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;To get information about one specific network interface, for example, tr0, run the command:&lt;/p&gt;  &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;ifconfig tr0&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I activate a network interface?&lt;/b&gt;&lt;/p&gt; &lt;p&gt;To activate the network interface tr0, run the command:&lt;/p&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="code-outline"&gt;&lt;pre class="displaycode"&gt;ifconfig tr0 up&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt; &lt;p&gt;&lt;b&gt;How do I deactivate a network interface?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;For example, to deactivate the network interface tr0, run the command:&lt;/p&gt; &lt;pre class="displaycode"&gt;ifconfig tr0 down&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-7297655455478069801?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2008/01/aix-commands-you-should-not-leave-home.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-5782412509006289687</guid><pubDate>Thu, 13 Dec 2007 03:54:00 +0000</pubDate><atom:updated>2007-12-13T11:55:05.052+08:00</atom:updated><title>EFFICIENT COMMANDS</title><description>Bad:    cat somefile | grep something&lt;br /&gt;Better: grep something somefile&lt;br /&gt;Why:    You're running one program (grep) instead of two (cat and grep).&lt;br /&gt;&lt;br /&gt;Bad:    ps -ef | grep something | grep -v grep&lt;br /&gt;Better: ps -ef | grep [s]omething&lt;br /&gt;Why:    You're running two commands (grep) instead of three (ps&lt;br /&gt;and two greps).&lt;br /&gt;&lt;br /&gt;Bad:    cat /dev/null &gt; somefile&lt;br /&gt;Better: &gt; somefile&lt;br /&gt;Why:    You're running a command (cat) with I/O redirection,&lt;br /&gt;instead of just redirection.&lt;br /&gt;&lt;br /&gt;Although the bad way will have the&lt;br /&gt;same result, the good way is far&lt;br /&gt;faster.  This may seem trivial, but&lt;br /&gt;the benefits will really show when&lt;br /&gt;dealing with large files or loops.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-5782412509006289687?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2007/12/efficient-commands.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-4368628927217205194</guid><pubDate>Thu, 19 Jul 2007 07:48:00 +0000</pubDate><atom:updated>2007-07-19T15:50:21.348+08:00</atom:updated><title>Setting Up PureFTP server</title><description>Setting up Pure FTP server&lt;br /&gt;&lt;br /&gt;1. download pureftpd website http://www.pureftpd.org/project/pure-ftpd/doc&lt;br /&gt;&lt;br /&gt;http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.21.tar.gz&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. compile i suggest you use "./configure --with-everything" to install all features&lt;br /&gt;&lt;br /&gt;3. this ftp server have versatile auth methods (read the documention). but in my case i've use ftp authentiacation based on a independent password file.. below are the    &lt;br /&gt;    steps.&lt;br /&gt;   &lt;br /&gt;    a. create an "ftpgroup" group and an "ftpuser" user.&lt;br /&gt;&lt;br /&gt;    groupadd ftpgroup&lt;br /&gt;    useradd -g ftpgroup -d /dev/null -s /etc ftpuser&lt;br /&gt;&lt;br /&gt;    b. execute the following command to add the user&lt;br /&gt;   &lt;br /&gt;    pure-pw useradd testaccount -u ftpuser -d /home/ftpusers/testaccount -N 200&lt;br /&gt;   &lt;br /&gt;    where&lt;br /&gt;    user - testaccount&lt;br /&gt;    uid - ftpuser&lt;br /&gt;    chroot directory - /home/ftpusers/testaccount&lt;br /&gt;    disk quota - 200 MB&lt;br /&gt;&lt;br /&gt;    * this will create "/etc/pureftpd.passwd" by default&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    c. execute "pure-pw mkdb" to save the changes&lt;br /&gt;       * this will create "/etc/pureftpd.pdb"&lt;br /&gt;       * remember always execute this after changes made to password file&lt;br /&gt;&lt;br /&gt;    d. to check account info execute the following&lt;br /&gt;&lt;br /&gt;    pure-pw show testaccount&lt;br /&gt;&lt;br /&gt;    OUTPUT:&lt;br /&gt;&lt;br /&gt;    Login              : testaccount&lt;br /&gt;    Password           : $1$G5jGYrk0$n8vs/BsYv5a2cypCLMStm.&lt;br /&gt;    UID                : 508 (ftpuser)&lt;br /&gt;    GID                : 509 (ftpgroup)&lt;br /&gt;    Directory          : /home/ftpusers/testaccount/./&lt;br /&gt;    Full name          :&lt;br /&gt;    Download bandwidth : 0 Kb (unlimited)&lt;br /&gt;    Upload   bandwidth : 0 Kb (unlimited)&lt;br /&gt;    Max files          : 0 (unlimited)&lt;br /&gt;    Max size           : 200 Mb (enabled)&lt;br /&gt;    Ratio              : 0:0 (unlimited:unlimited)&lt;br /&gt;    Allowed local  IPs :&lt;br /&gt;    Denied  local  IPs :&lt;br /&gt;    Allowed client IPs :&lt;br /&gt;    Denied  client IPs :&lt;br /&gt;    Time restrictions  : 0000-0000 (unlimited)&lt;br /&gt;    Max sim sessions   : 0 (unlimited)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. run pureftp server&lt;br /&gt;&lt;br /&gt;    /usr/local/sbin/pure-ftpd -j -lpuredb:/etc/pureftpd.pdb &amp;amp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Documentation:&lt;br /&gt;&lt;br /&gt;http://www.pureftpd.org/project/pure-ftpd/doc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-4368628927217205194?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2007/07/setting-up-pureftp-server.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-510780092047812207</guid><pubDate>Sun, 06 May 2007 11:13:00 +0000</pubDate><atom:updated>2007-05-06T20:26:53.987+08:00</atom:updated><title>LVM TUTORIAL BASICS</title><description>&lt;p class="MsoNormal"&gt;&lt;b style=""&gt;LVM TUTORIAL BASICS V 1.0&lt;span style=""&gt;  &lt;/span&gt;03/21/07&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;by derrick caluag&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;      &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;br /&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;[root@intel-4 ~]# fdisk -l&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Disk /dev/sda: 145.4 GB, 145492017152 bytes&lt;/p&gt;  &lt;p class="MsoNormal"&gt;255 heads, 63 sectors/track, 17688 cylinders&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Units = cylinders of 16065 * 512 = 8225280 bytes&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;   &lt;/span&gt;Device Boot&lt;span style=""&gt;      &lt;/span&gt;Start&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;    &lt;/span&gt;End&lt;span style=""&gt;      &lt;/span&gt;Blocks&lt;span style=""&gt;   &lt;/span&gt;Id&lt;span style=""&gt;  &lt;/span&gt;System&lt;/p&gt;  &lt;p class="MsoNormal"&gt;/dev/sda1&lt;span style=""&gt;   &lt;/span&gt;*&lt;span style=""&gt;           &lt;/span&gt;1&lt;span style=""&gt;          &lt;/span&gt;16&lt;span style=""&gt;      &lt;/span&gt;128488+&lt;span style=""&gt;  &lt;/span&gt;83&lt;span style=""&gt;  &lt;/span&gt;Linux&lt;/p&gt;  &lt;p class="MsoNormal"&gt;/dev/sda2&lt;span style=""&gt;              &lt;/span&gt;17&lt;span style=""&gt;        &lt;/span&gt;1060&lt;span style=""&gt;     &lt;/span&gt;8385930&lt;span style=""&gt;   &lt;/span&gt;83&lt;span style=""&gt;  &lt;/span&gt;Linux&lt;/p&gt;  &lt;p class="MsoNormal"&gt;/dev/sda3&lt;span style=""&gt;            &lt;/span&gt;1061&lt;span style=""&gt;        &lt;/span&gt;1321&lt;span style=""&gt;     &lt;/span&gt;2096482+&lt;span style=""&gt;  &lt;/span&gt;82&lt;span style=""&gt;  &lt;/span&gt;Linux swap&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;/dev/sda4&lt;span style=""&gt;            &lt;/span&gt;1322&lt;span style=""&gt;       &lt;/span&gt;17688&lt;span style=""&gt;   &lt;/span&gt;131467927+&lt;span style=""&gt;  &lt;/span&gt;8e&lt;span style=""&gt;  &lt;/span&gt;Linux LVM&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;INITIALIZATION&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Create Physical Volume&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;pvcreate /dev/sda4&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Create Volume Group&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;vgcreate VolG00 /dev/sda4&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Create Logical Group (this will create 21G for LVhome)&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;lvcreate -L21000 VolG00 -n LVhome&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Format &lt;span style=""&gt; &lt;/span&gt;the create Group with desired file system&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;mkfs.ext3 -b 4096 /dev/VolG00 / LVhome&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Create Mount point on fstab&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;vi /etc/fstab&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;/dev/VolG00/LVhome&lt;span style=""&gt;                        &lt;/span&gt;/home&lt;span style=""&gt;                   &lt;/span&gt;ext3&lt;span style=""&gt;    &lt;/span&gt;defaults&lt;span style=""&gt;        &lt;/span&gt;1 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Backup files on&lt;span style=""&gt;  &lt;/span&gt;mountpoint&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;tar –zcvf /tmp/home.tgz /home&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;mv /home home2&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;mkdir home&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Mount the partition&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;mount /dev/VolG00/LVhome&lt;span style=""&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Untar the backup file back to the mount point&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;cd /home&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;cp /tmp/home.tgz&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;tar –zxvf home.tgz&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;EXTENDING LVM&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Unmount partition&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;umount /dev/VolG00/LVhome&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Extend &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;LV&lt;/st1:place&gt;&lt;/st1:City&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;lvextend&lt;span style=""&gt;  &lt;/span&gt;-L+1G /dev/VolG00/LVhome&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;i style=""&gt;add 1G to current size&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;or&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;lvextend -L12G /dev/VolG00/LVhome&lt;/b&gt;&lt;i style=""&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;i style=""&gt;extend size to 12G&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;i style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Check extended &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;LV&lt;/st1:place&gt;&lt;/st1:City&gt; for errors&lt;/p&gt;  &lt;p class="MsoNormal"&gt;e2fsck -f &lt;span style=""&gt; &lt;/span&gt;&lt;b style=""&gt;/dev/VolG00/LVhome&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Resize the &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;LV&lt;/st1:place&gt;&lt;/st1:City&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;resize2fs /dev/VolG00/LVhome&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;-- Remount the partition&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;mount /dev/VolG00/LVhome&lt;span style=""&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-510780092047812207?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2007/05/lvm-tutorial-basics.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-4975436739364052608</guid><pubDate>Thu, 15 Mar 2007 04:50:00 +0000</pubDate><atom:updated>2007-03-15T12:56:13.580+08:00</atom:updated><title>Installing Perl Modules</title><description>This tutorial has been my guide now for quite a while... i hope you like it as much as i am.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;CPAN&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class="info"&gt;The &lt;a href="http://www.cpan.org/"&gt;Comprehensive Perl Archive Network (CPAN)&lt;/a&gt; holds many &lt;a href="http://www.perl.org/"&gt;Perl&lt;/a&gt; modules and scripts, distributed among a large number of mirrors. The &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; module provides an interface to query and install modules from &lt;acronym&gt;CPAN&lt;/acronym&gt;. These notes document the setup and usage of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, with attention to common tasks and pitfalls along the way.&lt;/p&gt;  &lt;p class="warn"&gt;Any Perl modules used by a site should be archived locally. Doing so ensures the modules can be installed on new systems, even if removed from &lt;acronym&gt;CPAN&lt;/acronym&gt;.&lt;/p&gt;  &lt;p class="info"&gt;Use &lt;a href="http://search.cpan.org/perldoc/CPAN::Reporter" title="Documentation on the CPAN::Reporter Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN::Reporter&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; to &lt;a href="http://use.perl.org/article.pl?sid=06/11/08/1256207"&gt;submit module test results&lt;/a&gt;. &lt;a href="http://use.perl.org/%7EShlomi+Fish/journal/32367"&gt;Try SmokeAuto to automate module testing&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s1.1"&gt;Alternatives&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;Other means of installing &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; modules from &lt;acronym&gt;CPAN&lt;/acronym&gt; include the following, which are not discussed in detail here.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;a href="http://search.cpan.org/perldoc/CPANPLUS" title="Documentation on the CPANPLUS Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPANPLUS&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;. “&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN++&lt;/span&gt;&lt;/tt&gt; (also referred to and      pronounced as &lt;tt&gt;&lt;span style="font-size:10;"&gt;CPANPLUS&lt;/span&gt;&lt;/tt&gt;) is      a new and flexible method of &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt;      module management and installation using the &lt;acronym&gt;CPAN&lt;/acronym&gt;. It      aims to be a rewrite, and in time a replacement to the current &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; module. In addition to fixing some      long-standing problems, &lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN++&lt;/span&gt;&lt;/tt&gt;      includes new features, such as module uninstall.”&lt;br /&gt;     &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;PAR - &lt;a href="http://par.perl.org/"&gt;Cross-Platform Packaging and Deployment tool&lt;/a&gt;.&lt;br /&gt;     &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;a href="http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/"&gt;Perl      Package Manager (PPM)&lt;/a&gt; - Included with &lt;a href="http://aspn.activestate.com/ASPN/Downloads/ActivePerl/"&gt;ActiveState      Perl&lt;/a&gt;.&lt;br /&gt;     &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Other. Some vendors make &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; modules available via other      methods, such as ActiveState’s &lt;a href="http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/"&gt;&lt;acronym&gt;PPM&lt;/acronym&gt;&lt;/a&gt;,      the &lt;a href="http://www.freebsd.org/ports/"&gt;FreeBSD ports&lt;/a&gt; system, or      similar package software. These offer tight integration with the system in      question, but may include outdated modules or use different naming      conventions and filesystem layouts.&lt;/li&gt;&lt;/ul&gt;  &lt;p class="note" style="margin-left: 0.5in;"&gt;For example, &lt;tt&gt;&lt;span style="font-size:10;"&gt;p5-libwww&lt;/span&gt;&lt;/tt&gt; is the FreeBSD port of the module distribution &lt;tt&gt;&lt;span style="font-size:10;"&gt;libwww-perl&lt;/span&gt;&lt;/tt&gt; on &lt;acronym&gt;CPAN&lt;/acronym&gt;, and &lt;a href="http://search.cpan.org/perldoc/LWP::UserAgent" title="Documentation on the LWP::UserAgent Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;LWP::UserAgent&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; a module found in that distribution. The following commands are equivalent means to install &lt;tt&gt;&lt;span style="font-size:10;"&gt;libwww-perl&lt;/span&gt;&lt;/tt&gt; via the FreeBSD ports system, &lt;tt&gt;&lt;span style="font-size:10;"&gt;yum&lt;/span&gt;&lt;/tt&gt; on RedHat systems, or the &lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/tt&gt; command included with modern versions of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p class="data-shell" style="margin-left: 0.5in;"&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;portinstall p5-libwww&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;yum -y install perl-libwww-perl&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;cpan -i LWP::UserAgent&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;To lookup the documentation for a module, use &lt;tt&gt;&lt;span style="font-size:10;"&gt;http://search.cpan.org/perldoc/&lt;/span&gt;&lt;/tt&gt;&lt;kbd&gt;&lt;span style="font-size:10;"&gt;Module::Name&lt;/span&gt;&lt;/kbd&gt;. The documentation should also show the distribution a module belongs to, for example &lt;a href="http://search.cpan.org/perldoc/Data::Dumper" title="Documentation on the Data::Dumper Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Data::Dumper&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;. Other search interfaces include the &lt;a href="http://search.cpan.org/"&gt;&lt;acronym&gt;CPAN&lt;/acronym&gt; Search Site&lt;/a&gt; or the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; shell search features.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Conversion scripts. &lt;a href="http://perl.arix.com/cpan2rpm/"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan2rpm&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;      helps &lt;a href="http://sial.org/howto/rpm/perl/"&gt;convert Perl modules into      RedHat Package Manager (RPM) files&lt;/a&gt;. The resulting &lt;tt&gt;&lt;span style="font-size:10;"&gt;*.rpm&lt;/span&gt;&lt;/tt&gt; packages can be installed via a      &lt;a href="http://sial.org/howto/yum/"&gt;local Yellowdog Updater, Modified      (YUM) server&lt;/a&gt;. On Debian, try &lt;tt&gt;&lt;span style="font-size:10;"&gt;dh-make-perl      --install --cpan Module::Name&lt;/span&gt;&lt;/tt&gt;.&lt;/li&gt;&lt;/ul&gt;  &lt;h2&gt;&lt;a name="s2"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; Upgrade Bug&lt;/a&gt;&lt;/h2&gt;  &lt;p class="info"&gt;The first time &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is invoked, it will run through a set of questions, such as which &lt;acronym&gt;CPAN&lt;/acronym&gt; mirror site to use. Following the questions, &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; may recommend that you install &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::CPAN&lt;/span&gt;&lt;/tt&gt; or &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::libnet&lt;/span&gt;&lt;/tt&gt;. Avoid installing these bundles!&lt;/p&gt;  &lt;p class="info"&gt;Older versions of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; have a bug whereby a new version of &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; itself may be installed. To avoid this bug, install the latest version of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; first. Setting the &lt;tt&gt;&lt;span style="font-size:10;"&gt;FTP_PASSIVE=1&lt;/span&gt;&lt;/tt&gt; environment variable avoids another common problem where active File Transfer Protocol (FTP) connections are blocked by a local firewall.&lt;/p&gt;  &lt;p class="data-shell"&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;perl -MCPAN -e '$ENV{FTP_PASSIVE} = 1; install CPAN'&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;If already in the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; shell following the preferences questions, use:&lt;/p&gt;  &lt;p class="data-shell"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;install CPAN&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;For reference, the bug is that &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::CPAN&lt;/span&gt;&lt;/tt&gt; or &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::libnet&lt;/span&gt;&lt;/tt&gt; may list &lt;a href="http://search.cpan.org/perldoc/Data::Dumper" title="Documentation on the Data::Dumper Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Data::Dumper&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; as a dependency. &lt;a href="http://search.cpan.org/perldoc/Data::Dumper" title="Documentation on the Data::Dumper Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Data::Dumper&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is a built-in &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; module, so when old versions of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; lookup &lt;a href="http://search.cpan.org/perldoc/Data::Dumper" title="Documentation on the Data::Dumper Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Data::Dumper&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, they find a new version of &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; to install. This bug has been fixed in current versions of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;&lt;a name="s3"&gt;Active FTP versus Firewalls&lt;/a&gt;&lt;/h2&gt;  &lt;p class="info"&gt;Network problems may prevent access to &lt;acronym&gt;CPAN&lt;/acronym&gt; mirror sites. The chief problem will be utilities set to use active &lt;acronym&gt;FTP&lt;/acronym&gt;, which most firewalls block. Persue &lt;a href="http://slacksite.com/other/ftp.html"&gt;Active FTP vs. Passive FTP, a Definitive Explanation&lt;/a&gt; for more details. I recommend enabling passive &lt;acronym&gt;FTP&lt;/acronym&gt; by default, though this setting will need to be done for a variety of utilities &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; might run, such as &lt;tt&gt;&lt;span style="font-size:10;"&gt;wget&lt;/span&gt;&lt;/tt&gt; or &lt;a href="http://search.cpan.org/perldoc/Net::FTP" title="Documentation on the Net::FTP Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Net::FTP&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;. Alternatives include disabling the client firewall to allow active &lt;acronym&gt;FTP&lt;/acronym&gt; connections back from the &lt;acronym&gt;FTP&lt;/acronym&gt; server, or configuring a local &lt;acronym&gt;FTP&lt;/acronym&gt; proxy.&lt;/p&gt;  &lt;p class="info"&gt;Set the &lt;tt&gt;&lt;span style="font-size:10;"&gt;FTP_PASSIVE&lt;/span&gt;&lt;/tt&gt; environment variable before running &lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;  &lt;p class="data-shell"&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;env FTP_PASSIVE=1 cpan -i Net::FTP&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;During the install of the &lt;tt&gt;&lt;span style="font-size:10;"&gt;libnet&lt;/span&gt;&lt;/tt&gt; distribution, enable passive &lt;acronym&gt;FTP&lt;/acronym&gt;.&lt;/p&gt;  &lt;p class="data"&gt;…&lt;br /&gt;Ah, I see you already have installed libnet before.&lt;br /&gt;&lt;br /&gt;Do you want to modify/update your configuration (y|n) ? [no] &lt;kbd&gt;&lt;span style="font-size:10;"&gt;y&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;…&lt;br /&gt;Should all FTP connections be passive (y|n) ? [no] &lt;kbd&gt;&lt;span style="font-size:10;"&gt;y&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;If &lt;a href="http://search.cpan.org/perldoc/Net::FTP" title="Documentation on the Net::FTP Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Net::FTP&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is already installed, edit the &lt;tt&gt;&lt;span style="font-size:10;"&gt;libnet.cfg&lt;/span&gt;&lt;/tt&gt; configuration file to use passive &lt;acronym&gt;FTP&lt;/acronym&gt;.&lt;/p&gt;  &lt;p class="data-shell"&gt;$ &lt;kbd&gt;&lt;span style="font-size:10;"&gt;perl -le 'for (@INC) { $_ .= "/".$ARGV[0]; print if -f }' Net/libnet.cfg&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;/usr/local/lib/perl5/5.8.1/Net/libnet.cfg&lt;br /&gt;$ &lt;kbd&gt;&lt;span style="font-size:10;"&gt;grep passive /usr/local/lib/perl5/5.8.1/Net/libnet.cfg&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;'ftp_int_passive' =&gt; 1,&lt;/p&gt;  &lt;p class="info"&gt;If &lt;a href="http://search.cpan.org/perldoc/Net::FTP" title="Documentation on the Net::FTP Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Net::FTP&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; does not work, or certain utilities take too long to time out, consider the following options.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Disable &lt;a href="http://search.cpan.org/perldoc/Net::FTP" title="Documentation on the Net::FTP Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Net::FTP&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;If &lt;a href="http://search.cpan.org/perldoc/Net::FTP" title="Documentation on the Net::FTP Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Net::FTP&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; does not work, try adding the following line to the &lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN/Config.pm&lt;/span&gt;&lt;/tt&gt; preferences file. More &lt;a href="http://nntp.x.perl.org/group/perl.perl5.porters/73929"&gt;information on &lt;tt&gt;&lt;span style="font-size:10;"&gt;dontload_hash&lt;/span&gt;&lt;/tt&gt; posted to the &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl.perl5.porters&lt;/span&gt;&lt;/tt&gt; newsgroup&lt;/a&gt;. Also consider installing &lt;a href="http://search.cpan.org/perldoc/LWP::UserAgent" title="Documentation on the LWP::UserAgent Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;LWP::UserAgent&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, which is more capable than &lt;a href="http://search.cpan.org/perldoc/Net::FTP" title="Documentation on the Net::FTP Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Net::FTP&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p class="data" style="margin-left: 0.5in;"&gt;'dontload_hash' =&gt; { 'Net::FTP' =&gt; 1 },&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Disable utilities that do not      work&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;To reconfigure &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; to not call certain utilities, replace the path to the utility with a single space.&lt;/p&gt;  &lt;p class="data-shell" style="margin-left: 0.5in;"&gt;$ &lt;kbd&gt;&lt;span style="font-size:10;"&gt;grep ncftp ~/.cpan/CPAN/MyConfig.pm&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;'ncftp' =&gt; q[ ],&lt;br /&gt;'ncftpget' =&gt; q[ ],&lt;/p&gt;  &lt;h2&gt;&lt;a name="s4"&gt;Preferences Questions&lt;/a&gt;&lt;/h2&gt;  &lt;p class="info"&gt;&lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; will ask for preferences settings any time the &lt;tt&gt;&lt;span style="font-size:10;"&gt;Config.pm&lt;/span&gt;&lt;/tt&gt; preferences file does not exist or is out of date. The default choice should be acceptable for most.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;CPAN build and cache      directory? [&lt;tt&gt;&lt;span style="font-size:10;"&gt;/root/.cpan&lt;/span&gt;&lt;/tt&gt;]&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;I use &lt;tt&gt;&lt;span style="font-size:10;"&gt;/var/spool/cpan&lt;/span&gt;&lt;/tt&gt;, as the root filesystem tends to be small on my systems, and the spool area makes more sense to me.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Policy on building      prerequisites (follow, ask or ignore)? [ask]&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;Leave this setting set to &lt;kbd&gt;&lt;span style="font-size:10;"&gt;ask&lt;/span&gt;&lt;/kbd&gt; when upgrading &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; the first time, to prevent dependency lookups automatically installing the latest stable &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt;. With &lt;kbd&gt;&lt;span style="font-size:10;"&gt;ask&lt;/span&gt;&lt;/kbd&gt; set, one can say no to queries that ask to install &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::CPAN&lt;/span&gt;&lt;/tt&gt;, &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::libnet&lt;/span&gt;&lt;/tt&gt;, or &lt;a href="http://search.cpan.org/perldoc/Data::Dumper" title="Documentation on the Data::Dumper Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Data::Dumper&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; until the latest version of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is installed.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Where is your &lt;tt&gt;&lt;span style="font-size:10;"&gt;*&lt;/span&gt;&lt;/tt&gt; program? [&lt;tt&gt;&lt;span style="font-size:10;"&gt;*&lt;/span&gt;&lt;/tt&gt;]&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;This series of questions lets one configure (or disable) paths to various utilities &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; may use to download or unpack modules. It is safe to leave entries blank, as long as &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is left with at least one working program that can download modules and another to expand them.&lt;/p&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;To disable a particular utility, use a single space instead of a file path.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Parameters for the '&lt;tt&gt;&lt;span style="font-size:10;"&gt;make install&lt;/span&gt;&lt;/tt&gt;' command?&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;Set this option to include &lt;tt&gt;&lt;span style="font-size:10;"&gt;UNINST=1&lt;/span&gt;&lt;/tt&gt; if installing as root. This properly cleans out files from older versions of a module being installed. For user-specific setup, I never set the &lt;tt&gt;&lt;span style="font-size:10;"&gt;UNINST&lt;/span&gt;&lt;/tt&gt; option, to avoid remove warnings of unremovable system files.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Now we need to know where      your favorite CPAN sites are located.&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;Choose several &lt;acronym&gt;CPAN&lt;/acronym&gt; mirror sites. Use &lt;tt&gt;&lt;span style="font-size:10;"&gt;traceroute&lt;/span&gt;&lt;/tt&gt; or bandwidth testing tools to determine which mirrors are best for your system. Or, &lt;a href="http://cpan.org/misc/cpan-faq.html#How_mirror_CPAN"&gt;mirror &lt;acronym&gt;CPAN&lt;/acronym&gt; to a local system&lt;/a&gt;.&lt;/p&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;The mirrors list may need to be updated periodically, if a previous mirror site stops hosting &lt;acronym&gt;CPAN&lt;/acronym&gt;. Symptoms of this will be slow downloads as &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; fails though the mirror list.&lt;/p&gt;  &lt;h2&gt;&lt;a name="s5"&gt;Reconfiguring CPAN&lt;/a&gt;&lt;/h2&gt;  &lt;p class="info"&gt;To alter the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; preferences, either edit the &lt;tt&gt;&lt;span style="font-size:10;"&gt;Config.pm&lt;/span&gt;&lt;/tt&gt; configuration file manually, or use the following command in the CPAN shell.&lt;/p&gt;  &lt;p class="data-shell"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;o conf init&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;The &lt;tt&gt;&lt;span style="font-size:10;"&gt;init&lt;/span&gt;&lt;/tt&gt; configuration option runs through all the configuration questions, which may be time consuming. For example, other &lt;tt&gt;&lt;span style="font-size:10;"&gt;o conf&lt;/span&gt;&lt;/tt&gt; commands can be used to list, remove, and add mirror sites, and then to save the changes to disk.&lt;/p&gt;  &lt;p class="data-shell"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;o conf urllist&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;urllist&lt;br /&gt;ftp://ftp.kernel.org/pub/CPAN/&lt;br /&gt;Type 'o conf' to view configuration edit options&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;o conf urllist shift&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;o conf urllist push ftp://ftp-mirror.internap.com/pub/CPAN/&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;o conf urllist&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;urllist&lt;br /&gt;ftp://ftp-mirror.internap.com/pub/CPAN/&lt;br /&gt;Type 'o conf' to view configuration edit options&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;o conf commit&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;commit: wrote /usr/local/lib/perl5/5.6.1/CPAN/Config.pm&lt;/p&gt;  &lt;p class="info"&gt;To manually edit the existing configuration file, either open the user-specific &lt;tt&gt;&lt;span style="font-size:10;"&gt;~/.cpan/CPAN/MyConfig.pm&lt;/span&gt;&lt;/tt&gt; directly, or locate the system-wide configuration file (stored somewhere under the &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; &lt;tt&gt;&lt;span style="font-size:10;"&gt;@INC&lt;/span&gt;&lt;/tt&gt; path list) to edit with the following command.&lt;/p&gt;  &lt;p class="data-shell"&gt;$ &lt;kbd&gt;&lt;span style="font-size:10;"&gt;perl -le 'for (@INC) { $_ .= $ARGV[0]; print if -f }' /CPAN/Config.pm&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;/System/Library/Perl/CPAN/Config.pm&lt;/p&gt;  &lt;h2&gt;&lt;a name="s6"&gt;Usage Tips&lt;/a&gt;&lt;/h2&gt;  &lt;p class="MsoNormal"&gt;&lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.1"&gt;Invocation&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.2"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;autobundle&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.3"&gt;Debugging&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.4"&gt;Old Modules&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.5"&gt;Mac OS X&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.6"&gt;Manual Build&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.7"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;sudo&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.8"&gt;Uninstalling&lt;/a&gt; | &lt;a href="http://sial.org/howto/perl/life-with-cpan/#s6.9"&gt;Upgrading&lt;/a&gt;&lt;/p&gt;  &lt;p class="info"&gt;Once the latest version of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; has been properly installed, it is safe to install &lt;tt&gt;&lt;span style="font-size:10;"&gt;Bundle::CPAN&lt;/span&gt;&lt;/tt&gt; to get the latest versions of modules &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; depends on. If already in the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; shell, be sure to run &lt;tt&gt;&lt;span style="font-size:10;"&gt;reload cpan&lt;/span&gt;&lt;/tt&gt; first.&lt;/p&gt;  &lt;p class="data-shell"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;reload cpan&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;…&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;install Bundle::CPAN&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;The following sections outline various uses and caveats with &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.1"&gt;Invocation&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;The latest version of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; should install a &lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/tt&gt; command somewhere on the system, which is easier to use than the traditional means of calling &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;. With an up to date version of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, the following sets of commands are equivalent. Hereafter, the shorter &lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/tt&gt; method will be used.&lt;/p&gt;  &lt;p class="data-shell"&gt;&lt;span class="comment"&gt;# enter the CPAN shell&lt;/span&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;perl -MCPAN -e shell&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="comment"&gt;# install the Acme::Bleach module&lt;/span&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;perl -MCPAN -e install Acme::Bleach&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;cpan -i Acme::Bleach&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="note"&gt;Depending on the shell in question, one may need to issue the &lt;tt&gt;&lt;span style="font-size:10;"&gt;hash -r&lt;/span&gt;&lt;/tt&gt; or &lt;tt&gt;&lt;span style="font-size:10;"&gt;rehash&lt;/span&gt;&lt;/tt&gt; command to make the new &lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/tt&gt; command appear in the search path after the latest &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is installed. Consult your shell’s documentation for more information on whether this is required.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.2"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;autobundle&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;The &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; &lt;tt&gt;&lt;span style="font-size:10;"&gt;autobundle&lt;/span&gt;&lt;/tt&gt; can be used to ease &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; upgrades, by creating a special bundle containing all the installed modules of the current version of &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt;. This bundle can then be installed once the new version of &lt;tt&gt;&lt;span style="font-size:10;"&gt;perl&lt;/span&gt;&lt;/tt&gt; is installed.&lt;/p&gt;  &lt;p class="data-shell"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;autobundle&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;…&lt;br /&gt;&lt;br /&gt;Wrote bundle file&lt;br /&gt;/var/spool/cpan/Bundle/Snapshot_2003_10_01_00.pm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;quit&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="comment"&gt;# upgrade perl here …&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;install Bundle::Snapshot_2003_10_01_00&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;Autobundle appears to install the modules in alphabetical order; setting the &lt;tt&gt;&lt;span style="font-size:10;"&gt;prerequisites_policy&lt;/span&gt;&lt;/tt&gt; policy to &lt;tt&gt;&lt;span style="font-size:10;"&gt;ask&lt;/span&gt;&lt;/tt&gt; should help. Multiple install runs may be needed to install everything properly. Module build failures will lead to much recursion on the part of &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.3"&gt;Debugging&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;Should tests fail during the &lt;tt&gt;&lt;span style="font-size:10;"&gt;make test&lt;/span&gt;&lt;/tt&gt; phase of the module install process, the tests should be investigated to determine their impact. If the failed tests are not relevant to the system in question, the module can be installed with the &lt;tt&gt;&lt;span style="font-size:10;"&gt;force&lt;/span&gt;&lt;/tt&gt; option. Otherwise, filing a bug report or otherwise contacting the module author may be in order.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Force Install&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;To force install a module, use the &lt;tt&gt;&lt;span style="font-size:10;"&gt;force&lt;/span&gt;&lt;/tt&gt; option.&lt;/p&gt;  &lt;p class="data-shell" style="margin-left: 0.5in;"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;force install HTML::Mason&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Verbose Testing&lt;/li&gt;&lt;/ul&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;More verbose testing will need to be done from the command line. This can be done with the &lt;tt&gt;&lt;span style="font-size:10;"&gt;look&lt;/span&gt;&lt;/tt&gt; command from the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; shell, along with subsequent shell code as shown in the following example for &lt;a href="http://search.cpan.org/perldoc/HTML::Mason" title="Documentation on the HTML::Mason Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;HTML::Mason&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, with verbose test logging saved to &lt;tt&gt;&lt;span style="font-size:10;"&gt;test.log&lt;/span&gt;&lt;/tt&gt; via the &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=tee&amp;sektion=1" title="FreeBSD man page search for tee, section 1"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;tee(1)&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; command.&lt;/p&gt;  &lt;p class="data-shell" style="margin-left: 0.5in;"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;install HTML::Mason&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;Running install for module HTML::Mason&lt;br /&gt;Running make for D/DR/DROLSKY/HTML-Mason-1.23.tar.gz&lt;br /&gt;…&lt;br /&gt;t/02a-filter..........ok&lt;br /&gt;t/04-misc.............FAILED tests 9-10&lt;br /&gt;Failed 2/11 tests, 81.82% okay&lt;br /&gt;t/05-request..........ok&lt;br /&gt;…&lt;br /&gt;Failed Test Stat Wstat Total Fail Failed List of Failed&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;t/04-misc.t 11 2 18.18% 9-10&lt;br /&gt;2 tests skipped.&lt;br /&gt;Failed 1/23 test scripts, 95.65% okay. 2/376 subtests failed, 99.47% okay.&lt;br /&gt;*** Error code 35&lt;br /&gt;&lt;br /&gt;Stop in /var/spool/cpan/build/HTML-Mason-1.23.&lt;br /&gt;/usr/bin/make test -- NOT OK&lt;br /&gt;Running make install&lt;br /&gt;make test had returned bad status, won't install without force&lt;br /&gt;&lt;br /&gt;cpan&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;look HTML::Mason&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;Running look for module HTML::Mason&lt;br /&gt;&lt;br /&gt;Trying to open a subshell in the build directory...&lt;br /&gt;Working directory is /var/spool/cpan/build/HTML-Mason-1.23&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;make test TEST_VERBOSE=1 TEST_FILE=t/04-misc.t | tee test.log&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;…&lt;/p&gt;  &lt;p class="info" style="margin-left: 0.5in;"&gt;Determination as to whether the failed test is relevant to the system in question will need to be done by a human, typically by running of the test code and consulting the test script and module code to see what is failing. If the failed tests are for features of the module that will not be used, then the module typically can be installed and used without problems.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.4"&gt;Old Modules&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;Some modules found by &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; are out of date, and will not compile. An updated module may be available on &lt;acronym&gt;CPAN&lt;/acronym&gt;, just not linked to as “current” by &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;. Modules known to have this problem include the following. The links below should point to the current version of the modules.&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;a href="http://search.cpan.org/perldoc/Mail::Cclient" title="Documentation on the Mail::Cclient Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Mail::Cclient&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;&lt;br /&gt;     &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;a href="http://search.cpan.org/perldoc/OpenGL" title="Documentation on the OpenGL Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;OpenGL&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;&lt;a name="s6.5"&gt;Mac OS X&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;&lt;a href="http://sial.org/howto/perl/life-with-cpan/macosx/"&gt;Problems with &lt;acronym&gt;CPAN&lt;/acronym&gt; on Mac OS X&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.6"&gt;Manual Build&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;On occasion one may need to manually build or test a module, or consult the module directory to read the documentation on any special needs the module may have. This can be done with the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; shell &lt;tt&gt;&lt;span style="font-size:10;"&gt;look&lt;/span&gt;&lt;/tt&gt; command.&lt;/p&gt;  &lt;p class="data-shell"&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt;look Net::SSLeay&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;…&lt;br /&gt;Working directory is /var/spool/cpan/build/Net_SSLeay.pm-1.25&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;exit&lt;/span&gt;&lt;/kbd&gt;&lt;br /&gt;cpan&gt; &lt;kbd&gt;&lt;span style="font-size:10;"&gt; &lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.7"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;sudo&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;If &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; is installed in your home directory, the system-wide &lt;tt&gt;&lt;span style="font-size:10;"&gt;cpan&lt;/span&gt;&lt;/tt&gt; may cause problems when run via &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=sudo&amp;sektion=8&amp;amp;manpath=OpenBSD" title="FreeBSD man page search for sudo, section 8 on OpenBSD"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;sudo(8)&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, as by default &lt;tt&gt;&lt;span style="font-size:10;"&gt;sudo&lt;/span&gt;&lt;/tt&gt; will invoke &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; using the &lt;tt&gt;&lt;span style="font-size:10;"&gt;~/.cpan/CPAN/MyConfig.pm&lt;/span&gt;&lt;/tt&gt; configuration, but as &lt;tt&gt;&lt;span style="font-size:10;"&gt;root&lt;/span&gt;&lt;/tt&gt;, which causes no end of trouble. To avoid this problem, reset the &lt;tt&gt;&lt;span style="font-size:10;"&gt;HOME&lt;/span&gt;&lt;/tt&gt; environment variable with the &lt;tt&gt;&lt;span style="font-size:10;"&gt;-H&lt;/span&gt;&lt;/tt&gt; option to &lt;tt&gt;&lt;span style="font-size:10;"&gt;sudo&lt;/span&gt;&lt;/tt&gt; when invoking &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p class="data-shell"&gt;$ &lt;kbd&gt;&lt;span style="font-size:10;"&gt;sudo -H cpan&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.8"&gt;Uninstalling&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;&lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; itself offers no uninstall method. Several of the alternatives to &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; do, such as &lt;a href="http://search.cpan.org/perldoc/CPANPLUS" title="Documentation on the CPANPLUS Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPANPLUS&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; or vendor package/port systems. If the module has been fully installed along with a &lt;tt&gt;&lt;span style="font-size:10;"&gt;.packlist&lt;/span&gt;&lt;/tt&gt; file for the module, the &lt;a href="http://search.cpan.org/perldoc/ExtUtils::Packlist" title="Documentation on the ExtUtils::Packlist Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;ExtUtils::Packlist&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; perl module documentation includes code for a &lt;tt&gt;&lt;span style="font-size:10;"&gt;modrm&lt;/span&gt;&lt;/tt&gt; command to cleanly remove an installed module.&lt;/p&gt;  &lt;p class="note"&gt;Modules built with other tools, such as &lt;a href="http://search.cpan.org/perldoc/Module::Build" title="Documentation on the Module::Build Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;Module::Build&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;, may not write out a &lt;tt&gt;&lt;span style="font-size:10;"&gt;.packlist&lt;/span&gt;&lt;/tt&gt; file for use by &lt;a href="http://search.cpan.org/perldoc/ExtUtils::Packlist" title="Documentation on the ExtUtils::Packlist Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;ExtUtils::Packlist&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;a name="s6.9"&gt;Upgrading&lt;/a&gt;&lt;/h3&gt;  &lt;p class="info"&gt;How to upgrade all the modules on the system like &lt;tt&gt;&lt;span style="font-size:10;"&gt;apt-get&lt;/span&gt;&lt;/tt&gt; is actually documented in the &lt;a href="http://search.cpan.org/perldoc/CPAN" title="Documentation on the CPAN Perl module"&gt;&lt;tt&gt;&lt;span style="font-size:10;"&gt;CPAN&lt;/span&gt;&lt;/tt&gt;&lt;/a&gt; manual; however, the question comes up often enough that I answer it here as well.&lt;/p&gt;  &lt;p class="data-shell"&gt;&lt;span class="comment"&gt;# install everything that is outdated on my disk:&lt;/span&gt;&lt;br /&gt;# &lt;kbd&gt;&lt;span style="font-size:10;"&gt;perl -MCPAN -e 'CPAN::Shell-&gt;install(CPAN::Shell-&gt;r)'&lt;/span&gt;&lt;/kbd&gt;&lt;/p&gt;  &lt;p class="info"&gt;Problems with this include new versions of modules that may break old module behavior, or various modules that cannot be upgraded due to build failures or system incompatibilities. Best to subject a test system to this sort of mass module upgrade before attempting it on a production system.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;if you need to change server pls check this cool site below&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;CPAN SERVER SITES:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.cpan.org/SITES.html" target="_blank"&gt;http://www.cpan.org/SITES.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="info"&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-4975436739364052608?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2007/03/installing-perl-modules.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-116054464663356181</guid><pubDate>Wed, 11 Oct 2006 05:23:00 +0000</pubDate><atom:updated>2006-10-12T11:18:35.180+08:00</atom:updated><title>HOW TO SETUP DIAL-IN SERVER on LINUX</title><description>A lot of my friends have been asking me how to setup a dial-in server on a linux box.. As far as im an concern i was able to make this kind of setup on a debian os.. i've tried it on ubuntu on breezy and dappeldrake and it both went well.. only it requires you to have a modem preferably external or internal will also do and a dedicated line to be used by the dial-in users.. below are the steps that i followed:&lt;br /&gt;&lt;br /&gt;                           &lt;br /&gt;Part I . The short version:D on how to get remote access to your Ubuntu box via modem. Install mgetty&lt;br /&gt;sudo apt-get install mgetty&lt;br /&gt;Add a line at the end of file /etc/inittab&lt;br /&gt;S0:2345:respawn:/sbin/mgetty ttyS0&lt;br /&gt;If your modem is on COM1.&lt;br /&gt;Initialize init by typing&lt;br /&gt;sudo init q&lt;br /&gt;Now from Win you can use HyperTerminal to connect to your Ubuntu box with your user name/pass.&lt;br /&gt;&lt;br /&gt;For those who want more here is a real deal;)&lt;br /&gt;&lt;br /&gt;Part II&lt;br /&gt;&lt;br /&gt;The problem: Establish PPP connection to Ubuntu server from a remote location using a modem and to share internet connection.&lt;br /&gt;Laptop modem&lt;&gt; Server modem &lt;&gt; Ethernet Router &lt;&gt; Cable/DSL modem &lt;&gt; Internet&lt;br /&gt;&lt;br /&gt;Assumptions: drivers for your modems already installed and modem is at ttyS0. I have an external modem attached to COM1 - ttyS0, COM2 will be ttyS1. I didn't have X installed so I was using nano to edit conf files, you can use gedit if you have X installed or any other editor. Make sure your are familiar with the interface of the editor before you start modifying files. Make sure you create backups of the files before you modify them. You will need to use sudo or login as root for most of the tasks. If you don't know how to configure your dial up on your client look for a dial up howto or Ubuntu docs. I also assume that you already have your local nework including routers properly configured and have an access to the Internet from your Ubuntu server.&lt;br /&gt;&lt;br /&gt;Part II.a - Dial in configuration&lt;br /&gt;&lt;br /&gt;1. If not already installed use synaptic or apt-get to install ppp and mgetty packages. ppp should be already installed by default so&lt;br /&gt;sudo apt-get install mgetty&lt;br /&gt;&lt;br /&gt;2. Create a group ppp by adding a line in file /etc/group ppp:x:1001:&lt;br /&gt;&lt;br /&gt;3. Create a new user "pppuser" or whatever you will use for your dial in connection and assign a password by using&lt;br /&gt;sudo adduser pppuser&lt;br /&gt;edit file /etc/passwd or use sudo vipw to change entry for pppuser to pppuser:x:1001:1001:,,,:/home/pppuser:/usr/sbin/ppplogin&lt;br /&gt;&lt;br /&gt;4. Add a line to the file /etc/inittab S0:2345:respawn:/sbin/mgetty ttyS0 for modem on ttyS0. Or S1:2345:respawn:/sbin/mgetty ttyS1 for modem on ttyS1 That will let mgetty to accept incoming calls&lt;br /&gt;&lt;br /&gt;5.Make a new file /usr/sbin/ppplogin and add the following in there&lt;br /&gt;#!/bin/sh&lt;br /&gt;#/etc/ppp/ppplogin&lt;br /&gt;# PPP login script&lt;br /&gt;mesg n&lt;br /&gt;stty -echo&lt;br /&gt;exec /usr/sbin/pppd -detach modem debug crtscts&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Set access to the ppplogin file and etc/ppp directory&lt;br /&gt;chmod 750 /usr/sbin/ppplogin&lt;br /&gt;chown root:ppp /usr/sbin/ppplogin&lt;br /&gt;chmod 775 /etc/ppp&lt;br /&gt;chown root:root -R /etc/ppp&lt;br /&gt;&lt;br /&gt;7. Restart init by typing init q&lt;br /&gt;If you're use external modem it should be on before that.&lt;br /&gt;&lt;br /&gt;8. Open file /etc/mgetty/login.config Comment out everything in there and add a line&lt;br /&gt;/AutoPPP/ - a_ppp /usr/sbin/pppd file /etc/ppp/options&lt;br /&gt;&lt;br /&gt;9. Open file /etc/ppp/options and make sure these lines are uncommented. If anything else is uncommented it probably should be commented.&lt;br /&gt;&lt;br /&gt;-detach&lt;br /&gt;asyncmap 0&lt;br /&gt;modem&lt;br /&gt;crtscts&lt;br /&gt;proxyarp&lt;br /&gt;lock&lt;br /&gt;require-pap&lt;br /&gt;refuse-chap&lt;br /&gt;ms-dns 192.168.1.1 #put your dns server ip here&lt;br /&gt;usepeerdns&lt;br /&gt;In my case the ms-dns entry had an ip of my router, if you using Linksys router it's 192.168.1.1 by default unless you changed it.&lt;br /&gt;&lt;br /&gt;10. Create a file /etc/ppp/options.ttyS0 for the modem on ttyS0 and add following in there&lt;br /&gt;192.168.1.3:192.168.1.201&lt;br /&gt;noauth&lt;br /&gt;Where first address is the address of your server for ppp connection which I think, should be different from your eth ip. The second address is the address that will be assigned to the client when connection is established. It will probably make life easier, unless you know what you doing, if all those addresses on the same subnet as your other computers on the network. (ip starts with the same 192.168.1.x numbers)&lt;br /&gt;You can substitute noauth for a debug line, this way it will log some info about you connection in a syslog.&lt;br /&gt;&lt;br /&gt;11. Edit file /etc/ppp/pap-secrets&lt;br /&gt;find a line after # Every regular user can use PPP and has to use passwords from /etc/passwd&lt;br /&gt;It should look something like that&lt;br /&gt;* hostname "" *&lt;br /&gt;substitute hostnatname with * so it looks like that&lt;br /&gt;* * "" *&lt;br /&gt;&lt;br /&gt;If you don't do that pap will not authenticate you and you'll be immediately disconnected.&lt;br /&gt;&lt;br /&gt;Now you're able to connect using dial-up connection from you laptop or a remote office into your Ubuntu server and use ssh or putty if you're using Win.&lt;br /&gt;&lt;br /&gt;Part II.b - Accessing internet from a remote client&lt;br /&gt;&lt;br /&gt;I'm sure there other or better solutions to that, but that was easy enough and it worked for me.&lt;br /&gt;&lt;br /&gt;sudo apt-get install ipmasq&lt;br /&gt;&lt;br /&gt;Done. ipmasq automatically senses all your interfaces and initializes IP Masquerade forwarding/firewalling and allows you to connect to the rest of your network and the Internet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-116054464663356181?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/10/how-to-setup-dial-in-server-on-linux.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-115138368895499680</guid><pubDate>Tue, 27 Jun 2006 04:46:00 +0000</pubDate><atom:updated>2006-06-27T12:48:08.963+08:00</atom:updated><title>SETTING TWO IP ADDRESS in ONE LAN card or NIC</title><description>SETTING TWO IP ADDRESS in ONE LAN card or NIC.&lt;br /&gt;&lt;br /&gt;Two options either you add it at /etc/netword/interfaces or you set using ifconfig&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. TO set using IFCONFIG (temporary)&lt;br /&gt;&lt;br /&gt;ifconfig eth1:1 &lt;ip&gt; netmask 255.255.255.0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. TO add permanently&lt;br /&gt;&lt;br /&gt;for debian flavors:&lt;br /&gt;&lt;br /&gt;edit&lt;br /&gt;/etc/network/interfaces&lt;br /&gt;&lt;br /&gt;iface eth1:1 inet static&lt;br /&gt;        address &lt;ip&gt;&lt;br /&gt;        netmask &lt;subnet&gt;&lt;br /&gt;        broadcast &lt;broadcast&gt;&lt;br /&gt;        gateway &lt;gateway&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-115138368895499680?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/06/setting-two-ip-address-in-one-lan-card.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>6</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114779898480842286</guid><pubDate>Tue, 16 May 2006 16:35:00 +0000</pubDate><atom:updated>2006-05-17T01:07:35.643+08:00</atom:updated><title>Adding Additional Hard drive on your Linux Machine</title><description>&lt;span style="font-family: verdana;font-family:Verdana,Arial,Helvetica;font-size:85%;"  &gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Normally one would ask? how do i add additional harddrive to my linux box.. well we could make use of utilities like &lt;/span&gt;fdisk, cfdisk or QtParted but it is fdisk that is im going to discuss below.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Why FDISK.. the answer is simple. since fdisk is the utility that i've been using eversince i've tried linux. :)&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Here are the steps:&lt;br /&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;You must first be able to identify which partion is your new harddrive either though dmesg or using fdisk utility&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;pre&gt; # fdisk -l&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;The output will display the current harddrive informations and which device it is assigned to.&lt;br /&gt;for scsi drive its normally /dev/sda while for IDE drive its /dev/hda&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;      # fdisk /dev/hdc&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;      Command (m for help): _&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;For a short manual we need to enter the 'm' command:  &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Command (m for help): m&lt;br /&gt;      Command action&lt;br /&gt;         a   toggle a bootable flag&lt;br /&gt;         b   edit bsd disklabel&lt;br /&gt;         c   toggle the dos compatibility flag&lt;br /&gt;         d   delete a partition&lt;br /&gt;         l   list known partition types&lt;br /&gt;         m   print this menu&lt;br /&gt;         n   add a new partition&lt;br /&gt;         o   create a new empty DOS partition table&lt;br /&gt;         p   print the partition table&lt;br /&gt;         q   quit without saving changes&lt;br /&gt;         s   create a new empty Sun disklabel&lt;br /&gt;         t   change a partition's system id&lt;br /&gt;         u   change display/entry units&lt;br /&gt;         v   verify the partition table&lt;br /&gt;         w   write table to disk and exit&lt;br /&gt;         x   extra functionality (experts only)&lt;br /&gt;&lt;br /&gt;      Command (m for help):&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt; &lt;span style="font-size:85%;"&gt;We need to know just few necessary commands: d,p,n,q,w. Don't be afraid to use them--all your changes will be done only in memory and will only be written to the hard after the 'w' command is entered. If we have an error, we just need to cancel all changes with the command 'q'. &lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-size:85%;"&gt;First of all, let's make ourself sure that disk is empty:  &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Command (m for help): p&lt;br /&gt;&lt;br /&gt;      Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders&lt;br /&gt;      Units = cylinders of 4032 * 512 bytes&lt;br /&gt;&lt;br /&gt;         Device Boot    Start       End    Blocks   Id  System&lt;br /&gt;&lt;br /&gt;      Command (m for help):&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt; &lt;span style="font-size:85%;"&gt;Often sellers of PCs and hardware will pre-divide disks into partitions. In such cases we can use command 'd' (described below) to delete everything what we do not need. &lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-size:85%;"&gt;So, let's create a new parititon (with command 'n'), answering all the questions as we go:  &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Command (m for help): n&lt;br /&gt;      Command action&lt;br /&gt;         e   extended&lt;br /&gt;         p   primary partition (1-4)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;Choosing the partition type-- primary or extended--we will enter P for primary.  &lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-size:85%;"&gt;In choosing number of the partition in this example, we will assign all of the all free space to one partition. Because this will be the first and only existing partition, we will assign the number 1: &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Partition number (1-4): 1&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt; &lt;span style="font-size:85%;"&gt;When setting the number of the first cylinder of the partition, we can just use the default value, which is recorded when we just press Enter: &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        First cylinder (1-787, default 1):&lt;br /&gt;      Using default value 1&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt; &lt;span style="font-size:85%;"&gt;Setting the number of the last cylinder of the partition is easy in this example, since we are filling the entire drive with one partition. Again, just press Enter for the default (instead of the number of the cylinder, we can set size of partition in bytes, kbytes, or megabytes): &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Last cylinder or +size or +sizeM or +sizeK (1-787, default 787):&lt;br /&gt;      Using default value 787&lt;br /&gt;&lt;br /&gt;      Command (m for help):&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Now, partition is created. We can take a look of new table  of partitions with the help of the 'p' command:  &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Command (m for help): p&lt;br /&gt;&lt;br /&gt;      Disk /dev/hdc: 64 heads, 63 sectors, 787 cylinders&lt;br /&gt;      Units = cylinders of 4032 * 512 bytes&lt;br /&gt;&lt;br /&gt;         Device Boot    Start       End    Blocks   Id  System&lt;br /&gt;      /dev/hdc1             1       787   1586560+  83  Linux&lt;br /&gt;&lt;br /&gt;      Command (m for help):&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt; &lt;span style="font-size:85%;"&gt;If we don't like (for some reason) the location or number of the partition, we can delete it using 'd' command:  &lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;        Command (m for help): d&lt;br /&gt;      Partition number (1-4): 1&lt;br /&gt;      Command (m for help):&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt; &lt;span style="font-size:85%;"&gt;If you want to divide the disk into a few partitions, you will need to repeat all these operations a few times. One thing that is important to remember is that if the amount of partitions is greater than four, you'll need to create not primary, but an extended partition across the whole available disk space. Inside this partition you can create as many logical parts as needed. &lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-size:85%;"&gt;Remember, please, that logical partitions always should be numbered from 5 upwards; it doesn't matter how many primary partitions were created before (one, three, or none at all).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;After a partition has been made. you may want to format it using mkfs command. you could use mkfs.ext3 depending on what type of partiition that you desired.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;            &lt;span style="font-size:78%;"&gt;mkfs.ext3 /dev/hdc1&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;After formating you may want to mount it to your linux box so that you could use it already&lt;br /&gt;&lt;/p&gt; &lt;p&gt;            &lt;span style="font-size:78%;"&gt;mount /dev/hdc1 /u01&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;or simply add it on your fstab so that you dont need to remount it everytime your system is restarted.&lt;br /&gt;&lt;/p&gt; &lt;/span&gt;&lt;span style="font-family: verdana;font-family:arial;" &gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114779898480842286?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/05/adding-additional-hard-drive-on-your.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114645526834701765</guid><pubDate>Mon, 01 May 2006 03:46:00 +0000</pubDate><atom:updated>2006-05-01T11:47:48.360+08:00</atom:updated><title>3-legged 'Transparent Proxy' firewall using IPFilter 4.1.8, Squid on Fedora Core 1</title><description>&lt;strong&gt; 3-legged 'Transparent Proxy' firewall using IPFilter 4.1.8, Squid on Fedora Core 1&lt;/strong&gt;&lt;br /&gt;Date: Oct 8, 2005&lt;br /&gt;by Jett Tayer &lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Download and install apt for Fedora Core 1&lt;br /&gt;# cd /usr/local/src&lt;br /&gt;# wget http://apt.sw.be/fedora/1/en/i386/dag/RPMS/apt-0.5.15cnc6-4.1.fc1.rf.i386.rpm&lt;br /&gt;# wget http://apt.sw.be/fedora/1/en/i386/dag/RPMS/apt-devel-0.5.15cnc6-4.1.fc1.rf.i386.rpm&lt;br /&gt;# rpm -ivh apt-0.5.15cnc6-4.1.fc1.rf.i386.rpm&lt;br /&gt;# rpm -ivh apt-devel-0.5.15cnc6-4.1.fc1.rf.i386.rpm&lt;br /&gt;Update your apt database&lt;br /&gt;# apt-get update&lt;br /&gt;Upgrade your packages&lt;br /&gt;# apt-get upgrade&lt;br /&gt;Upgrade the kernel&lt;br /&gt;# apt-get install kernel#2.4.22-1.2199.nptl kernel-source#2.4.22-1.2199.nptl&lt;br /&gt;Install some needed apps&lt;br /&gt;# apt-get install patch rpm-build&lt;br /&gt;Restart your machine and boot the newly installed kernel.&lt;br /&gt;Download and extract the Squid package.&lt;br /&gt;# apt-get install squid&lt;br /&gt;Configure Squid to do 'transparent proxying'&lt;br /&gt;# vi /etc/squid/squid.conf&lt;br /&gt;You will need to make at least the following changes in /etc/squid/squid.conf&lt;br /&gt;http_port 3128&lt;br /&gt;http_access deny to_localhost&lt;br /&gt;acl our_networks src 192.168.1.0/24 192.168.2.0/24&lt;br /&gt;http_access allow our_networks&lt;br /&gt;visible_hostname your.server.name.dom&lt;br /&gt;httpd_accel_host virtual&lt;br /&gt;httpd_accel_port 80&lt;br /&gt;httpd_accel_with_proxy on&lt;br /&gt;httpd_accel_uses_host_header on&lt;br /&gt;Fire up Squid!&lt;br /&gt;# service squid start&lt;br /&gt;Install Bind 9: Provide caching DNS service to LAN only&lt;br /&gt;# apt-get install bind bind-chroot&lt;br /&gt;# service named start&lt;br /&gt;Install IPFilter&lt;br /&gt;Download and extract ipfilter software package&lt;br /&gt;# wget http://coombs.anu.edu.au/~avalon/ip_fil4.1.8.tar.gz&lt;br /&gt;# gzip -cd ip_fil4.1.8.tar.gz  tar xvf -&lt;br /&gt;# cd ip_fil4.1.8&lt;br /&gt;Edit Makefile&lt;br /&gt;# vi Makefile&lt;br /&gt;look for the line,&lt;br /&gt;LINUXKERNEL=/usr/src/linux&lt;br /&gt;and change it to,&lt;br /&gt;LINUXKERNEL=/usr/src/linux-2.4&lt;br /&gt;Uncomment the following 3 lines&lt;br /&gt;STATETOP_CFLAGS=-DSTATETOP&lt;br /&gt;STATETOP_INC=&lt;br /&gt;STATETOP_INC=-I/usr/local/include&lt;br /&gt;and change the last line&lt;br /&gt;STATETOP_INC=-I/usr/local/include&lt;br /&gt;to&lt;br /&gt;STATETOP_INC=-I/usr/include&lt;br /&gt;Uncomment the following 2 lines&lt;br /&gt;STATETOP_LIB=-lncurses&lt;br /&gt;STATETOP_LIB=-L/usr/local/lib -lncurses&lt;br /&gt;and change the last line&lt;br /&gt;STATETOP_LIB=-L/usr/local/lib -lncurses&lt;br /&gt;to&lt;br /&gt;STATETOP_LIB=-L/usr/lib -lncurses&lt;br /&gt;Next look for the line&lt;br /&gt;POLICY=-DIPF_DEFAULT_PASS=FR_PASS&lt;br /&gt;and change it to&lt;br /&gt;POLICY=-DIPF_DEFAULT_PASS=FR_BLOCK&lt;br /&gt;Save the file&lt;br /&gt;# wq!&lt;br /&gt;Compile IPFilter&lt;br /&gt;# make linux&lt;br /&gt;# make install-linux&lt;br /&gt;Note:&lt;br /&gt;There will be errors about ipfilter.o not being found.&lt;br /&gt;Just copy ipfilter.o created in 'make-linux' command above in&lt;br /&gt;/usr/src/redhat/BUILD/ipfilter/lib/modules/2.4.22-1.2199.nptl/kernel/net/ipv4/&lt;br /&gt;then do a "make install-linux" again.&lt;br /&gt;Still there will be errors, but don't worry because ipfilter RPM file will&lt;br /&gt;be written in /usr/src/redhat/RPMS/i386. In that case just go directly&lt;br /&gt;to the location of IPFilter RPM file and install it manually.&lt;br /&gt;# cd /usr/src/redhat/RPMS/i386/&lt;br /&gt;# rpm -ivh ipfilter-4.1.8-1.i386.rpm&lt;br /&gt;IPFilter is now installed.&lt;br /&gt;Config file (/etc/ipf.conf)&lt;br /&gt;Here is my working ipf.conf for a 3-legged firewall&lt;br /&gt;############################&lt;br /&gt;### ipf.conf starts here ###&lt;br /&gt;#&lt;br /&gt;# $Linux ipf.conf 2005/07/17 16:15:55 tayer Exp $&lt;br /&gt;#&lt;br /&gt;# See /usr/share/ipfilter/examples for syntax and examples.&lt;br /&gt;# eth0 is connected to the Internet with ip address 10.10.10.1 which is part of&lt;br /&gt;# 10.10.10.0/24 network (not my real ip block of course!)&lt;br /&gt;# eth1 is connected to the private subnet 192.168.1.0/24, 192.168.1.1 is the IP of eth1&lt;br /&gt;# eth2 is connected to the private subnet 192.168.2.0/24, 192.168.2.1 is the IP of eth2&lt;br /&gt;# Filtering:&lt;br /&gt;block in all&lt;br /&gt;block out all&lt;br /&gt;block in quick on eth0 from 127.0.0.0/8 to any&lt;br /&gt;block in quick on eth0 from 192.168.0.0/16 to any&lt;br /&gt;block in quick on eth0 from 172.16.0.0/12 to any&lt;br /&gt;block in quick on eth0 from 10.0.0.0/8 to any&lt;br /&gt;block in quick on eth0 from 169.254.0.0/16 to any&lt;br /&gt;block in quick on eth0 from 223.0.0.0/8 to any&lt;br /&gt;block in quick on eth0 from 198.18.0.0/15 to any&lt;br /&gt;block in quick on eth0 from 197.0.0.0/8 to any&lt;br /&gt;block in quick on eth0 from 224.0.0.0/3 to any&lt;br /&gt;block out quick on eth0 from any to 127.0.0.0/8&lt;br /&gt;block out quick on eth0 from any to 192.168.0.0/16&lt;br /&gt;block out quick on eth0 from any to 172.16.0.0/12&lt;br /&gt;block out quick on eth0 from any to 10.0.0.0/8&lt;br /&gt;block out quick on eth0 from any to 169.254.0.0/16&lt;br /&gt;block out quick on eth0 from any to 223.0.0.0/8&lt;br /&gt;block out quick on eth0 from any to 198.18.0.0/15&lt;br /&gt;block out quick on eth0 from any to 197.0.0.0/8&lt;br /&gt;block out quick on eth0 from any to 224.0.0.0/3&lt;br /&gt;# What's these?? :)&lt;br /&gt;block in log quick on eth0 from any to 10.10.10.0&lt;br /&gt;block in log quick on eth0 from any to 10.10.10.255&lt;br /&gt;block in log quick on eth0 from any to 255.255.255.255&lt;br /&gt;##### Block a bunch of different nasty things. ############&lt;br /&gt;# That I don"t want to see in the log&lt;br /&gt;#&lt;br /&gt;# Block frags&lt;br /&gt;block in log quick on eth0 all with frags&lt;br /&gt;# Block short tcp packets&lt;br /&gt;block in log quick from any to any with ipopts&lt;br /&gt;block in log quick all with short&lt;br /&gt;# Block anything with special options&lt;br /&gt;block in log quick all with ipopts&lt;br /&gt;#&lt;br /&gt;# Log packets with BOTH ssrr and lsrr set&lt;br /&gt;log in all with opt lsrr,ssrr&lt;br /&gt;# block source routed packets&lt;br /&gt;block in log quick all with opt lsrr&lt;br /&gt;block in log quick all with opt ssrr&lt;br /&gt;# Block nmap OS fingerprint attempts&lt;br /&gt;# Log first occurrence of these so I can get their IP address&lt;br /&gt;block in log first quick on eth0 proto tcp from any to any flags FUP&lt;br /&gt;# Block public pings&lt;br /&gt;#block in log quick on eth0 proto icmp all&lt;br /&gt;# Allow loopback packets freely&lt;br /&gt;pass in quick on lo&lt;br /&gt;pass out quick on lo&lt;br /&gt;# Allow LAN packets freely&lt;br /&gt;# allow freely packets from 192.168.1.0/24 LAN&lt;br /&gt;pass in quick on eth1&lt;br /&gt;pass out quick on eth1&lt;br /&gt;# allow freely packets from 192.168.2.0/24 LAN&lt;br /&gt;pass in quick on eth2&lt;br /&gt;pass out quick on eth2&lt;br /&gt;# Allow incoming data channel for outgoing connections, reject&lt;br /&gt;# and log all incoming control connections&lt;br /&gt;pass out quick on eth0 proto tcp from any to any port = 21 flags S keep state&lt;br /&gt;# Allow SSH&lt;br /&gt;pass in on eth0 proto tcp from any to eth0/32 port = 22 flags S/SA keep state&lt;br /&gt;# Allow SMTP traffic&lt;br /&gt;#pass in on eth0 proto tcp from any to eth0/32 port = 25 flags S/SA keep state&lt;br /&gt;# Allow DNS traffic (tcp &amp;amp; axfr)&lt;br /&gt;#pass in on eth0 proto tcp from any to eth0/32 port = 53 flags S/SA keep state&lt;br /&gt;# Allow DNS traffic (udp)&lt;br /&gt;#pass in on eth0 proto udp from any to eth0/32 port = 53 keep state&lt;br /&gt;# Allow outside world to ping me (bad idea)&lt;br /&gt;#pass in on eth0 proto icmp from any to any icmp-type 8 code 0 keep state keep frags&lt;br /&gt;# Allow me to ping the outside world&lt;br /&gt;pass out quick proto icmp from any to any icmp-type 8 code 0 keep state keep frags&lt;br /&gt;# Allow all outgoing tcp traffic&lt;br /&gt;pass out on eth0 proto tcp all flags S/SA keep state&lt;br /&gt;# Allow all outgoing udp traffic&lt;br /&gt;pass out on eth0 proto udp all keep state&lt;br /&gt;#&lt;br /&gt;### ipf.conf ends here ###&lt;br /&gt;##########################&lt;br /&gt;Config file (/etc/ipnat.conf)&lt;br /&gt;Here is my working ipnat.conf for my 3-legged firewall&lt;br /&gt;### ipnat.conf starts here ###&lt;br /&gt;#&lt;br /&gt;map eth0 192.168.1.0/24 -&gt; 10.10.10.1/32 proxy port ftp ftp/tcp&lt;br /&gt;map eth0 192.168.1.0/24 -&gt; 10.10.10.1/32 portmap tcp/udp 40000:60000&lt;br /&gt;map eth0 192.168.1.0/24 -&gt; 10.10.10.1/32&lt;br /&gt;map eth0 192.168.2.0/24 -&gt; 10.10.10.1/32 proxy port ftp ftp/tcp&lt;br /&gt;map eth0 192.168.2.0/24 -&gt; 10.10.10.1/32 portmap tcp/udp 40000:60000&lt;br /&gt;map eth0 192.168.2.0/24 -&gt; 10.10.10.1/32&lt;br /&gt;#&lt;br /&gt;# Redirection is triggered for input packets.&lt;br /&gt;# For example, to redirect FTP connections through this box, to the local ftp&lt;br /&gt;# port, forcing them to connect through a proxy, you would use:&lt;br /&gt;#&lt;br /&gt;rdr eth0 0.0.0.0/0 port ftp -&gt; 127.0.0.1 port ftp&lt;br /&gt;#&lt;br /&gt;# squid transparent proxy&lt;br /&gt;rdr eth1 192.168.1.1/32 port 80 -&gt; 192.168.1.1 port 80&lt;br /&gt;rdr eth1 0.0.0.0/0 port 80 -&gt; 192.168.1.1 port 3128&lt;br /&gt;rdr eth1 192.168.2.1/32 port 80 -&gt; 192.168.2.1 port 80&lt;br /&gt;rdr eth1 0.0.0.0/0 port 80 -&gt; 192.168.2.1 port 3128&lt;br /&gt;#&lt;br /&gt;### ipnat.conf ends here ###&lt;br /&gt;Enable IP Forwarding:&lt;br /&gt;Add this line in /etc/sysctl.conf if not already there&lt;br /&gt;# echo "net.ipv4.ip_forward = 1" &gt;&gt; /etc/sysctl.conf&lt;br /&gt;Re-read /etc/sysctl.conf&lt;br /&gt;# sysctl -p&lt;br /&gt;Fire up IPFilter&lt;br /&gt;# service ipfilter start&lt;br /&gt;IPFilter admin commands&lt;br /&gt;Display a table of data detailing firewall performance,&lt;br /&gt;including how many packets have been passed or blocked.&lt;br /&gt;# ipfstat -hio&lt;br /&gt;To flush and load ipfilter rules&lt;br /&gt;# ipf -Fa -f /etc/ipf.conf&lt;br /&gt;To flush and load ipnat rules&lt;br /&gt;# ipnat -CF -f /etc/ipnat.conf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114645526834701765?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/05/3-legged-transparent-proxy-firewall.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114613577944963347</guid><pubDate>Thu, 27 Apr 2006 11:02:00 +0000</pubDate><atom:updated>2006-04-27T19:02:59.476+08:00</atom:updated><title>Basic Linux Commands</title><description>&lt;p class="head"&gt;BASIC LINUX COMMANDS&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;pre&gt;&lt;a href="http://www.ss64.com/bash/alias.html"&gt;alias&lt;/a&gt;    Create an alias&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/gawk.html"&gt;awk&lt;/a&gt;      Find and Replace text, database sort/validate/index&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/break.html"&gt;break&lt;/a&gt;    Exit from a loop&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/builtin.html"&gt;builtin&lt;/a&gt;  Run a shell builtin&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cal.html"&gt;cal&lt;/a&gt;      Display a calendar&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/case.html"&gt;case&lt;/a&gt;     Conditionally perform a command&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cat.html"&gt;cat&lt;/a&gt;      Display the contents of a file&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cd.html"&gt;cd&lt;/a&gt;       Change Directory&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cfdisk.html"&gt;cfdisk&lt;/a&gt;   Partition table manipulator for Linux&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/chgrp.html"&gt;chgrp&lt;/a&gt;    Change group ownership&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/chmod.html"&gt;chmod&lt;/a&gt;    Change access permissions&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/chown.html"&gt;chown&lt;/a&gt;    Change file owner and group&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/chroot.html"&gt;chroot&lt;/a&gt;   Run a command with a different root directory&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cksum.html"&gt;cksum&lt;/a&gt;    Print CRC checksum and byte counts&lt;br /&gt;clear    Clear terminal screen&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cmp.html"&gt;cmp&lt;/a&gt;      Compare two files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/comm.html"&gt;comm&lt;/a&gt;     Compare two sorted files line by line&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/command.html"&gt;command&lt;/a&gt;  Run a command - ignoring shell functions&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/continue.html"&gt;continue&lt;/a&gt; Resume the next iteration of a loop&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cp.html"&gt;cp&lt;/a&gt;       Copy one or more files to another location&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cron.html"&gt;cron&lt;/a&gt;     Daemon to execute scheduled commands&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/crontab.html"&gt;crontab&lt;/a&gt;  Schedule a command to run at a later time&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/csplit.html"&gt;csplit&lt;/a&gt;   Split a file into context-determined pieces&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/cut.html"&gt;cut&lt;/a&gt;      Divide a file into several parts&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/date.html"&gt;date&lt;/a&gt;     Display or change the date &amp;amp; time&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/dc.html"&gt;dc&lt;/a&gt;       Desk Calculator&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/dd.html"&gt;dd&lt;/a&gt;       Data Dump - Convert and copy a file&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/declare.html"&gt;declare&lt;/a&gt;  Declare variables and give them attributes&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/df.html"&gt;df&lt;/a&gt;       Display free disk space&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/diff.html"&gt;diff&lt;/a&gt;     Display the differences between two files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/diff3.html"&gt;diff3&lt;/a&gt;    Show differences among three files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/dir.html"&gt;dir&lt;/a&gt;      Briefly list directory contents&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/dircolours.html"&gt;dircolors&lt;/a&gt; Colour setup for `ls'&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/dirname.html"&gt;dirname&lt;/a&gt;  Convert a full pathname to just a path&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/dirs.html"&gt;dirs&lt;/a&gt;     Display list of remembered directories&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/du.html"&gt;du&lt;/a&gt;       Estimate file space usage&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/echo.html"&gt;echo&lt;/a&gt;     Display message on screen&lt;br /&gt;ed       A line-oriented text editor (edlin)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/egrep.html"&gt;egrep&lt;/a&gt;    Search file(s) for lines that match an extended expression&lt;br /&gt;eject    Eject CD-ROM&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/enable.html"&gt;enable&lt;/a&gt;   Enable and disable builtin shell commands&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/env.html"&gt;env&lt;/a&gt;      Display, set, or remove environment variables&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/eval.html"&gt;eval&lt;/a&gt;     Evaluate several commands/arguments&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/exec.html"&gt;exec&lt;/a&gt;     Execute a command&lt;br /&gt;exit     Exit the shell&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/expand.html"&gt;expand&lt;/a&gt;   Convert tabs to spaces&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/export.html"&gt;export&lt;/a&gt;   Set an environment variable&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/expr.html"&gt;expr&lt;/a&gt;     Evaluate expressions&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/factor.html"&gt;factor&lt;/a&gt;   Print prime factors&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/false.html"&gt;false&lt;/a&gt;    Do nothing, unsuccessfully&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/fdformat.html"&gt;fdformat&lt;/a&gt; Low-level format a floppy disk&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/fdisk.html"&gt;fdisk&lt;/a&gt;    Partition table manipulator for Linux&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/fgrep.html"&gt;fgrep&lt;/a&gt;    Search file(s) for lines that match a fixed string&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/find.html"&gt;find&lt;/a&gt;     Search for files that meet a desired criteria&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/fmt.html"&gt;fmt&lt;/a&gt;      Reformat paragraph text&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/fold.html"&gt;fold&lt;/a&gt;     Wrap text to fit a specified width.&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/for.html"&gt;for&lt;/a&gt;      Expand &lt;var&gt;words&lt;/var&gt;, and execute &lt;var&gt;commands&lt;/var&gt;&lt;br /&gt;format   Format disks or tapes&lt;br /&gt;free     Display memory usage&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/fsck.html"&gt;fsck&lt;/a&gt;     Filesystem consistency check and repair.&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/function.html"&gt;function&lt;/a&gt; Define Function Macros&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/gawk.html"&gt;gawk&lt;/a&gt;     Find and Replace text within file(s)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/getopts.html"&gt;getopts&lt;/a&gt;  Parse positional parameters&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/grep.html"&gt;grep&lt;/a&gt;     Search file(s) for lines that match a given pattern&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/groups.html"&gt;groups&lt;/a&gt;   Print group names a user is in&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/gzip.html"&gt;gzip&lt;/a&gt;     Compress or decompress named file(s)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/hash.html"&gt;hash&lt;/a&gt;     Remember the full pathname of a name argument&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/head.html"&gt;head&lt;/a&gt;     Output the first part of file(s)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/history.html"&gt;history&lt;/a&gt;  Command History&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/hostname.html"&gt;hostname&lt;/a&gt; Print or set system name&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/id.html"&gt;id&lt;/a&gt;       Print user and group id's&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/if.html"&gt;if&lt;/a&gt;       Conditionally perform a command&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/import.html"&gt;import&lt;/a&gt;   Capture an X server screen and save the image to file&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/man.html"&gt;info&lt;/a&gt;     Help info&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/install.html"&gt;install&lt;/a&gt;  Copy files and set attributes&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/join.html"&gt;join&lt;/a&gt;     Join lines on a common field&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/kill.html"&gt;kill&lt;/a&gt;     Stop a process from running&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/less.html"&gt;less&lt;/a&gt;     Display output one screen at a time&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/let.html"&gt;let&lt;/a&gt;      Perform arithmetic on shell variables&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/ln.html"&gt;ln&lt;/a&gt;       Make links between files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/local.html"&gt;local&lt;/a&gt;    Create variables&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/locate.html"&gt;locate&lt;/a&gt;   Find files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/logname.html"&gt;logname&lt;/a&gt;  Print current login name&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/logout.html"&gt;logout&lt;/a&gt;   Exit a login shell&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/lpc.html"&gt;lpc&lt;/a&gt;      Line printer control program&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/lpr.html"&gt;lpr&lt;/a&gt;      Off line print&lt;br /&gt;lprint   Print a file&lt;br /&gt;lprintd  Abort a print job&lt;br /&gt;lprintq  List the print queue&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/lprm.html"&gt;lprm&lt;/a&gt;     Remove jobs from the print queue&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/ls.html"&gt;ls&lt;/a&gt;       List information about file(s)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/m4.html"&gt;m4&lt;/a&gt;       Macro processor&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/man.html"&gt;man&lt;/a&gt;      Help manual&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/mkdir.html"&gt;mkdir&lt;/a&gt;    Create new folder(s)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/mkfifo.html"&gt;mkfifo&lt;/a&gt;   Make FIFOs (named pipes)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/mknod.html"&gt;mknod&lt;/a&gt;    Make block or character special files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/more.html"&gt;more&lt;/a&gt;     Display output one screen at a time&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/mount.html"&gt;mount&lt;/a&gt;    Mount a file system&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/mtools.html"&gt;mtools&lt;/a&gt;   Manipulate MS-DOS files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/mv.html"&gt;mv&lt;/a&gt;       Move or rename files or directories&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/nice.html"&gt;nice&lt;/a&gt;     Set the priority of a command or job&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/nl.html"&gt;nl&lt;/a&gt;       Number lines and write files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/nohup.html"&gt;nohup&lt;/a&gt;    Run a command immune to hangups&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/passwd.html"&gt;passwd&lt;/a&gt;   Modify a user password&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/paste.html"&gt;paste&lt;/a&gt;    Merge lines of files&lt;br /&gt;pathchk  Check file name portability&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/popd.html"&gt;popd&lt;/a&gt;     Restore the previous value of the current directory&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/pr.html"&gt;pr&lt;/a&gt;       Convert text files for printing&lt;br /&gt;printcap Printer capability database&lt;br /&gt;printenv Print environment variables&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/printf.html"&gt;printf&lt;/a&gt;   Format and print data&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/ps.html"&gt;ps&lt;/a&gt;       Process status&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/pushd.html"&gt;pushd&lt;/a&gt;    Save and then change the current directory&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/pwd.html"&gt;pwd&lt;/a&gt;      Print Working Directory&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/quota.html"&gt;quota&lt;/a&gt;    Display disk usage and limits&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/quotacheck.html"&gt;quotacheck&lt;/a&gt; Scan a file system for disk usage&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/quotactl.html"&gt;quotactl&lt;/a&gt; Set disk quotas&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/ram.html"&gt;ram&lt;/a&gt;      ram disk device&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/rcp.html"&gt;rcp&lt;/a&gt;      Copy files between two machines.&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/read.html"&gt;read&lt;/a&gt;     read a line from standard input&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/readonly.html"&gt;readonly&lt;/a&gt; Mark variables/functions as readonly&lt;br /&gt;remsync  Synchronize remote files via email&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/return.html"&gt;return&lt;/a&gt;   Exit a shell function&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/rm.html"&gt;rm&lt;/a&gt;       Remove files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/rmdir.html"&gt;rmdir&lt;/a&gt;    Remove folder(s)&lt;br /&gt;&lt;a href="http://www.rpm.org/"&gt;rpm&lt;/a&gt;      Remote Package Manager&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/rsync.html"&gt;rsync&lt;/a&gt;    Remote file copy (Synchronize file trees)&lt;br /&gt;&lt;br /&gt;screen   Terminal window manager&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/sdiff.html"&gt;sdiff&lt;/a&gt;    Merge two files interactively&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/sed.html"&gt;sed&lt;/a&gt;      Stream Editor&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/select.html"&gt;select&lt;/a&gt;   Accept keyboard input&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/seq.html"&gt;seq&lt;/a&gt;      Print numeric sequences&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/set.html"&gt;set&lt;/a&gt;      Manipulate shell variables and functions&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/shift.html"&gt;shift&lt;/a&gt;    Shift positional parameters&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/shopt.html"&gt;shopt&lt;/a&gt;    Shell Options&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/shutdown.html"&gt;shutdown&lt;/a&gt; Shutdown or restart linux&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/sleep.html"&gt;sleep&lt;/a&gt;    Delay for a specified time&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/sort.html"&gt;sort&lt;/a&gt;     Sort text files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/period.html"&gt;source&lt;/a&gt;   Run commands from a file `.'&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/split.html"&gt;split&lt;/a&gt;    Split a file into fixed-size pieces&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/su.html"&gt;su&lt;/a&gt;       Substitute user identity&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/sum.html"&gt;sum&lt;/a&gt;      Print a checksum for a file&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/symlink.html"&gt;symlink&lt;/a&gt;  Make a new name for a file&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/sync.html"&gt;sync&lt;/a&gt;     Synchronize data on disk with memory&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tac.html"&gt;tac&lt;/a&gt;      Concatenate and write files in reverse&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tail.html"&gt;tail&lt;/a&gt;     Output the last part of files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tar.html"&gt;tar&lt;/a&gt;      Tape ARchiver&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tee.html"&gt;tee&lt;/a&gt;      Redirect output to multiple files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/test.html"&gt;test&lt;/a&gt;     Evaluate a conditional expression&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/time.html"&gt;time&lt;/a&gt;     Measure Program Resource Use&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/times.html"&gt;times&lt;/a&gt;    User and system times&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/touch.html"&gt;touch&lt;/a&gt;    Change file timestamps&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/top.html"&gt;top&lt;/a&gt;      List processes running on the system&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/traceroute.html"&gt;traceroute&lt;/a&gt; Trace Route to Host&lt;br /&gt;trap     Run a command when a signal is set(bourne)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tr.html"&gt;tr&lt;/a&gt;       Translate, squeeze, and/or delete characters&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/true.html"&gt;true&lt;/a&gt;     Do nothing, successfully&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tsort.html"&gt;tsort&lt;/a&gt;    Topological sort&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/tty.html"&gt;tty&lt;/a&gt;      Print filename of terminal on stdin&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/type.html"&gt;type&lt;/a&gt;     Describe a command&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/ulimit.html"&gt;ulimit&lt;/a&gt;   Limit user resources&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/umask.html"&gt;umask&lt;/a&gt;    Users file creation mask&lt;br /&gt;umount   Unmount a device&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/alias.html"&gt;unalias&lt;/a&gt;  Remove an alias&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/uname.html"&gt;uname&lt;/a&gt;    Print system information&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/unexpand.html"&gt;unexpand&lt;/a&gt; Convert spaces to tabs&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/uniq.html"&gt;uniq&lt;/a&gt;     Uniquify files&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/units.html"&gt;units&lt;/a&gt;    Convert units from one scale to another&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/unset.html"&gt;unset&lt;/a&gt;    Remove variable or function names&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/unshar.html"&gt;unshar&lt;/a&gt;   Unpack shell archive scripts&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/until.html"&gt;until&lt;/a&gt;    Execute commands (until error)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/useradd.html"&gt;useradd&lt;/a&gt;  Create new user account&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/usermod.html"&gt;usermod&lt;/a&gt;  Modify user account&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/users.html"&gt;users&lt;/a&gt;    List users currently logged in&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/uuencode.html"&gt;uuencode&lt;/a&gt; Encode a binary file&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/uuencode.html"&gt;uudecode&lt;/a&gt; Decode a file created by uuencode&lt;br /&gt;&lt;br /&gt;v        Verbosely list directory contents (`ls -l -b')&lt;br /&gt;vdir     Verbosely list directory contents (`ls -l -b')&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/watch.html"&gt;watch&lt;/a&gt;    Execute/display a program periodically&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/wc.html"&gt;wc&lt;/a&gt;       Print byte, word, and line counts&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/whereis.html"&gt;whereis&lt;/a&gt;  Report all known instances of a command   &lt;br /&gt;&lt;a href="http://www.ss64.com/bash/which.html"&gt;which&lt;/a&gt;    Locate a program file in the user's path.&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/while.html"&gt;while&lt;/a&gt;    Execute commands&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/who.html"&gt;who&lt;/a&gt;      Print all usernames currently logged in&lt;br /&gt;whoami   Print the current user id and name (`id -un')&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/xargs.html"&gt;xargs&lt;/a&gt;    Execute utility, passing constructed argument list(s)&lt;br /&gt;&lt;a href="http://www.ss64.com/bash/yes.html"&gt;yes&lt;/a&gt;      Print a string until interrupted&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114613577944963347?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/basic-linux-commands.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114589107356231186</guid><pubDate>Mon, 24 Apr 2006 14:31:00 +0000</pubDate><atom:updated>2006-04-24T23:04:33.606+08:00</atom:updated><title>Mirror Your Web Site With rsync</title><description>&lt;h2&gt;Mirror Your Web Site With rsync&lt;br /&gt;&lt;/h2&gt; &lt;p&gt;Version 1.0&lt;br /&gt;Author: Falko Timme&lt;br /&gt;Last edited 04/20/2006&lt;br /&gt;&lt;/p&gt; &lt;p&gt;This tutorial shows how you can mirror your web site from your main web server to a backup server that can take over if the main server fails. We use the tool &lt;span class="system"&gt;rsync&lt;/span&gt; for this, and we make it run through a cron job that checks every &lt;span class="system"&gt;x&lt;/span&gt; minutes if there is something to update on the mirror. Thus your backup server should usually be up to date if it has to take over.&lt;/p&gt; &lt;p&gt;&lt;span class="system"&gt;rsync&lt;/span&gt; updates only files that have changed, so you do not need to transfer 5 GB of data whenever you run &lt;span class="system"&gt;rsync&lt;/span&gt;. It only mirrors new/changed files, and it can also delete files from the mirror that have been deleted on the main server. In addition to that it can preserve permissions and ownerships of mirrored files and directories; to preserve the ownerships, we need to run &lt;span class="system"&gt;rsync&lt;/span&gt; as root which is what we do here. If permissions and/or ownerships change on the main server, &lt;span class="system"&gt;rsync&lt;/span&gt; will also change them on the backup server.&lt;/p&gt; &lt;p&gt;In this tutorial we will tunnel &lt;span class="system"&gt;rsync&lt;/span&gt; through SSH which is more secure; it also means you do not have to open another port in your firewall for &lt;span class="system"&gt;rsync&lt;/span&gt; - it is enough if port 22 (SSH) is open.    The problem is that SSH requires a password for logging in which is not good if you want to run &lt;span class="system"&gt;rsync&lt;/span&gt; as a cron job. The need for a password requires human interaction which is not what we want. &lt;/p&gt; &lt;p&gt;But fortunately there is a solution: the use of &lt;strong&gt;public keys&lt;/strong&gt;. We create a pair of keys (on our backup server &lt;em class="system"&gt;mirror.example.com&lt;/em&gt;), one of which is saved in a file on the remote system (&lt;em class="system"&gt;server1.example.com&lt;/em&gt;). Afterwards we will not be prompted for a password anymore when we run &lt;span class="system"&gt;rsync&lt;/span&gt;. This also includes cron jobs which is exactly what we want. &lt;/p&gt; &lt;p&gt;As you might have guessed already from what I have written so far, the concept is that we initiate the mirroring of &lt;em class="system"&gt;server1.example.com &lt;/em&gt; directly from &lt;em class="system"&gt;mirror.example.com&lt;/em&gt;; &lt;em class="system"&gt;server1.example.com &lt;/em&gt; does not have to do anything to get mirrored.&lt;/p&gt; &lt;p&gt;I will use the following setup here:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Main server: &lt;span class="system"&gt;server1.example.com &lt;/span&gt;(&lt;span class="system"&gt;server1&lt;/span&gt;)  - IP address: &lt;span class="system"&gt;192.168.0.100&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Mirror/backup server: &lt;span class="system"&gt;mirror.example.com&lt;/span&gt; (&lt;span class="system"&gt;mirror&lt;/span&gt;) - IP address: &lt;span class="system"&gt;192.168.0.175&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The web site that is to be mirrored is in &lt;span class="system"&gt;/var/www&lt;/span&gt; on &lt;span class="system"&gt;server1.example.com.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;span class="system"&gt;rsync&lt;/span&gt; is for mirroring files and directories only; if you want to mirror your MySQL database, please take a look at these tutorials:&lt;/p&gt; &lt;ul&gt;&lt;li&gt; &lt;a href="http://www.howtoforge.com/mysql_database_replication"&gt;How To Set Up Database Replication In MySQL&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.howtoforge.com/loadbalanced_mysql_cluster_debian"&gt; How To Set Up A Load-Balanced MySQL Cluster    &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;h3&gt;1 Install rsync&lt;/h3&gt; &lt;p&gt;First we have to install &lt;span class="system"&gt;rsync&lt;/span&gt; on both &lt;span class="system"&gt;server1.example.com&lt;/span&gt; and &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;. For Debian systems, this looks like this:&lt;/p&gt; &lt;p class="highlight"&gt;server1/mirror:&lt;/p&gt; &lt;p&gt;(We do this as root!) &lt;/p&gt; &lt;p class="command"&gt;apt-get install rsync&lt;/p&gt; &lt;p&gt;On other Linux distributions you would use &lt;span class="system"&gt;yum&lt;/span&gt; (Fedora/CentOS) or &lt;span class="system"&gt;yast&lt;/span&gt; (SuSE) to install &lt;span class="system"&gt;rsync&lt;/span&gt;. &lt;/p&gt; &lt;p&gt;   &lt;/p&gt; &lt;h3&gt;2 Create An Unprivileged User On server1.example.com&lt;/h3&gt; &lt;p&gt;Now we create an unprivileged user called &lt;span class="system"&gt;someuser&lt;/span&gt; on &lt;span class="system"&gt;server1.example.com&lt;/span&gt; that will be used by &lt;span class="system"&gt;rsync&lt;/span&gt; on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt; to mirror the directory &lt;span class="system"&gt;/var/www&lt;/span&gt; (of course, &lt;span class="system"&gt;someuser&lt;/span&gt; must have read permissions on &lt;span class="system"&gt;/var/www&lt;/span&gt; on &lt;span class="system"&gt;server1.example.com&lt;/span&gt;).&lt;/p&gt; &lt;p class="highlight"&gt;server1:&lt;/p&gt; &lt;p&gt;(We do this as root!)&lt;/p&gt; &lt;p class="command"&gt;useradd -d /home/someuser -m -s /bin/bash someuser &lt;/p&gt; &lt;p&gt;This will create the user &lt;span class="system"&gt;someuser&lt;/span&gt; with the home directory &lt;span class="system"&gt;/home/someuser&lt;/span&gt; and the login shell &lt;span class="system"&gt;/bin/bash&lt;/span&gt; (it is important that &lt;span class="system"&gt;someuser&lt;/span&gt; has a valid login shell - something like &lt;span class="system"&gt;/bin/false&lt;/span&gt; does not work!). Now give &lt;span class="system"&gt;someuser&lt;/span&gt; a password:&lt;/p&gt; &lt;p class="command"&gt;passwd someuser &lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;h3&gt;3 Test rsync&lt;/h3&gt; &lt;p&gt;Next we test&lt;span class="system"&gt; rsync&lt;/span&gt; on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;. As root we do this:&lt;/p&gt; &lt;p class="highlight"&gt;mirror:&lt;/p&gt; &lt;p class="command"&gt;rsync -avz -e ssh someuser@server1.example.com:/var/www/ /var/www/  &lt;/p&gt; &lt;p&gt;You should see something like this. Answer with &lt;span class="system"&gt;yes&lt;/span&gt;:&lt;/p&gt; &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;       &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;The authenticity of host 'server1.example.com (192.168.0.100)' can't be established.&lt;br /&gt;RSA key fingerprint is 32:e5:79:8e:5f:5a:25:a9:f1:0d:ef:be:5b:a6:a6:23.&lt;br /&gt;Are you sure you want to continue connecting (yes/no)?&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p class="system"&gt;&lt;-- yes&lt;/p&gt; &lt;p&gt;Then enter &lt;span class="system"&gt;someuser&lt;/span&gt;'s password, and you should see that &lt;span class="system"&gt;server1.example.com&lt;/span&gt;'s &lt;span class="system"&gt;/var/www&lt;/span&gt; directory is mirrored to &lt;span class="system"&gt;/var/www&lt;/span&gt; on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;. &lt;/p&gt; &lt;p&gt;You can check that like this on both servers:&lt;/p&gt; &lt;p class="highlight"&gt;server1/mirror:&lt;/p&gt; &lt;p class="command"&gt;ls -la /var/www  &lt;/p&gt; &lt;p&gt;You should see that all files and directories have been mirrored to &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;, and the files and directories should have the same permissions/ownerships as on &lt;span class="system"&gt;server1.example.com&lt;/span&gt;. &lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;h3&gt;4 Create The Keys On mirror.example.com&lt;/h3&gt; &lt;p&gt;Now we create the private/public key pair on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;:&lt;/p&gt; &lt;p class="highlight"&gt;mirror:&lt;/p&gt; &lt;p&gt;(We do this as root!)&lt;/p&gt; &lt;p class="command"&gt;mkdir /root/rsync&lt;br /&gt;ssh-keygen -t dsa -b 2048 -f /root/rsync/mirror-rsync-key  &lt;/p&gt; &lt;p&gt;You will see something like this:&lt;/p&gt; &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;       &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;Generating public/private dsa key pair.&lt;br /&gt;Enter passphrase (empty for no passphrase): [press enter here]&lt;br /&gt;Enter same passphrase again: [press enter here]&lt;br /&gt;Your identification has been saved in /root/cron/mirror-rsync-key.&lt;br /&gt;Your public key has been saved in /root/cron/mirror-rsync-key.pub.&lt;br /&gt;The key fingerprint is:&lt;br /&gt;68:95:35:44:91:f1:45:a4:af:3f:69:2a:ea:c5:4e:d7 root@mirror&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; It is important that you do not enter a passphrase otherwise the mirroring will not work without human interaction so simply hit &lt;em class="system"&gt;enter&lt;/em&gt;!&lt;/p&gt; &lt;p&gt;Next, we copy our public key to &lt;span class="system"&gt;server1.example.com&lt;/span&gt;:&lt;/p&gt; &lt;p class="highlight"&gt;mirror:&lt;/p&gt; &lt;p&gt;(Still, we do this as root.)&lt;/p&gt; &lt;p class="command"&gt;scp /root/rsync/mirror-rsync-key.pub someuser@server1.example.com:/home/someuser/  &lt;/p&gt; &lt;p&gt;The public key &lt;span class="system"&gt;mirror-rsync-key.pub &lt;/span&gt;should now be available in&lt;span class="system"&gt; /home/someuser &lt;/span&gt;on&lt;span class="system"&gt; server1.example.com. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114589107356231186?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/mirror-your-web-site-with-rsync_24.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114589051708626613</guid><pubDate>Mon, 24 Apr 2006 14:31:00 +0000</pubDate><atom:updated>2006-04-24T22:55:17.123+08:00</atom:updated><title>Mirror Your Web Site With rsync</title><description>&lt;h2&gt;Mirror Your Web Site With rsync&lt;br /&gt;&lt;/h2&gt; &lt;p&gt;Version 1.0&lt;br /&gt;  Author: Falko Timme&lt;br /&gt;  Last edited 04/20/2006&lt;br /&gt;&lt;/p&gt; &lt;p&gt;This tutorial shows how you can mirror your web site from your main web server to a backup server that can take over if the main server fails. We use the tool &lt;span class="system"&gt;rsync&lt;/span&gt; for this, and we make it run through a cron job that checks every &lt;span class="system"&gt;x&lt;/span&gt; minutes if there is something to update on the mirror. Thus your backup server should usually be up to date if it has to take over.&lt;/p&gt; &lt;p&gt;&lt;span class="system"&gt;rsync&lt;/span&gt; updates only files that have changed, so you do not need to transfer 5 GB of data whenever you run &lt;span class="system"&gt;rsync&lt;/span&gt;. It only mirrors new/changed files, and it can also delete files from the mirror that have been deleted on the main server. In addition to that it can preserve permissions and ownerships of mirrored files and directories; to preserve the ownerships, we need to run &lt;span class="system"&gt;rsync&lt;/span&gt; as root which is what we do here. If permissions and/or ownerships change on the main server, &lt;span class="system"&gt;rsync&lt;/span&gt; will also change them on the backup server.&lt;/p&gt; &lt;p&gt;In this tutorial we will tunnel &lt;span class="system"&gt;rsync&lt;/span&gt; through SSH which is more secure; it also means you do not have to open another port in your firewall for &lt;span class="system"&gt;rsync&lt;/span&gt; - it is enough if port 22 (SSH) is open.    The problem is that SSH requires a password for logging in which is not good if you want to run &lt;span class="system"&gt;rsync&lt;/span&gt; as a cron job. The need for a password requires human interaction which is not what we want. &lt;/p&gt; &lt;p&gt;But fortunately there is a solution: the use of &lt;strong&gt;public keys&lt;/strong&gt;. We create a pair of keys (on our backup server &lt;em class="system"&gt;mirror.example.com&lt;/em&gt;), one of which is saved in a file on the remote system (&lt;em class="system"&gt;server1.example.com&lt;/em&gt;). Afterwards we will not be prompted for a password anymore when we run &lt;span class="system"&gt;rsync&lt;/span&gt;. This also includes cron jobs which is exactly what we want. &lt;/p&gt; &lt;p&gt;As you might have guessed already from what I have written so far, the concept is that we initiate the mirroring of &lt;em class="system"&gt;server1.example.com &lt;/em&gt; directly from &lt;em class="system"&gt;mirror.example.com&lt;/em&gt;; &lt;em class="system"&gt;server1.example.com &lt;/em&gt; does not have to do anything to get mirrored.&lt;/p&gt; &lt;p&gt;I will use the following setup here:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Main server: &lt;span class="system"&gt;server1.example.com &lt;/span&gt;(&lt;span class="system"&gt;server1&lt;/span&gt;)  - IP address: &lt;span class="system"&gt;192.168.0.100&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Mirror/backup server: &lt;span class="system"&gt;mirror.example.com&lt;/span&gt; (&lt;span class="system"&gt;mirror&lt;/span&gt;) - IP address: &lt;span class="system"&gt;192.168.0.175&lt;/span&gt;&lt;/li&gt;&lt;li&gt;The web site that is to be mirrored is in &lt;span class="system"&gt;/var/www&lt;/span&gt; on &lt;span class="system"&gt;server1.example.com.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;span class="system"&gt;rsync&lt;/span&gt; is for mirroring files and directories only; if you want to mirror your MySQL database, please take a look at these tutorials:&lt;/p&gt; &lt;ul&gt;&lt;li&gt; &lt;a href="http://www.howtoforge.com/mysql_database_replication"&gt;How To Set Up Database Replication In MySQL&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.howtoforge.com/loadbalanced_mysql_cluster_debian"&gt; How To Set Up A Load-Balanced MySQL Cluster    &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;h3&gt;1 Install rsync&lt;/h3&gt; &lt;p&gt;First we have to install &lt;span class="system"&gt;rsync&lt;/span&gt; on both &lt;span class="system"&gt;server1.example.com&lt;/span&gt; and &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;. For Debian systems, this looks like this:&lt;/p&gt; &lt;p class="highlight"&gt;server1/mirror:&lt;/p&gt; &lt;p&gt;(We do this as root!) &lt;/p&gt; &lt;p class="command"&gt;apt-get install rsync&lt;/p&gt; &lt;p&gt;On other Linux distributions you would use &lt;span class="system"&gt;yum&lt;/span&gt; (Fedora/CentOS) or &lt;span class="system"&gt;yast&lt;/span&gt; (SuSE) to install &lt;span class="system"&gt;rsync&lt;/span&gt;. &lt;/p&gt; &lt;p&gt;   &lt;/p&gt; &lt;h3&gt;2 Create An Unprivileged User On server1.example.com&lt;/h3&gt; &lt;p&gt;Now we create an unprivileged user called &lt;span class="system"&gt;someuser&lt;/span&gt; on &lt;span class="system"&gt;server1.example.com&lt;/span&gt; that will be used by &lt;span class="system"&gt;rsync&lt;/span&gt; on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt; to mirror the directory &lt;span class="system"&gt;/var/www&lt;/span&gt; (of course, &lt;span class="system"&gt;someuser&lt;/span&gt; must have read permissions on &lt;span class="system"&gt;/var/www&lt;/span&gt; on &lt;span class="system"&gt;server1.example.com&lt;/span&gt;).&lt;/p&gt; &lt;p class="highlight"&gt;server1:&lt;/p&gt; &lt;p&gt;(We do this as root!)&lt;/p&gt; &lt;p class="command"&gt;useradd -d /home/someuser -m -s /bin/bash someuser &lt;/p&gt; &lt;p&gt;This will create the user &lt;span class="system"&gt;someuser&lt;/span&gt; with the home directory &lt;span class="system"&gt;/home/someuser&lt;/span&gt; and the login shell &lt;span class="system"&gt;/bin/bash&lt;/span&gt; (it is important that &lt;span class="system"&gt;someuser&lt;/span&gt; has a valid login shell - something like &lt;span class="system"&gt;/bin/false&lt;/span&gt; does not work!). Now give &lt;span class="system"&gt;someuser&lt;/span&gt; a password:&lt;/p&gt; &lt;p class="command"&gt;passwd someuser &lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;h3&gt;3 Test rsync&lt;/h3&gt; &lt;p&gt;Next we test&lt;span class="system"&gt; rsync&lt;/span&gt; on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;. As root we do this:&lt;/p&gt; &lt;p class="highlight"&gt;mirror:&lt;/p&gt; &lt;p class="command"&gt;rsync -avz -e ssh someuser@server1.example.com:/var/www/ /var/www/  &lt;/p&gt; &lt;p&gt;You should see something like this. Answer with &lt;span class="system"&gt;yes&lt;/span&gt;:&lt;/p&gt; &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;       &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;The authenticity of host 'server1.example.com (192.168.0.100)' can't be established.&lt;br /&gt;RSA key fingerprint is 32:e5:79:8e:5f:5a:25:a9:f1:0d:ef:be:5b:a6:a6:23.&lt;br /&gt;Are you sure you want to continue connecting (yes/no)?&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p class="system"&gt;&lt;-- yes&lt;/p&gt; &lt;p&gt;Then enter &lt;span class="system"&gt;someuser&lt;/span&gt;'s password, and you should see that &lt;span class="system"&gt;server1.example.com&lt;/span&gt;'s &lt;span class="system"&gt;/var/www&lt;/span&gt; directory is mirrored to &lt;span class="system"&gt;/var/www&lt;/span&gt; on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;. &lt;/p&gt; &lt;p&gt;You can check that like this on both servers:&lt;/p&gt; &lt;p class="highlight"&gt;server1/mirror:&lt;/p&gt; &lt;p class="command"&gt;ls -la /var/www  &lt;/p&gt; &lt;p&gt;You should see that all files and directories have been mirrored to &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;, and the files and directories should have the same permissions/ownerships as on &lt;span class="system"&gt;server1.example.com&lt;/span&gt;. &lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;h3&gt;4 Create The Keys On mirror.example.com&lt;/h3&gt; &lt;p&gt;Now we create the private/public key pair on &lt;span class="system"&gt;mirror.example.com&lt;/span&gt;:&lt;/p&gt; &lt;p class="highlight"&gt;mirror:&lt;/p&gt; &lt;p&gt;(We do this as root!)&lt;/p&gt; &lt;p class="command"&gt;mkdir /root/rsync&lt;br /&gt;ssh-keygen -t dsa -b 2048 -f /root/rsync/mirror-rsync-key  &lt;/p&gt; &lt;p&gt;You will see something like this:&lt;/p&gt; &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;       &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;Generating public/private dsa key pair.&lt;br /&gt;Enter passphrase (empty for no passphrase): [press enter here]&lt;br /&gt;Enter same passphrase again: [press enter here]&lt;br /&gt;Your identification has been saved in /root/cron/mirror-rsync-key.&lt;br /&gt;Your public key has been saved in /root/cron/mirror-rsync-key.pub.&lt;br /&gt;The key fingerprint is:&lt;br /&gt;68:95:35:44:91:f1:45:a4:af:3f:69:2a:ea:c5:4e:d7 root@mirror&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; It is important that you do not enter a passphrase otherwise the mirroring will not work without human interaction so simply hit &lt;em class="system"&gt;enter&lt;/em&gt;!&lt;/p&gt; &lt;p&gt;Next, we copy our public key to &lt;span class="system"&gt;server1.example.com&lt;/span&gt;:&lt;/p&gt; &lt;p class="highlight"&gt;mirror:&lt;/p&gt; &lt;p&gt;(Still, we do this as root.)&lt;/p&gt; &lt;p class="command"&gt;scp /root/rsync/mirror-rsync-key.pub someuser@server1.example.com:/home/someuser/  &lt;/p&gt; &lt;p&gt;The public key &lt;span class="system"&gt;mirror-rsync-key.pub &lt;/span&gt;should now be available in&lt;span class="system"&gt; /home/someuser &lt;/span&gt;on&lt;span class="system"&gt; server1.example.com. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114589051708626613?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/mirror-your-web-site-with-rsync.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114578025184461889</guid><pubDate>Sun, 23 Apr 2006 08:07:00 +0000</pubDate><atom:updated>2006-04-23T16:17:31.890+08:00</atom:updated><title>How To Set Up Database Replication In MySQL</title><description>&lt;!-- begin content --&gt; &lt;p&gt;  &lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:100%;"&gt;&lt;b&gt;How To Set Up Database Replication In MySQL &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Version 1.1&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Author: Falko Timme &lt;/span&gt;&lt;br /&gt;  &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Last edited: 01/14/2006&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;This tutorial describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases are in sync. This is not a backup policy because an accidentally issued DELETE command will also be carried out on the slave; but replication can help protect against hardware failures though. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;In this tutorial I will show how to replicate the database &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; from the master with the IP address &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;192.168.0.100&lt;/em&gt;&lt;/span&gt; to a slave. Both systems (master and slave) are running &lt;strong&gt;Debian Sarge&lt;/strong&gt;; however, the configuration should apply to almost all distributions with little or no modification. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Both systems have MySQL installed, and the database &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; with tables and data is already existing on the master, but not on the slave. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;I want to say first   that this is not the only way of setting up such a system. There are many ways   of achieving this goal but this is the way I take. I do not issue any guarantee   that this will work for you!&lt;/span&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h4&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:100%;"&gt;1 Configure The Master&lt;/span&gt;&lt;/h4&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;First we have to edit &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;/etc/mysql/my.cnf&lt;/em&gt;&lt;/span&gt;. We have to enable networking for MySQL, and MySQL should listen on all IP addresses, therefore we comment out these lines (if existant):&lt;/span&gt;&lt;/p&gt;  &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;        &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;#skip-networking&lt;br /&gt;#bind-address            = 127.0.0.1&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Furthermore we have to tell MySQL for which database it should write logs (these logs are used by the slave to see what has changed on the master), which log file it should use, and we have to specify that this MySQL server is the master. We want to replicate the database &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt;, so we put the following lines into &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;/etc/mysql/my.cnf&lt;/em&gt;&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;   &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;        &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;log-bin = /var/log/mysql/mysql-bin.log&lt;br /&gt;binlog-do-db=exampledb&lt;br /&gt;server-id=1&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Then we restart MySQL:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;/etc/init.d/mysql restart&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Then we log into the MySQL database as &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;root&lt;/em&gt;&lt;/span&gt; and create a user with replication privileges:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;mysql -u root -p&lt;br /&gt;Enter password:&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Now we are on the MySQL shell.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;For mysql  version 3.23 and below&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;GRANT LINE ON *.* TO 'slave_user'@'Host IP' IDENTIFIED BY '&lt;some_password&gt;'; &lt;/span&gt;&lt;/em&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;(Replace &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;some_password&gt;&lt;/em&gt;&lt;/span&gt; with a real password! and Host IP with ip adress or host.domainname will do)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt; &lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;For Mysql version 4 and up&lt;br /&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '&lt;some_password&gt;'; &lt;/span&gt;&lt;/em&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;(Replace &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;some_password&gt;&lt;/em&gt;&lt;/span&gt; with a real password!)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;&lt;br /&gt;  FLUSH PRIVILEGES;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;* you could also use grant all privileges although not recommended&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Next (still on the MySQL shell) do this:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;USE exampledb;&lt;br /&gt;  FLUSH TABLES WITH READ LOCK;&lt;br /&gt;SHOW MASTER STATUS;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;The last command will show something like this:&lt;/span&gt;&lt;/p&gt;  &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;        &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;+---------------+----------+--------------+------------------+&lt;br /&gt;| File          | Position | Binlog_do_db | Binlog_ignore_db |&lt;br /&gt;+---------------+----------+--------------+------------------+&lt;br /&gt;| mysql-bin.006 | 183      | exampledb    |                  |&lt;br /&gt;+---------------+----------+--------------+------------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Write down this information, we will need it later on the slave! &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Then leave the MySQL shell:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;&lt;em&gt;quit;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;hr /&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;There are two possibilities to get the existing tables and data from &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; from the master to the slave. The first one is to make a database dump, the second one is to use the&lt;/span&gt; &lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;&lt;em&gt;LOAD DATA FROM MASTER;&lt;/em&gt;&lt;/span&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;command on the slave. The latter has the disadvantage the the database on the master will be &lt;strong&gt;locked&lt;/strong&gt; during this operation, so if you have a large database on a high-traffic production system, this is not what you want, and I recommend to follow the first method in this case. However, the latter method is very fast, so I will describe both here. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;If you want to follow the first method, then do this:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;mysqldump -u root -p&lt;password&gt; --opt exampledb &gt; exampledb.sql &lt;/span&gt;&lt;/em&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;(Replace &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;password&gt;&lt;/em&gt;&lt;/span&gt; with the real password for the MySQL user &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;root&lt;/em&gt;&lt;/span&gt;! &lt;strong&gt;Important:&lt;/strong&gt; There is &lt;strong&gt;no&lt;/strong&gt; space between &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;-p&lt;/em&gt;&lt;/span&gt; and &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;password&gt;&lt;/em&gt;&lt;/span&gt;!) &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;This will create an SQL dump of &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; in the file &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb.sql&lt;/em&gt;&lt;/span&gt;. Transfer this file to your slave server! &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;If you want to go the &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;LOAD DATA FROM MASTER;&lt;/em&gt;&lt;/span&gt; way then there is nothing you must do right now. &lt;/span&gt;&lt;/p&gt;  &lt;hr /&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Finally we have to unlock the tables in &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;mysql -u root -p&lt;br /&gt;  Enter password:&lt;br /&gt;  UNLOCK TABLES;&lt;br /&gt;quit;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Now the configuration on the master is finished. On to the slave...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:100%;"&gt;&lt;strong&gt;2 Configure The Slave&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;On the slave we first have to create the database &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;mysql -u root -p&lt;br /&gt;  Enter password:&lt;br /&gt;  CREATE DATABASE exampledb;&lt;br /&gt;quit;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;hr /&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;If you have made an SQL dump of &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; on the master and have transferred it to the slave, then it is time now to import the SQL dump into our newly created &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; on the slave:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;mysql -u root -p&lt;password&gt; exampledb &lt; /path/to/exampledb.sql &lt;/span&gt;&lt;/em&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;(Replace &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;password&gt;&lt;/em&gt;&lt;/span&gt; with the real password for the MySQL user &lt;span style="font-family:Courier New, Courier, mono;"&gt;root&lt;/span&gt;! &lt;strong&gt;Important:&lt;/strong&gt; There is &lt;strong&gt;no&lt;/strong&gt; space between &lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;-p&lt;/span&gt;&lt;/em&gt; and &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;password&gt;&lt;/em&gt;&lt;/span&gt;!) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;If you want to go the &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;LOAD DATA FROM MASTER;&lt;/em&gt;&lt;/span&gt; way then there is nothing you must do right now. &lt;/span&gt;&lt;/p&gt;  &lt;hr /&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Now we have to tell MySQL on the slave that it is the slave, that the master is &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;192.168.0.100&lt;/em&gt;&lt;/span&gt;, and that the master database to watch is &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt;. Therefore we add the following lines to &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;/etc/mysql/my.cnf&lt;/em&gt;&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;  &lt;table align="center" bgcolor="#cccccc" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" width="90%"&gt;        &lt;tbody&gt;&lt;tr&gt;         &lt;td&gt;       &lt;pre&gt;server-id=2&lt;br /&gt;master-host=192.168.0.100&lt;br /&gt;master-user=slave_user&lt;br /&gt;master-password=secret&lt;br /&gt;master-connect-retry=60&lt;br /&gt;replicate-do-db=exampledb&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Then we restart MySQL:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;/etc/init.d/mysql restart&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;hr /&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;If you have not imported the master &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; with the help of an SQL dump, but want to go the &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;LOAD DATA FROM MASTER;&lt;/em&gt;&lt;/span&gt; way, then it is time for you now to get the data from the master &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;mysql -u root -p&lt;br /&gt;  Enter password:&lt;br /&gt;  LOAD DATA FROM MASTER;&lt;br /&gt;quit;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;If you have &lt;a target="_blank" href="http://www.phpmyadmin.net/"&gt;phpMyAdmin&lt;/a&gt; installed on the slave you can now check if all tables/data from the master &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; is also available on the slave &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt;.&lt;/span&gt; &lt;/p&gt;  &lt;hr /&gt; &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Finally, we must do this:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;mysql -u root -p&lt;br /&gt;  Enter password:&lt;br /&gt;SLAVE STOP;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;In the next command (still on the MySQL shell) you have to replace the values appropriately:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;CHANGE MASTER TO MASTER_HOST='192.168.0.100', MASTER_USER='slave_user', MASTER_PASSWORD='&lt;/span&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;&lt;some_password&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;', MASTER_LOG_FILE='mysql-bin.006', MASTER_LOG_POS=183;&lt;/span&gt;&lt;/em&gt; &lt;/span&gt;&lt;/p&gt;  &lt;ul&gt; &lt;li&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;MASTER_HOST&lt;/span&gt;&lt;/em&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;is the IP address or hostname of the master (in this example it is&lt;/span&gt; &lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;&lt;em&gt;192.168.0.100&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;). &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;MASTER_USER&lt;/span&gt;&lt;/em&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt; is the user we granted replication privileges on the master.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;MASTER_PASSWORD&lt;/span&gt;&lt;/em&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;is the password of&lt;/span&gt; &lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;&lt;em&gt;MASTER_USER&lt;/em&gt;&lt;/span&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;on the master.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;MASTER_LOG_FILE&lt;/span&gt;&lt;/em&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;is the file MySQL gave back when you ran&lt;/span&gt; &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;SHOW MASTER STATUS;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;on the master.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;&lt;span style="font-family:Courier New, Courier, mono;font-size:85%;"&gt;MASTER_LOG_POS&lt;/span&gt;&lt;/em&gt; &lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;is the position MySQL gave back when you ran&lt;/span&gt; &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;SHOW MASTER STATUS;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt; on the master.&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;Now all that is left to do is start the slave. Still on the MySQL shell we run&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;START SLAVE;&lt;br /&gt;quit;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"&gt;That's it! Now whenever &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; is updated on the master, all changes will be replicated to &lt;span style="font-family:Courier New, Courier, mono;"&gt;&lt;em&gt;exampledb&lt;/em&gt;&lt;/span&gt; on the slave. Test it!&lt;/span&gt; &lt;/p&gt;  &lt;p&gt;  &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114578025184461889?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/how-to-set-up-database-replication-in.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114572814529039679</guid><pubDate>Sat, 22 Apr 2006 17:47:00 +0000</pubDate><atom:updated>2006-04-23T01:49:05.306+08:00</atom:updated><title>How do I scan my Linux system for rootkits, worms, trojans, etc.?</title><description>&lt;p&gt;Either with &lt;i&gt;ckrootkit&lt;/i&gt; or with &lt;i&gt;rkhunter&lt;/i&gt;.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;u&gt;chkrootkit:&lt;/u&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;Either install the package that comes with your distribution (on Debian you would run&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;apt-get install chkrootkit&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;), or download the sources from &lt;a href="http://www.chkrootkit.org/" target="_blank"&gt;www.chkrootkit.org&lt;/a&gt; and install manually:&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;wget --passive-ftp ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;tar xvfz chkrootkit.tar.gz&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;cd chkrootkit-&lt;version&gt;/&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;make sense&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Afterwards, you can move the chkrootkit directory somewhere else, e.g. &lt;i&gt;/usr/local/chkrootkit&lt;/i&gt;:&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;cd ..&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;mv chkrootkit-&lt;version&gt;/ /usr/local/chkrootkit&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Now you can run chkrootkit manually:&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;cd /usr/local/chkrootkit&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;./chkrootkit&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;(if you installed a chkrootkit package coming with your distribution, your chkrootkit might be somewhere else).&lt;/p&gt; &lt;p&gt;You can even run chkrootkit by a cron job and get the results emailed to you:&lt;/p&gt; &lt;p&gt;Run &lt;/p&gt; &lt;p&gt;crontab -e&lt;/p&gt; &lt;p&gt;to create a cron job like this:&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;0 3 * * * (cd /usr/local/chkrootkit-&lt;version&gt;; ./chkrootkit 2&gt;&amp;amp;1 | mail -s "chkrootkit output my server" you@yourdomain.com)&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;That would run chkrootkit every night a 3.00h.&lt;/p&gt; &lt;p&gt;&lt;u&gt;&lt;b&gt;rkhunter:&lt;/b&gt;&lt;/u&gt;&lt;/p&gt; &lt;p&gt;Download the latest rkhunter sources from &lt;a href="http://www.rootkit.nl/" target="_blank"&gt;www.rootkit.nl&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;wget http://downloads.rootkit.nl/rkhunter-1.2.7.tar.gz&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;tar xvfz rkhunter-1.2.7.tar.gz&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;cd rkhunter/&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;./installer.sh&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;This will install rkhunter to the directory &lt;i&gt;/usr/local/rkhunter&lt;/i&gt;. Now run&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;rkhunter --update&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;to download the latest chkrootkit/trojan/worm signatures (you should do this regularly).&lt;/p&gt; &lt;p&gt;Now you can scan your system for malware by running&lt;/p&gt; &lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;i&gt;rkhunter -c&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114572814529039679?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/how-do-i-scan-my-linux-system-for.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114533813001798074</guid><pubDate>Tue, 18 Apr 2006 05:28:00 +0000</pubDate><atom:updated>2006-04-18T13:28:50.026+08:00</atom:updated><title>TRACKING OF LOGINS AND LOGOUTS on LINUX / UNIX Distros</title><description>TRACKING OF LOGINS AND LOGOUTS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the .login file add the commands:&lt;br /&gt;------------------------------ &lt;div style="direction: ltr;"&gt;&lt;wbr&gt;------&lt;br /&gt;&lt;br /&gt;echo login time `date` &gt;&gt; .daylogs/masterlog&lt;br /&gt;&lt;br /&gt;grep -i "sun" .daylogs/masterlog &gt; .daylogs/sunday.log&lt;br /&gt;grep -i "mon" .daylogs/masterlog &gt; .daylogs/monday.log&lt;br /&gt;grep -i "tue" .daylogs/masterlog &gt; .daylogs/tuesday.log&lt;br /&gt;grep -i "wen" .daylogs/masterlog &gt; .daylogs/wensday.log&lt;br /&gt;grep -i "thu" .daylogs/masterlog &gt; .daylogs/thursday.log&lt;br /&gt;grep -i "fri" .daylogs/masterlog &gt; .daylogs/friday.log&lt;br /&gt;grep -i "sat" .daylogs/masterlog &gt; .daylogs/saturday.log&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the .logout file add this line&lt;br /&gt;------------------------------&lt;wbr&gt;-----&lt;br /&gt;&lt;br /&gt;echo logout time `date`&gt;&gt; .daylogs/masterlog&lt;br /&gt;&lt;br /&gt;This script assumes you have a hidden&lt;br /&gt;directory called .daylogs this helps keep it&lt;br /&gt;out of sight and away from prying eyes and&lt;br /&gt;if you keep root ownership of the directory&lt;br /&gt;change the mode to:&lt;br /&gt;&lt;br /&gt;chmod 744 .daylogs&lt;br /&gt;&lt;br /&gt;This will not allow anyone to get in to the&lt;br /&gt;directory to look around.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114533813001798074?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/tracking-of-logins-and-logouts-on.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114507378002927782</guid><pubDate>Sat, 15 Apr 2006 04:02:00 +0000</pubDate><atom:updated>2006-04-15T12:03:00.046+08:00</atom:updated><title>CREATING TRASH</title><description>CREATING TRASH&lt;br /&gt;&lt;br /&gt;Sometimes unwittingly we may delete&lt;br /&gt;some important files and realise it&lt;br /&gt;later. To avoid such a situation,&lt;br /&gt;you can use this following idea.&lt;br /&gt;&lt;br /&gt;Create a small bash script containing&lt;br /&gt;the line&lt;br /&gt;&lt;br /&gt;mv $1 ~/trash/&lt;br /&gt;&lt;br /&gt;Save this file in your home say&lt;br /&gt;".srm" (safe rm) and in your&lt;br /&gt;".bashrc" enter this line:&lt;br /&gt;&lt;br /&gt;alias rm='~/.srm'&lt;br /&gt;&lt;br /&gt;Now whenever you delete any files&lt;br /&gt;it will go to "trash" directory&lt;br /&gt;instead of deletion.  You will&lt;br /&gt;have to create a "trash" directory&lt;br /&gt;in your home directory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114507378002927782?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/creating-trash_15.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114492215555841995</guid><pubDate>Thu, 13 Apr 2006 09:54:00 +0000</pubDate><atom:updated>2006-04-13T17:55:55.570+08:00</atom:updated><title>BASH SHELL OPTION</title><description>BASH SHELL OPTION&lt;br /&gt;&lt;br /&gt;If you are using bash shell. There is&lt;br /&gt;a way to cd a particular directory&lt;br /&gt;even if you spelled incorrectly on the&lt;br /&gt;command line. Set the shell option to:&lt;br /&gt;&lt;br /&gt;shopt -s cdspell&lt;br /&gt;&lt;br /&gt;eg:-&lt;br /&gt;Suppose you want to cd to "cd /tmp"&lt;br /&gt;and you have miss typed to "cd /pmp"&lt;br /&gt;still it will cd to "cd /tmp".&lt;br /&gt;&lt;br /&gt;This setting will be very usefull if&lt;br /&gt;you have a long named directory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114492215555841995?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/bash-shell-option.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114478970445065410</guid><pubDate>Tue, 11 Apr 2006 21:07:00 +0000</pubDate><atom:updated>2006-04-12T05:08:24.470+08:00</atom:updated><title>NFS BETWEEN SOLARIS &amp; LINUX</title><description>NFS BETWEEN SOLARIS &amp; LINUX&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you receive error messages such&lt;br /&gt;as "unknown version" when attempting to&lt;br /&gt;mount a Linux based NFS server from&lt;br /&gt;Solaris, you probably have an&lt;br /&gt;incompatibility between the NFS versions&lt;br /&gt;running on both of them.  Linux uses&lt;br /&gt;version 2, while Solaris uses version 3.&lt;br /&gt;In order to get the machines to&lt;br /&gt;communicate, you have to use the vers&lt;br /&gt;option on the Solaris machine as follows:&lt;br /&gt;&lt;br /&gt;mount -o vers=2 nfsserver:/remotedir /localdir&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114478970445065410?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/nfs-between-solaris-linux.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114469264219381476</guid><pubDate>Mon, 10 Apr 2006 18:10:00 +0000</pubDate><atom:updated>2006-04-11T02:10:42.193+08:00</atom:updated><title>MAINTAINING LOG AND TMP FILE</title><description>MAINTAINING LOG AND TMP FILE&lt;br /&gt;&lt;br /&gt;If you need to maintain an&lt;br /&gt;application that generate&lt;br /&gt;a lot of logfiles or tmp&lt;br /&gt;files with running numbers&lt;br /&gt;as part of the filename and&lt;br /&gt;uses a common extension.&lt;br /&gt;These two command together&lt;br /&gt;will help to maintain it&lt;br /&gt;for a window of time.&lt;br /&gt;&lt;br /&gt;It compress those files that&lt;br /&gt;are more than 24hrs and&lt;br /&gt;have it remove after 120hrs.&lt;br /&gt;You need to put it in&lt;br /&gt;daily cron.&lt;br /&gt;&lt;br /&gt;find $LOGDIR -name '*.ext' -mtime +0 -exec compress {} \;&lt;br /&gt;find $LOGDIR -name '*.Z' -mtime +5 -exec rm -f {} \;&lt;br /&gt;&lt;br /&gt;You can change the time to&lt;br /&gt;suit your needs and use&lt;br /&gt;wherever compressing utility&lt;br /&gt;you have to save space.&lt;br /&gt;If you need to maintain&lt;br /&gt;directories created by&lt;br /&gt;application here are help;&lt;br /&gt;&lt;br /&gt;find $LOGDIR -type d -mtime +0 -exec compress -r {} \;&lt;br /&gt;find $LOGDIR -type d -mtime +5 -exec rm -f {} &lt;br /&gt;The compression is to save&lt;br /&gt;space while waiting to be&lt;br /&gt;deleted.  Application&lt;br /&gt;developers may need to read&lt;br /&gt;these files/directories so&lt;br /&gt;keep those files/directories&lt;br /&gt;for a certain amount of time&lt;br /&gt;before deleting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114469264219381476?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/maintaining-log-and-tmp-file.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114469255172530074</guid><pubDate>Mon, 10 Apr 2006 18:08:00 +0000</pubDate><atom:updated>2006-04-11T02:09:12.976+08:00</atom:updated><title>EXTRACT CORRUPTED TAR FILE</title><description>EXTRACT CORRUPTED TAR FILE&lt;br /&gt;&lt;br /&gt;In many case if there is a corrupted tar file,&lt;br /&gt;the following command can be used in an attempt&lt;br /&gt;to extract the file:&lt;br /&gt;&lt;br /&gt;% cat [tar-filename] | tar -xvf -&lt;br /&gt;&lt;br /&gt;NOTE: Where "-" is the STDOUT&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114469255172530074?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/extract-corrupted-tar-file.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114395863866643710</guid><pubDate>Sun, 02 Apr 2006 06:16:00 +0000</pubDate><atom:updated>2006-04-02T14:17:18.676+08:00</atom:updated><title>EFFICIENT COMMANDS</title><description>EFFICIENT COMMANDS&lt;br /&gt;&lt;br /&gt;I cringe anytime I see someone code&lt;br /&gt;inefficiently.  Here are three of the&lt;br /&gt;most common mistakes, followed by a&lt;br /&gt;better way to do the same thing.&lt;br /&gt;&lt;br /&gt;Bad:    cat somefile | grep something&lt;br /&gt;Better: grep something somefile&lt;br /&gt;Why:    You're running one program (grep) instead of two (cat and grep).&lt;br /&gt;&lt;br /&gt;Bad:    ps -ef | grep something | grep -v grep&lt;br /&gt;Better: ps -ef | grep [s]omething&lt;br /&gt;Why:    You're running two commands (grep) instead of three (ps&lt;br /&gt;and two greps).&lt;br /&gt;&lt;br /&gt;Bad:    cat /dev/null &gt; somefile&lt;br /&gt;Better: &gt; somefile&lt;br /&gt;Why:    You're running a command (cat) with I/O redirection,&lt;br /&gt;instead of just redirection.&lt;br /&gt;&lt;br /&gt;Although the bad way will have the&lt;br /&gt;same result, the good way is far&lt;br /&gt;faster.  This may seem trivial, but&lt;br /&gt;the benefits will really show when&lt;br /&gt;dealing with large files or loops.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114395863866643710?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/efficient-commands.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114390548795297845</guid><pubDate>Sat, 01 Apr 2006 15:30:00 +0000</pubDate><atom:updated>2006-04-01T23:31:28.273+08:00</atom:updated><title>Removing Blank Line using SED</title><description>I SED BLANK&lt;br /&gt;&lt;br /&gt;Using sed, you can remove blank lines, and&lt;br /&gt;lines that contain only whitespace, from a&lt;br /&gt;file using the following:&lt;br /&gt;&lt;br /&gt;sed -e '/^[     ]*$/d' InputFile &gt;OutputFile&lt;br /&gt;&lt;br /&gt;Within the single quotes ('), the forward&lt;br /&gt;slashes (/) delimit the regular expression&lt;br /&gt;that will be interpreted by sed.  The "d"&lt;br /&gt;before the closing single quote, tells sed&lt;br /&gt;to delete any lines that match the regular&lt;br /&gt;expression.&lt;br /&gt;&lt;br /&gt;Within the regular expression, the caret&lt;br /&gt;(^) matches the beginning of a line.&lt;br /&gt;The []* matches zero to many occurrences of&lt;br /&gt;the character list between the open bracket&lt;br /&gt;([) and the close bracket (]) (in the above&lt;br /&gt;regular expression, you must insert a space&lt;br /&gt;and a tab between the brackets).  The dollar&lt;br /&gt;sign ($) matches the end of a line.&lt;br /&gt;&lt;br /&gt;These three constructs together match any&lt;br /&gt;blank line or any line that contains only&lt;br /&gt;spaces and tabs (in any combination).&lt;br /&gt;&lt;br /&gt;Since the standard operation of sed is to&lt;br /&gt;echo lines to stdout, all lines except blank&lt;br /&gt;lines (or lines that only contain whitespace)&lt;br /&gt;will be sent to OutputFile.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114390548795297845?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/04/removing-blank-line-using-sed.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114370104014622164</guid><pubDate>Thu, 30 Mar 2006 06:43:00 +0000</pubDate><atom:updated>2006-03-30T14:44:07.826+08:00</atom:updated><title>VI COPY FILE TO FILE</title><description>VI COPY FILE TO FILE&lt;br /&gt;&lt;br /&gt;Here is how to copy the required number&lt;br /&gt;of lines from one file to another in&lt;br /&gt;VI editor.  First use the following&lt;br /&gt;key combinations in the source file.&lt;br /&gt;&lt;br /&gt;Press ESCAPE&lt;br /&gt;Press Shift "(Shift double quotes)&lt;br /&gt;Press a&lt;br /&gt;Press the number of lines you want to copy&lt;br /&gt;press y followed by another y&lt;br /&gt;&lt;br /&gt;Now press " : " (COLON) to get the vi prompt.&lt;br /&gt;Hit e "Destination file name"&lt;br /&gt;Once you enter the Destination file&lt;br /&gt;go to the line where you want the lines&lt;br /&gt;copied to be inserted.&lt;br /&gt;&lt;br /&gt;Press ESCAPE.&lt;br /&gt;Press SHIFT "(Double quotes).&lt;br /&gt;Press a.&lt;br /&gt;Press p.&lt;br /&gt;&lt;br /&gt;The lines get copied.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114370104014622164?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/03/vi-copy-file-to-file.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-23490212.post-114370092085092899</guid><pubDate>Thu, 30 Mar 2006 06:40:00 +0000</pubDate><atom:updated>2006-03-30T14:42:00.860+08:00</atom:updated><title>FIND THOSE HIDDEN FILES</title><description>FIND THOSE HIDDEN FILES&lt;br /&gt;&lt;br /&gt;Finding only hidden files&lt;br /&gt;(starting with .) in a directory.&lt;br /&gt;&lt;br /&gt;ls -a | grep "^\." OR&lt;br /&gt;ls -a | awk '$0~/^\./ {print $0}'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23490212-114370092085092899?l=derrick-caluag.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://derrick-caluag.blogspot.com/2006/03/find-those-hidden-files.html</link><author>noreply@blogger.com (derrick caluag)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item></channel></rss>