<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux System Admins Blog &#187; HowTo</title>
	<atom:link href="http://linuxsysadminblog.com/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxsysadminblog.com</link>
	<description>System admins of Promet - an e-commerce, high availability Open Source web shop - share their findings</description>
	<lastBuildDate>Wed, 25 Aug 2010 19:46:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>HowTo remove a list of files</title>
		<link>http://linuxsysadminblog.com/2010/07/howto-remove-a-list-of-files/</link>
		<comments>http://linuxsysadminblog.com/2010/07/howto-remove-a-list-of-files/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 21:33:28 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1116</guid>
		<description><![CDATA[Here is a quick tip on how to remove a list of files. Let&#8217;s say you have the list of files inside a file called files_to_remove. Usually I would do something like this: LIST=`cat files_to_remove` and then ls -al $LIST just to check what is in the list and if it looks good. And finally: [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick tip on how to remove a list of files. Let&#8217;s say you have the list of files inside a file called <strong>files_to_remove</strong>. Usually I would do something like this:<br />
<code>LIST=`cat files_to_remove`</code><br />
and then<br />
<code>ls -al $LIST</code><br />
just to check what is in the list and if it looks good.</p>
<p>And finally:<br />
<code>rm -vf $LIST</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/07/howto-remove-a-list-of-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem Moving Drupal Site With SecurePages Module Enabled</title>
		<link>http://linuxsysadminblog.com/2010/02/problem-moving-drupal-site-with-securepages-module-enabled/</link>
		<comments>http://linuxsysadminblog.com/2010/02/problem-moving-drupal-site-with-securepages-module-enabled/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 12:41:23 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[securepages]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1058</guid>
		<description><![CDATA[I made a copy of Drupal6 site with SecurePages module installed and configured. This module is configured to redirect all or certain pages to https &#8211; depending on your configurations. For our setup we usually include the login and admin sections to redirect to https. The problem is on the copied site that is on [...]]]></description>
			<content:encoded><![CDATA[<p>I made a copy of Drupal6 site with <a href="http://drupal.org/project/securepages">SecurePages</a> module installed and configured.  This module is configured to redirect all or certain pages to https &#8211; depending on your configurations.  For our setup we usually include the login and admin sections to redirect to https.</p>
<p>The problem is on the copied site that is on a new domain as we cannot login and go to the admin section because it redirect back to the source/original site.  What we need is either disable the securepages module or update the domains.  To do this, you need to access your database (ex: phpmyadmin, etc), go to <em>variable</em> table, and search for <em>securepages</em> configurations. </p>
<p>If you want to disable the module change:<br />
<code>securepages_enable  s:1:"<strong>1</strong>";</code><br />
to<br />
<code>securepages_enable  s:1:"<strong>0</strong>";</code></p>
<p>Or if you want to update the domain change:<span id="more-1058"></span><br />
<code>securepages_basepath s:30:"http://<strong>www.domain.com</strong>";<br />
securepages_basepath_ssl s:31:"https://<strong>www.domain.com</strong>";</code><br />
to<br />
<code>securepages_basepath s:30:"http://<strong>www.newdomain.com</strong>";<br />
securepages_basepath_ssl s:31:"https://<strong>www.newdomain.com</strong>";</code></p>
<p>After making the above changes <strong>don&#8217;t forget</strong> to run the update.php (http://www.newdomain.com/update.php)</p>
<p>If you want to uninstall the module, try removing the securepages directory and run update.php.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/02/problem-moving-drupal-site-with-securepages-module-enabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Changes to Drupal Core</title>
		<link>http://linuxsysadminblog.com/2010/02/making-changes-to-drupal-core/</link>
		<comments>http://linuxsysadminblog.com/2010/02/making-changes-to-drupal-core/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 05:42:10 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1040</guid>
		<description><![CDATA[Although we made it a standard not to make any changes to Drupal core and core modules, there are times that our developers really need to make changes to core modules in order to add the required functionality. Cases like additional feature for &#8216;user&#8217; or &#8216;comment&#8217; modules and so on. At this state we can&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Although we made it a standard not to make any changes to Drupal core and core modules, there are times that our developers really need to make changes to core modules in order to add the required functionality.  Cases like additional feature for &#8216;user&#8217; or &#8216;comment&#8217; modules and so on.  At this state we can&#8217;t perform automatic update on our sites as we might overwrite the changes &#8211; so we need to do the update manually.  Well, this is ok if you maintain one or two sites, but if you have more than 100 sites then it will take you some time.</p>
<p>What we did to eliminate this issue and be able to update the site automatically was to create a copy of the original core modules (located in <em>/modules</em>), add our custom functionality, and put the modified copy into &#8216;contributed&#8217; modules directory (<em>/sites/all/modules</em>).  Drupal read the modules found on <em>/sites/all/modules</em> first and ignore the same copy (original) found on <em>/modules</em>.  Also, may want to change the module info or the package name to separate the modified modules from the original ones &#8211; ex: modified_core, custom, etc.  In the case that Drupal reads both of them, you can just disable the other one.</p>
<p>Here&#8217;s our policy on working with Drupal modules:<br />
  &#8211; contributed or community modules at <em>/sites/all/modules</em><br />
  &#8211; custom made modules at <em>/sites/all/modules/custom</em><br />
  &#8211; modified core modules at <em>/sites/all/modules/core_modified</em></p>
<p>Hope this helps.  <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/02/making-changes-to-drupal-core/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade to Fedora 12</title>
		<link>http://linuxsysadminblog.com/2009/11/upgrade-to-fedora-12/</link>
		<comments>http://linuxsysadminblog.com/2009/11/upgrade-to-fedora-12/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 20:58:02 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[Fedora 12]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=994</guid>
		<description><![CDATA[Fedora release 12 became available to the public November 17, 2009. New features are plentiful and many are centred around KVM virtualization. If you are like me and still running Fedora 10 or 11 and do not wish to wait till a yum based update is pushed out you can kick off your adventure into [...]]]></description>
			<content:encoded><![CDATA[<p>Fedora release 12 became available to the public November 17, 2009. <a href="http://fedoraproject.org/wiki/Releases/12/FeatureList">New features</a> are plentiful and many are centred around KVM virtualization.</p>
<p>If you are like me and still running Fedora 10 or 11 and do not wish to wait till a yum based update is pushed out you can kick off your adventure into Fedora 12 land manually. Set aside at least an hour of time where you will not be able to use the PC while the update is taking place. First thing is to review <a href="http://fedoraproject.org/wiki/PreUpgrade">Preupgrade Wiki Page</a>, once you feel confident that your system is ready (enough space in /boot, created backups of your data) issue (as root):<br />
<code>yum update &#038;&#038; yum install preupgrade</code><br />
Followed by:<br />
<code>preupgrade-cli "Fedora 12 (Constantine)"</code><br />
After a lengthy download, reboot and update process you should be looking at Fedora 12 login prompt. </p>
<p>If you used ext3 filesystem in your Fedora 10/11 system you can also migrate to ext4 filesystem by following the <a href="https://fedoraproject.org/wiki/Ext4_in_Fedora_11">Fedora ext4 Wiki guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/11/upgrade-to-fedora-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php 5.2.9 on RHEL5.x (for Drupal 6)</title>
		<link>http://linuxsysadminblog.com/2009/10/php-5-2-9-on-rhel5-x-for-drupal-6/</link>
		<comments>http://linuxsysadminblog.com/2009/10/php-5-2-9-on-rhel5-x-for-drupal-6/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 20:10:13 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rhel]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=907</guid>
		<description><![CDATA[Latest version of PHP available for RHEL5.x is 5.1.6 and no new RedHat releases are coming as packaging has ceased. You can get PHP 5.3 for RHEL5 from Remi, but it it&#8217;s incompatible with latest versions of Drupal, Civicrm or many modules so we need the a 5.2X branch of PHP. This requires building php [...]]]></description>
			<content:encoded><![CDATA[<p>Latest version of <strong>PHP</strong> available for RHEL5.x is 5.1.6 and no new RedHat releases are coming as packaging has ceased. You can get PHP 5.3 for RHEL5 from <a href="http://blog.famillecollet.com/pages/Config-en">Remi</a>, but it it&#8217;s incompatible with latest versions of Drupal, Civicrm or many modules so we need the a 5.2X branch of PHP. This requires building php from source or using rpmbuild and source rpm. I was able to use <a href="http://kojipkgs.fedoraproject.org/packages/php/5.2.9/1.fc9/src/php-5.2.9-1.fc9.src.rpm">Koji&#8217;s</a> FC9 php5.2.9 src.rpm to rebuild for RHEL5 and here is how.<br />
<span id="more-907"></span></p>
<p>Install rpm-build package.<br />
<code>sudo yum install rpm-build</code></p>
<p>Create build env in your home directory (mine is called &#8216;max&#8217;), do NOT build as root user. I used &#8216;rpm&#8217; directory as the build location.<br />
<code>mkdir -p rpm/{SOURCES,SRPMS,SPECS,BUILD,RPMS}</code></p>
<p>Create .rpmmacros file which will identify the build location.<br />
<code>echo "%_topdir /home/max/rpm" > .rpmmacros</code></p>
<p>Download php5.2.9 rpm source file, i used FC9 version as it is closest to RHEL5.<br />
<code>wget http://kojipkgs.fedoraproject.org/packages/php/5.2.9/1.fc9/src/php-5.2.9-1.fc9.src.rpm</code></p>
<p>To rebuild php5.2.9 FC9 source RPM for RHEL5.x into binary RPM&#8217;s we need to make sure build dependences have been satisfied. I created a file called &#8220;php-deps&#8221; which contains the build dependencies to be installed via YUM.<br />
<code><br />
bzip2-devel<br />
curl-devel<br />
db4-devel<br />
gmp-devel<br />
httpd-devel<br />
pam-devel<br />
libstdc++-devel<br />
openssl-devel<br />
sqlite-devel<br />
zlib-devel<br />
pcre-devel<br />
readline-devel<br />
libtool<br />
gcc-c++<br />
krb5-devel<br />
libc-client-devel<br />
cyrus-sasl-devel<br />
openldap-devel<br />
mysql-devel<br />
postgresql-devel<br />
unixODBC-devel<br />
libxml2-devel<br />
net-snmp-devel<br />
libxslt-devel<br />
libxml2-devel<br />
mhash-devel<br />
ncurses-devel<br />
libXpm-devel<br />
libjpeg-devel<br />
</code></p>
<p>Install build dependencies via yum<br />
<code>sudo yum install -y `cat php-deps`</code></p>
<p>Finally perform the build, this could take some time depending on speed of your machine. If everything goes well many php*.rpm files will  be created in rpm/RPMS/&#8221;arch-type&#8221;/ folder. &#8220;arch-type&#8221; is the hardware-platform of your machine which will match &#8220;uname -i&#8221; command (mine is i386)<br />
<code>rpmbuild --rebuild php-5.2.9-1.fc9.src.rpm</code></p>
<p>Now you can install the resulting RPM&#8217;s manually but a better way is to create a local YUM repository.<br />
Install createrepo application via YUM.<br />
<code>sudo yum info createrepo</code></p>
<p>Create a repository location directory and copy your newly generated php5.2.9 RPM files into it.<br />
<code>sudo mkdir /opt/local-repository &#038;&#038; cp /home/max/rpm/RPMS/i386/* /opt/local-repository</code></p>
<p>Initialize the local repository and catalog the files copied there. (run this command anytime you add/remove files from your local repository directory)<br />
<code>sudo createrepo /opt/local-repository/</code></p>
<p>Configure your local repository with yum by creating a file in /etc/yum.repos.d called &#8220;local-repository.repo&#8221;<br />
containing:<br />
<code>[local-repository]<br />
name=RHEL5 $releasever - Local Repo<br />
baseurl=file:///opt/local-repository/<br />
enabled=0<br />
gpgcheck=0<br />
#gpgkey=file:///path/to/you/RPM-GPG-KEY<br />
</code></p>
<p>Update yum to register local repository<br />
<code>sudo yum update</code></p>
<p>Update php using your new rpm files via the local repository<br />
<code>sudo yum --enablerepo=local-repository update php</code></p>
<p>Restart apache<br />
<code>sudo /etc/init.d/httpd restart</code></p>
<p>Verify PHP version<br />
<code>php -v</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/10/php-5-2-9-on-rhel5-x-for-drupal-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo display PHP errors when you don&#8217;t have access to php.ini</title>
		<link>http://linuxsysadminblog.com/2009/09/howto-display-php-errors-when-you-dont-have-access-to-php-ini/</link>
		<comments>http://linuxsysadminblog.com/2009/09/howto-display-php-errors-when-you-dont-have-access-to-php-ini/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 12:10:34 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=867</guid>
		<description><![CDATA[If you are using a shared server, or just have a limited account on your company servers, you might not have access to your php configuration file php.ini (this is usually found under /etc/php.ini in rhel/centos and /etc/php5/apache2/php.ini in debian/ubuntu). Still, in many situations it might be needed to enable php errors in the browser [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using a shared server, or just have a limited account on your company servers, you might <strong>not have access</strong> to your php configuration file <strong>php.ini</strong> (this is usually found under <em>/etc/php.ini</em> in rhel/centos and <em>/etc/php5/apache2/php.ini</em> in debian/ubuntu). Still, in many situations it might be needed to <strong>enable php errors</strong> in the browser so you can see what is the actual problem instead of an empty page (if the server has error reporting disabled as most production systems should have).</p>
<p>In order to enable error reporting for your php script or application include inside your code the following lines:<br />
<code>error_reporting(E_ALL);<br />
ini_set("display_errors", 1);</code><br />
and this will result in displaying in the browser any errors your application might have.</p>
<p>ps: once you are done with this and fixed the issue, don&#8217;t forget to remove the error reporting lines, as we don&#8217;t want our users/clients to see errors in the browser in case something went wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/09/howto-display-php-errors-when-you-dont-have-access-to-php-ini/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using wildcards in nginx valid_referers</title>
		<link>http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/</link>
		<comments>http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 11:05:25 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=833</guid>
		<description><![CDATA[This quick post will show how we can easily allow only certain http referrers see some location using nginx. This might be useful for example if you are using nginx as a static content provider and want to not allow everyone hot-linking your images and only your own sites. Doing something like this in nginx [...]]]></description>
			<content:encoded><![CDATA[<p>This quick post will show how we can easily allow only certain http referrers see some location using <a href="http://nginx.net/" target="_blank"><strong>nginx</strong></a>. This might be useful for example if you are using nginx as a static content provider and want to not allow everyone hot-linking your images and only your own sites. Doing something like this in nginx is very simple and we could start with a configuration like this (from <em>nginx.conf</em>):</p>
<pre><code>location /images {
	valid_referers   none  blocked  server_names  mydomain.com www.mydomain.com;
	if ($invalid_referer) {
		return   403;
	}
	... else serve the content
}</code></pre>
<p>This works fine in this simple case; but what if we need to list more sub-domains? like images.mydomain.com an static.mydomain.com, etc? It would be nice to be able to use a regexp for this, right? Fortunately nginx has support for this and this can be done using a valid_referers line like:<br />
<code>valid_referers   none  blocked  server_names  ~(mydomain.com)</code></p>
<p><span id="more-833"></span>And this will match all the subdomains *.mydomain.com. Going even further you might want to allow google as a referrer for you content. Still google has so many subdomains and even different domains (like google.com, google.de, etc.) For this we could add ~(google.) and have our final configuration look like this:</p>
<pre><code>location /images {
	valid_referers   none  blocked  server_names  ~(mydomain.com|google.);
	if ($invalid_referer) {
		return   403;
	}
	... else serve the content
}</code></pre>
<p>This simple example shows how powerful the configuration of nginx is and how easy it is to do things that are rather impossible with other similar softwares.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using svn+ssh with a non-standard ssh port</title>
		<link>http://linuxsysadminblog.com/2009/08/using-svnssh-with-a-non-standard-ssh-port/</link>
		<comments>http://linuxsysadminblog.com/2009/08/using-svnssh-with-a-non-standard-ssh-port/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 09:25:05 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=829</guid>
		<description><![CDATA[Many people use subversion over ssh for a simple and secure way to work on remotely hosted svn repositories. This is normally as simple as running: svn co svn+ssh://user@server/repo . If the remote ssh server is not running on the default ssh port (tcp 22) then this needs a little tweaking to get it working. [...]]]></description>
			<content:encoded><![CDATA[<p>Many people use <a href="http://subversion.tigris.org/" target="_blank"><strong>subversion</strong></a> over ssh for a simple and secure way to work on remotely hosted svn repositories. This is normally as simple as running:<br />
<code>svn co svn+ssh://user@server/repo .</code></p>
<p>If the remote ssh server is <strong>not running on the default ssh port</strong> (tcp 22) then this needs a little tweaking to get it working. Normally I was expecting that adding a custom entry for the svn server in the <em>/etc/ssh/ssh_config</em> file with the appropriate port would make this work on the fly without changing the command line; or if not, adding the ssh port in &#8216;telnet like&#8217; way: <em>server:port</em> would make a difference. Still none of those worked and in order to get this working I had to dig into the subversion documentation on how we can define a special tunnel.</p>
<p>We can define a new tunnel in the svn configuration file (<strong>.subversion/config</strong>):<br />
<code>[tunnels]<br />
sshtunnel = ssh -p &lt;port&gt;</code></p>
<p>And after this we can use svn as usual but with a url like <strong>svn+sshtunnel://</strong> :<br />
<code>svn co svn+sshtunnel://user@server/repo .</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/08/using-svnssh-with-a-non-standard-ssh-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Task on Amazon EBS on CentOS AMI</title>
		<link>http://linuxsysadminblog.com/2009/07/task-on-amazon-ebs-on-centos-ami/</link>
		<comments>http://linuxsysadminblog.com/2009/07/task-on-amazon-ebs-on-centos-ami/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 08:43:51 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ebs]]></category>
		<category><![CDATA[ec2]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=813</guid>
		<description><![CDATA[This is my second activity on using AWS &#8211; this time the use of EBS. Objectives: Format a new EBS (10GB) and mount it on a running instance of private AMI (created on first activity &#8211; add link/ref to old post) Setup a MySQL server with the datastore on EBS partition Setup the partition(EBS) to [...]]]></description>
			<content:encoded><![CDATA[<p>This is my second activity on using AWS &#8211; this time the use of <a href="http://aws.amazon.com/ebs/">EBS</a>.</p>
<p><strong>Objectives:</strong></p>
<ol>
<li> Format a new EBS (10GB) and mount it on a running instance of private AMI (created on first activity &#8211; add link/ref to old post)</li>
<li> Setup a MySQL server with the datastore on EBS partition</li>
<li> Setup the partition(EBS) to start at boot time of AMI</li>
</ol>
<p>Here, I will elaborate the steps (mostly commands) and some issues that I encountered along the way.  I also included the script (below) that i used for attaching the EBS to AMI at boot time. Reference <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1663">here</a>.  I will add an indicator on where i am running my commands, either on controling machine or on instance.  On variables or values i assumed that you already know how to get them, the ec2-describe-instances/volume..etc.  If the ec2 commands is not available on your system make sure you have the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&amp;categoryID=88">ec2 api tools</a> or have your environment variables configured.<br />
<span id="more-813"></span><strong>Objective #1: Format EBS and mount on a running instance</strong></p>
<ul>
<li> Run instance of private ami and take note of the zone (default is us-east-1a &#8211; not sure <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )<br />
<code>controlling machine$:  ec2-run-instances -z us-east-1a --key YOURKEYPAIR ami-xxxxx</code></li>
<li>Create ebs volume with 10GB size.  Note the use of same zone so the volume can be attached to the instance above.  Check the EBS docs for more details on Zones.<br />
<code>controlling machine$:  ec2-create-volume -z us-east-1a -s 10</code></li>
<li>Attach the zone to your instance, ex: as /dev/sdh<br />
<code>controlling machine$:  ec2-attach-volume -d /dev/sdh -i i-IIII1111 vol-VVVV1111</code></li>
<li>Login to your instance and format your ebs drive on /dev/sdh. It&#8217;s your choice on what filesystem to use.  For my activity, i used xfs as i was advised that it is easier/faster to increase/shrink xfs filesystem compared to ext3 &#8211; and on the above reference xfs as used.<br />
controlling machine$:  ssh -i ssh_key root@ec2.xxxxx.amazonaws.com<br />
(host may not be on this format, just refer to the details on your instance)<br />
<code>instance$: yum install xfsprogs<br />
instance$: modprobe xfs<br />
instance$: mkfs.xfs /dev/sdh</code></li>
<li>Mount the ebs volume.<br />
instance$: mount -t xfs /dev/sdh /ebs</li>
</ul>
<p><strong>Objective #2: Setup a MySQL server with the datastore on EBS partition</strong></p>
<ul>
<li>Install mysql on your running instance, edit /etc/my.cnf and set the value for datadir to /ebs (my example), and start your MySQL.<br />
<code>instance$: yum install mysql-server<br />
instance$: vi /etc/my.cnf<br />
instance$: /etc/init.d/mysqld start</code></li>
<li>Create a sample database to test<br />
<code>instance$: mysql<br />
mysql&gt; create database ebstest;<br />
mysql&gt; quit<br />
instance$: ls /ebs/</code></li>
</ul>
<p><strong>Objective #3: Setup the partition(EBS) to start at boot time of AMI</strong></p>
<ul>
<li>I was advised here to create an init script that will attach the ebs volume to my running instance and i was given a sample script (for debian) that i modified to my need (for CentOS) and added some stuff.  I encountered several issues here as my init script failed to start correctly, like my environment variable is not available or incorrect paths etc.  And was able to bundle four or five times. <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   In short the script (below) does the automation, i only need to add this on my start up &#8211; so for the process, please check or continue reading the notes/comments on the script below.  Btw, I just added the section to start MySQL inside the init script, but of course you can separate them.</li>
<li>After creating a init script with the correct variables/filenames, bundle or create new AMI.  Commands below are summary from a video tutorial &#8211; i forgot the link <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Run help for each command to get details on the options used, ex: &#8216;ec2-bundle-vol -h&#8217;.<br />
<code>instance$: cd /mnt<br />
instance$: mkdir ami<br />
instance$: ec2-bundle-vol -d /mnt/ami -k /root/.ec2/pk.xxx.pem -c /root/.ec2/cert.xxx.pem -u xxxx-xxxx-xxxx<br />
instance$: ec2-upload-bundle -b bucket1 -m /mnt/ami/image.manifest.xml -a XXXXXX -s xxxXXXXx<br />
controlling machine$: ec2-register bucket1/image.manifest.xml</code></li>
<li>Test your new AMI &#8211; run new instance and check if your ebs volume is attached &#8211; goodluck!</li>
</ul>
<p><strong>Init Script Here: <a href="http://linuxsysadminblog.com/wp-content/uploads/2009/07/mountebs"> mountebs</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/07/task-on-amazon-ebs-on-centos-ami/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Waiting for SSH login prompt</title>
		<link>http://linuxsysadminblog.com/2009/07/waiting-for-ssh-login-prompt/</link>
		<comments>http://linuxsysadminblog.com/2009/07/waiting-for-ssh-login-prompt/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 22:45:55 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[lag]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=799</guid>
		<description><![CDATA[Are you often waiting over 1 minute to get a ssh prompt? This can be caused by several things however more often then not is a missing PTR record for server address and enabled GSSAPIAuthentication in ssh_config. GSSAPIAuthentiction is Kerberos 5 centralized authentication/authorization mechanism that relies on resolving a hostname for proper operation, when it [...]]]></description>
			<content:encoded><![CDATA[<p>Are you often waiting over 1 minute to get a ssh prompt? This can be caused by several things however more often then not is a missing PTR record for server address and enabled GSSAPIAuthentication in ssh_config. GSSAPIAuthentiction is Kerberos 5 centralized authentication/authorization mechanism that relies on resolving a hostname for proper operation, when it cannot do so it tries 3 times before falling back on the next authentication mechanism.</p>
<p>First you need to see where the login process gets hung up:<br />
<code>ssh -vvv server_address<br />
debug1: Authentications that can continue: publickey,gssapi-with-mic,password<br />
debug3: start over, passed a different list publickey,gssapi-with-mic,password<br />
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password<br />
debug3: authmethod_lookup gssapi-with-mic<br />
debug3: remaining preferred: publickey,keyboard-interactive,password<br />
debug3: authmethod_is_enabled gssapi-with-mic<br />
debug1: Next authentication method: gssapi-with-mic<br />
debug3: Trying to reverse map address server_address.<br />
debug1: Unspecified GSS failure.  Minor code may provide more information<br />
No credentials cache found<br />
debug1: Unspecified GSS failure.  Minor code may provide more information<br />
No credentials cache found<br />
debug1: Unspecified GSS failure.  Minor code may provide more information<br />
debug2: we did not send a packet, disable method</code></p>
<p>and check if a PTR record exists:<br />
<code>[max@linux ~]$ dig -x server_address<br />
; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> -x server_address<br />
;; global options:  printcmd<br />
;; Got answer:<br />
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 20960<br />
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0</code></p>
<p><code>;; QUESTION SECTION:<br />
;sserdda_revres.in-addr.arpa.	IN	PTR</code></p>
<p><code>;; Query time: 87 msec</code></p>
<p>Here we see that in fact we are being hung on the gssapi-with-mic method  and there is no PTR record for the host. The quickest and simples way to resolve this is to disable gssapi-with-mic authmethod globally on the client.<br />
In RedHat/Fedora Linux edit /etc/ssh/ssh_config and make sure you have an uncommented "GSSAPIAuthentication no" line for Host *</p>
<p><code># Host *<br />
#   ForwardAgent no<br />
#   ForwardX11 no<br />
#   RhostsRSAAuthentication no<br />
#   RSAAuthentication yes<br />
#   PasswordAuthentication yes<br />
#   HostbasedAuthentication no<br />
     GSSAPIAuthentication no<br />
#   GSSAPIDelegateCredentials no</code></p>
<p>If you are using host-based configuration be sure to put this at the top of the file so it takes priority over the defaults below it.<br />
<code>Host server_name<br />
HostName server_address<br />
Port 22<br />
User max<br />
GSSAPIAuthentication no</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/07/waiting-for-ssh-login-prompt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
