<?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>Pervasive Code &#187; CentOS</title>
	<atom:link href="http://www.pervasivecode.com/blog/category/centos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pervasivecode.com/blog</link>
	<description>Jamie Flournoy's Software Development Blog</description>
	<lastBuildDate>Mon, 26 Jul 2010 05:29:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CentOS 5.3 Minimal VPS Install Guide</title>
		<link>http://www.pervasivecode.com/blog/2009/05/30/centos-53-minimal-vps-install-guide/</link>
		<comments>http://www.pervasivecode.com/blog/2009/05/30/centos-53-minimal-vps-install-guide/#comments</comments>
		<pubDate>Sat, 30 May 2009 16:52:14 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Parallels]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/?p=95</guid>
		<description><![CDATA[I just did this yesterday; you can pretty much just follow my CentOS 5.1 Minimal VPS Install Guide.
The differences are:

When you get to the &#8220;More Minimizing&#8221; section, yum -C grouplist will show a package called &#8220;Yum Utilities&#8221; which you probably want to leave installed.
The Deployment_Guide-en-US file is not there so you don&#8217;t need to remove [...]]]></description>
			<content:encoded><![CDATA[<p>I just did this yesterday; you can pretty much just follow my <a href="http://www.pervasivecode.com/blog/2008/03/29/centos-51-minimal-vps-install-guide/">CentOS 5.1 Minimal VPS Install Guide</a>.</p>
<p>The differences are:</p>
<ul>
<li>When you get to the &#8220;More Minimizing&#8221; section, <code>yum -C grouplist</code> will show a package called &#8220;Yum Utilities&#8221; which you probably want to leave installed.</li>
<li>The <code>Deployment_Guide-en-US</code> file is not there so you don&#8217;t need to remove it.</li>
</ul>
<p>That&#8217;s it.</p>
<p>I should also note that downloading a 3.9GB DVD ISO image in order to build a ~700MB installed OS may not be very efficient. I didn&#8217;t bother looking for a network installer but that might be the way to get this done faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2009/05/30/centos-53-minimal-vps-install-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retroactively Minimizing Installed Packages on CentOS 5.1</title>
		<link>http://www.pervasivecode.com/blog/2008/04/14/retroactively-minimizing-installed-packages-on-centos-51/</link>
		<comments>http://www.pervasivecode.com/blog/2008/04/14/retroactively-minimizing-installed-packages-on-centos-51/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 01:16:44 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2008/04/14/retroactively-minimizing-installed-packages-on-centos-51/</guid>
		<description><![CDATA[In my CentOS 5.1 Minimal VPS Install Guide I describe how to install a very lean set of OS packages when starting from scratch. But what if the VPS is preinstalled for you by a hosting provider? There will be things preinstalled that you don&#8217;t need, which will slow down backups and updates, and waste [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="/blog/2008/03/29/centos-51-minimal-vps-install-guide/">CentOS 5.1 Minimal VPS Install Guide</a> I describe how to install a very lean set of OS packages when starting from scratch. But what if the VPS is preinstalled for you by a hosting provider? There will be things preinstalled that you don&#8217;t need, which will slow down backups and updates, and waste the relatively tiny amount of disk space that VPS plans offer. So here are some instructions to help you identify and remove packages that you don&#8217;t need, when they&#8217;ve already been installed.<br />
<span id="more-68"></span><br />
The first thing you need is a list of minimal packages that your server must have in order to function. This is somewhat subjective, so you may wish to customize it, but <a href="/code/CentOS_5.1_minimal_yum_package_names.txt">here is a roughly minimal list of yum package names for CentOS 5.1</a>. Save that on your CentOS machine as minimal_package_names.txt.</p>
<p>Next, you need a way to compare this list to the list of what you have installed. Here&#8217;s a command line that I used:</p>
<p><code>
<pre>yum list installed | awk 'split($1,a,".") { if (NR>2){ print a[1] } }' \\
> installed_package_names.txt ; diff installed_package_names.txt \\
minimal_package_names.txt  | grep '<' | colrm 1 2
</pre>
<p></code></p>
<p>(The awk command is there to strip out the version number and architecture from the package name.)</p>
<p>Now you can run that command and see a list of package names that are not in your minimal_package_names.txt list. You can switch that grep command so it looks for '>' instead of '<', and see things that you consider minimal which are not currently installed.</p>
<p>Then it's just a matter of "yum install foo" and "yum remove foo". I encourage you to use "yum info foo" to make removal decisions one by one, since someone at the ISP probably took the time to research them and thought you might find them useful. You should probably also remove packages in small groups or one by one, because you might be surprised at the dependencies you find. I was surprised to find that uninstalling postgresql-libs would cause httpd (Apache) to be removed as well.</p>
<p>But if you want to automate it, just tack <code>| xargs yum remove</code> on the end of that command, and it will automatically remove them all at once.</p>
<p>Using this as a starting point, you can change your "minimal" packages list to fit your preferences, or even as a quick and dirty alternative to using Kickstart.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2008/04/14/retroactively-minimizing-installed-packages-on-centos-51/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sphinx Search init script for Centos 5.1</title>
		<link>http://www.pervasivecode.com/blog/2008/04/14/sphinx-search-init-script-for-centos-51/</link>
		<comments>http://www.pervasivecode.com/blog/2008/04/14/sphinx-search-init-script-for-centos-51/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 06:18:11 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2008/04/14/sphinx-search-init-script-for-centos-51/</guid>
		<description><![CDATA[Sphinx search is pretty new, and as a result I was unable to find a nice convenient package for it for CentOS 5.1. This is problematic since there is no init script included with the source tarball, and the issue of updating the index is the sysadmin and developer&#8217;s problem, and cannot be configured to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sphinxsearch.com/">Sphinx search</a> is pretty new, and as a result I was unable to find a nice convenient package for it for CentOS 5.1. This is problematic since there is no init script included with the source tarball, and the issue of updating the index is the sysadmin and developer&#8217;s problem, and cannot be configured to simply update the index when the data changes.<br />
<span id="more-65"></span><br />
The second problem (updates) is one I punted on; for now I have a cron job rebuilding the entire index every 5 minutes, which will probably be replaced with something smarter and lower-latency at a later time.</p>
<p>The first problem (no init script) is easy to solve, but apparently nobody has done so for CentOS 5.1 and published it. So, here is <a href="/code/centos_sphinx_init_script.txt">my CentOS 5.1 init script for the Sphinx Search server</a>. It is known to work with version 0.9.8-rc2.</p>
<p>BTW, the alternative solution to the problem of a daemon not having a System V init script is to just put some extra junk in <code>/etc/rc.local</code>. That is the quick and dirty solution, and is undesirable for several reasons:</p>
<ol>
<li>You can&#8217;t easily stop or restart the service, because it&#8217;s not a service as far as the OS knows; it&#8217;s just some junk in a script that got run a while ago.</li>
<li>You can&#8217;t use <a href="http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-services-chkconfig.html">chkconfig</a> or its GUI cousin with the creative name, <a href="http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-services-serviceconf.html">The Services Configuration Tool</a>, to control it and tie it to specific runlevels.</li>
</ol>
<p>(System V runlevels and init scripts are useful, even if you don&#8217;t need all of the runlevel functionality. The stop/start/restart PID stuff is useful by itself.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2008/04/14/sphinx-search-init-script-for-centos-51/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making SELinux allow a nonstandard MySQL port number on Centos 5.1</title>
		<link>http://www.pervasivecode.com/blog/2008/03/29/making-selinux-allow-a-nonstandard-mysql-port-number-on-centos-51/</link>
		<comments>http://www.pervasivecode.com/blog/2008/03/29/making-selinux-allow-a-nonstandard-mysql-port-number-on-centos-51/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 18:36:30 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2008/03/29/making-selinux-allow-a-nonstandard-mysql-port-number-on-centos-51/</guid>
		<description><![CDATA[SELinux is a recently added security system that&#8217;s installed by default with CentOS 5.1 (and Red Hat Enterprise Linux 5, and others). Since it&#8217;s newer than the classic &#8220;Discretionary Access Control&#8221; Unix security model, it&#8217;s not nearly as well documented, and unfamiliar to many. I had never even heard of it until this week.
After a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/SELinux">SELinux</a> is a recently added security system that&#8217;s installed by default with CentOS 5.1 (and Red Hat Enterprise Linux 5, and others). Since it&#8217;s newer than the classic &#8220;Discretionary Access Control&#8221; Unix security model, it&#8217;s not nearly as well documented, and unfamiliar to many. I had never even heard of it until this week.</p>
<p>After a lot of reading about it, and debating disabling it entirely, I figured out how to do some minor SELinux customization to fit my needs for a MySQL database server. Hopefully this will help folks who are in a similar situation.</p>
<p><span id="more-64"></span></p>
<p>Fortunately, although SELinux is sophisticated, it&#8217;s not too obtrusive as implemented in CentOS 5.1. In configuring it, Red Hat has picked an admirable position somewhere between ironclad security with a huge administrative burden, and toothless security that is easy to use because it isn&#8217;t doing anything to protect you. This is important, because if the configuration process were too odious from the point of view of a typical junior sysadmin, it&#8217;s very likely that people would get in the habit of just turning it off entirely. As it is, SELinux on RHEL 5 / CentOS 5.1 is now becoming part of the landscape of what a modern Linux looks like; based on what I&#8217;ve read on relevant forums lately, admins are taking the time to try and customize its default configuration to their needs (with some success) rather than just turning it off.</p>
<p>The nicely balanced default configuration that Red Hat has chosen is called the <a href="http://www.centos.org/docs/5/html/5.1/Deployment_Guide/rhlcommon-section-0003.html">Targeted Policy</a>, which means that if the SELinux configuration files know about a specific daemon, then it will be subject to specific rules; otherwise, the classic Unix security model applies. So if you stay with the standard configuration of those targeted daemons, SELinux is providing an additional level of security containment around them, and as long as it does what it&#8217;s supposed to, you&#8217;ll never notice it.</p>
<p>In my case, I&#8217;m running MySQL and OpenSSH, and have configured them to listen on nonstandard ports. SSH is not targeted, so this was trivial to do. MySQL is targeted, so it didn&#8217;t work right away.</p>
<p>Specifically, MySQL wouldn&#8217;t start, and in /var/log/messages I saw something like this:<br />
<code>kernel: audit(1206710000.178:12): avc:  denied  { name_bind } \<br />
for  pid=8591 comm="mysqld" src=1234 scontext=user_u:system_r:mysqld_t:s0 \<br />
tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket</code><br />
In plain English, &#8220;I denied process 8591&#8217;s request to bind to port 1234&#8243;. So SELinux needs to be told that MySQL should be allowed to bind to port 1234.</p>
<p>Here&#8217;s what I had to do: (assuming a mysqld port number of 1234, and that the iptables firewall is already adjusted for this)<br />
<code>sudo /usr/sbin/semanage port -a -t mysqld_port_t -p tcp 1234</code></p>
<p>This means &#8220;Change the SELinux policy for ports by adding one, of mysqld_port_t type, protocol TCP, port number 1234.&#8221;</p>
<p>Now you should be able to see the standard port (3306) and the new one (1234) with this:<br />
<code>sudo /usr/sbin/semanage port -l | grep mysql</code></p>
<p>That should output something like &#8220;mysqld_port_t tcp 1234,3306&#8243;.</p>
<p>(These changes are persisted in &#8216;/etc/selinux/targeted/modules/active/ports.local&#8217;, so they will still be active after a reboot.)</p>
<p>Now, MySQL starts happily and I can connect and use it as I had expected. But I didn&#8217;t have to disable SELinux, which means that this and other daemons are still running inside a security container that will help to limit the damage if their security is compromised.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2008/03/29/making-selinux-allow-a-nonstandard-mysql-port-number-on-centos-51/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CentOS 5.1 Minimal VPS Install Guide</title>
		<link>http://www.pervasivecode.com/blog/2008/03/29/centos-51-minimal-vps-install-guide/</link>
		<comments>http://www.pervasivecode.com/blog/2008/03/29/centos-51-minimal-vps-install-guide/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 07:00:25 +0000</pubDate>
		<dc:creator>Jamie Flournoy</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.pervasivecode.com/blog/2008/03/29/centos-51-minimal-vps-install-guide/</guid>
		<description><![CDATA[I&#8217;m working on a project that is deploying on CentOS 5.1, and I found it not entirely obvious how to install a really stripped down server, as a starting point for a lean and mean, hardened production server. Since I&#8217;m doing work on this at home on VMWare, and it&#8217;s being deployed on a VPS [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project that is deploying on CentOS 5.1, and I found it not entirely obvious how to install a really stripped down server, as a starting point for a lean and mean, hardened production server. Since I&#8217;m doing work on this at home on VMWare, and it&#8217;s being deployed on a VPS initially (and probably will remain virtualized for ease of management as it scales up), this guide is specifically aimed at this kind of configuration.</p>
<p><span id="more-63"></span></p>
<p><b>Assumptions:</b></p>
<ul>
<li>this server uses an x86_64 CPU architecture, not i386 (or for an ultra-small disk footprint, consider i386 since it doesn&#8217;t need duplicate 64 and 32 bit glibc libraries)</li>
<li>this is a server VPS (running in VMware or Xen) so it isn&#8217;t interested in low-level hardware management</li>
<ul>
<li>no need for ACPI (sleep/hibernate)</li>
<li>no need for laptop CPU power reduction</li>
<li>no need for SMART disk monitoring (since the VPS disk is virtualized)</li>
<li>no need for MD (software RAID) since it&#8217;s a VPS; any RAID is happening at a lower level (host OS / dom0)</li>
<li>no need to use LVM2 to mirror a logical volume (again because RAID is handled outside of the VPS)</li>
<li>no need for bluetooth, hot-plug hardware, or PCMCIA</li>
</ul>
<li>this server may have more than one CPU (or may be given additional VCPUs later due to load) so multi-CPU support is desired</li>
<li>this is a headless server so no GUI features are desirable</li>
<li>there are no legacy services that need RPC</li>
<li>NFS will not be used</li>
<li>SELinux will be left in the default configuration (&#8221;Enforcing&#8221; the &#8220;Targeted&#8221; policy).</li>
</ul>
<p><b>Basic Installation:</b></p>
<p>Start with the Centos 5.1 x86_64 install DVD.<br />
Boot the DVD.<br />
Select English language and U.S. English keyboard layout.<br />
Choose to Install the OS (not upgrade).<br />
Choose &#8220;Remove linux partitions on selected drives and create default layout.&#8221;<br />
Select DHCP network configuration, or the static IP address for this server.<br />
  (I choose DHCP, and tell the DHCP server to use a specific IP for this host based on its Ethernet MAC address.)<br />
Choose the time zone the server is in (for me this is America/Los Angeles), and enable the &#8220;System clock uses UTC&#8221; option.<br />
Pick a complex root password (https://grc.com/passwords can generate one for you) and enter it.<br />
When given a chance to install additional tasks, uncheck everything (no additional tasks) and choose the &#8220;Customize now&#8221; radio button.<br />
In the next screen, go into every group and uncheck everything. (*Nothing* should be checked when you&#8217;re done. Be careful not to miss anything!)<br />
Confirm that you want the installer to begin the installation process. (For me this process took about 6 minutes.)<br />
Confirm that you want to reboot, and make sure that the server will boot from the hard disk instead of the installation media.<br />
When the server boots, log in as root. (You can disconnect from the console and use SSH instead at this point if it&#8217;s more convenient.)</p>
<p><b>More Minimizing:</b><br />
Run this command to tell yum to go grab the latest package info from out on the internet.<br />
  <code>yum grouplist</code><br />
Run this command to make sure you didn&#8217;t install anything other than the bare minimum:<br />
  <code>yum -C grouplist</code><br />
You shouldn&#8217;t see a section called &#8220;Installed Groups:&#8221;. If you do see it, it means you missed something you were supposed to disable in the previous section.<br />
In that case, run this to remove it and all the packages in it:<br />
  <code>yum -C groupremove SomeGroupName</code></p>
<p>You can also run this command to count how many packages have been installed already:<br />
  <code>yum -C list installed | wc -l</code><br />
The resulting count of packages installed should be 154.</p>
<p>Next, run &#8220;<code>chkconfig --list | grep 3:on</code>&#8221; to see what services are enabled.<br />
Several of them can safely be disabled (provided that the assumptions at the top of this guide are true), so run this:<br />
  <code>for i in haldaemon lvm2-monitor messagebus netfs; do chkconfig $i off; done</code><br />
These are useful and should stay enabled:<br />
  ip6tables<br />
  iptables<br />
  kudzu<br />
  mcstrans<br />
  network<br />
  restorecond<br />
  sshd<br />
  syslog<br />
If for some reason there are others that are still enabled that aren&#8217;t on that list, you&#8217;ll have to decide for yourself.</p>
<p>Run this command to remove a 9.7MB standalone documentation package that you almost certainly won&#8217;t be reading from the server:<br />
  <code>yum -C remove Deployment_Guide-en-US</code></p>
<p>If you wish, run this command to update your installed packages to the latest stable version.<br />
  <code>yum update</code><br />
  As of 3/27/2008 this installed a new kernel, updated 19 other packages, and required a 54MB download.<br />
  Accept the CentOS package-signing GPG key when asked.<br />
  If a kernel update is installed, it would be a good idea to reboot soon to make sure it works.<br />
  You can also remove your old kernel (use &#8220;rpm -qa | grep kern&#8221; to find old ones) to save ~75MB.<br />
    <code>yum remove kernel-2.6.18-53.el5</code> NOTE! ONLY do this if you updated your kernel and have 2 installed now.</p>
<p><b>Useful Things You May Want To Install:</b></p>
<p>These packages are very useful for administering servers, deploying software and data to them, and performing backups:<br />
  <code>yum install bzip2 lsof man man-pages mlocate quota rsync sysstat vixie-cron wget which</code></p>
<p>If your server has more than 1 CPU you may wish to install irqbalance, to distribute interrupt servicing duty across CPUs:<br />
  <code>yum install irqbalance</code></p>
<p>This package makes the system boot slightly faster using a very simple, safe technique:<br />
  <code>yum install readahead</code></p>
<p>If you aren&#8217;t familiar with the vim text editor, you can install nano, which is less powerful but very easy to use:<br />
  <code>yum install nano</code></p>
<p>Have fun! Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pervasivecode.com/blog/2008/03/29/centos-51-minimal-vps-install-guide/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
