<?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>MAX POWER INDUSTRIES &#187; squid</title>
	<atom:link href="http://maxpowerindustries.com/tag/squid/feed/" rel="self" type="application/rss+xml" />
	<link>http://maxpowerindustries.com</link>
	<description></description>
	<lastBuildDate>Sat, 13 Mar 2010 11:56:35 +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>How To: Install and configure Squid on Mac OS X</title>
		<link>http://maxpowerindustries.com/2009/09/27/how-to-install-and-configure-squid-on-mac-os-x/</link>
		<comments>http://maxpowerindustries.com/2009/09/27/how-to-install-and-configure-squid-on-mac-os-x/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 03:37:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://maxpowerindustries.com/?p=44</guid>
		<description><![CDATA[What is Squid? Squid is a caching proxy server for the web. Whether you&#8217;re using it at home for just a few machines, or at an office for thousands of machines, it&#8217;s reliable, can help save bandwidth, and most importantly is relatively simple to get running. Requirements Xcode Tools must be installed, as you will [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is Squid?</strong><br />
Squid is a caching proxy server for the web.<br />
Whether you&#8217;re using it at home for just a few machines, or at an office for thousands of machines, it&#8217;s reliable, can help save bandwidth, and most importantly is relatively simple to get running.</p>
<p><strong>Requirements</strong></p>
<ul>
<li>Xcode Tools must be installed, as you will be compiling Squid from its source code. Xcode Tools is available on you Mac OS X Install discs, and also from <a title="Apple Developer Connection" href="http://developer.apple.com/" target="_blank">http://developer.apple.com/</a></li>
<li>Knowledge of the command line interface</li>
<li>Administrator access</li>
</ul>
<p><strong>Installation and Configuration</strong></p>
<p>1. Download the Squid source code from here: <a title="Squid" href="http://www.squid-cache.org/" target="_blank">http://www.squid-cache.org/</a>. Follow the links and download the latest stable release. This guide was written for Squid v3.0 Stable 19  (.tar.gz download), but later versions will most likely follow the same process.</p>
<p>2. Open Terminal and cd to the location you downloaded the file to:</p>
<blockquote><p>cd ~/Downloads</p></blockquote>
<p>3. Extract the archive:</p>
<blockquote><p>tar zxvf squid-3.0.STABLE19.tar.gz</p></blockquote>
<p>4. Go into the squid source code directory:</p>
<blockquote><p>cd squid-3.0.STABLE19</p></blockquote>
<p>5. Run the configure script, with the location of the squid installation. I always use the below, because it separates the squid install into a specific directory instead of sprawling files all over the system (which makes it harder to remove later, if you need to)</p>
<blockquote><p>./configure &#8211;prefix=/usr/local/squid</p></blockquote>
<p>6. Compile squid with the following command:</p>
<blockquote><p>make all</p></blockquote>
<p>7. Install squid with the following command:</p>
<blockquote><p>sudo make install</p></blockquote>
<p>8. Now that squid is installed, it needs some configuring:</p>
<blockquote><p>cd /usr/local/squid/etc/</p></blockquote>
<p>9. Edit the default configuration file:</p>
<blockquote><p>sudo vi squid.conf</p></blockquote>
<p>10. Add an ACL to allow all hosts on your network to use squid. Locate the line:</p>
<blockquote><p>http_access allow localnet</p></blockquote>
<p>Add the following line above it:</p>
<blockquote><p>http_access allow all</p></blockquote>
<p>11. Set the cache_dir (the location to store the cache files). Locate the line:</p>
<blockquote><p># cache_dir ufs /usr/local/squid/var/cache 100 16 256</p></blockquote>
<p>Uncomment the line, and change the path to one of your choosing. E.g.:</p>
<blockquote><p>cache_dir ufs /Volumes/Misc/var/cache 5000 16 256</p></blockquote>
<p>12. The default maximum_object_size is 4MB. This means squid will only cache files smaller than 4MB. Not very helpful if you&#8217;re downloading large files (specifically, software updates). Locate the line:</p>
<blockquote><p># maximum_object_size 4096 KB</p></blockquote>
<p>Change the line to something more appropriate for your needs. E.g.:</p>
<blockquote><p>maximum_object_size 214096 KB</p></blockquote>
<p>13. By default, squid will allow go into a &#8220;shutdown pending&#8221; mode if it receives a SIGTERM or SIGHUP. This tends to make the Mac shutdown process pause for some time while it waits for Squid to exit. I&#8217;ve worked around this by changing this line:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 621px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"># shutdown_lifetime 30 seconds</div>
<blockquote><p># shutdown_lifetime 30 seconds</p></blockquote>
<p>to this:</p>
<blockquote><p>shutdown_lifetime 2 seconds</p></blockquote>
<p>14. Set other options as necessary.</p>
<p>15. Ensure the cache directory exists, and that permissions are correct. By default, squid will run as &#8220;nobody&#8221;, so the cache directory and those under it need permission to access it.</p>
<p>cd /Volumes/Misc/var/</p>
<p>sudo mkdir cache</p>
<p>sudo chown -R nobody:nobody cache</p>
<p>16. Ensure the log directory exists, and that permissions are correct. Squid will be logging to /usr/local/squid/var/logs.</p>
<blockquote><p>sudo mkdir /usr/local/squid/var/logs</p>
<p>sudo chown nobody /usr/local/squid/var/logs</p></blockquote>
<p>17. Start squid for the first time manually. This is required in order for it to create the necessary cache directories:</p>
<blockquote><p>cd /usr/local/squid/sbin</p>
<p>sudo ./squid -z</p></blockquote>
<p>18. Squid will create the cache directories and then exit.</p>
<p>19. Start squid in the foreground and test it out. Configure a web browser to use the proxy server localhost:3128, then run squid again:</p>
<blockquote><p>sudo ./squid</p></blockquote>
<p>20. If you can access the web via the proxy, then you&#8217;re all set. Otherwise, review settings and check the logs (/usr/local/squid/var/logs/ &#8211; cache.log and access.log)</p>
<p>21. Stop squid, as we&#8217;ll now configure it to run at startup:</p>
<blockquote><p>sudo ./squid -k shutdown</p>
<p>ps -ef | grep squid</p></blockquote>
<p>22. Download this file: <a href="http://maxpowerindustries.com/files/org.squid.squid.plist">http://maxpowerindustries.com/files/org.squid.squid.plist</a></p>
<p>23. Locate the file and copy it to /Library/LaunchDaemons.</p>
<p>24. Fix permissions on the startup item:</p>
<blockquote><p>cd /Library/LaunchDaemons</p>
<p>sudo chown -R root:wheel Squid</p>
<p>sudo chmod 644 org.squid.squid.plist</p></blockquote>
<p>25. Restart your Mac and confirm that Squid is running once it starts back up. Open Terminal, and run:</p>
<blockquote><p>ps -ef | grep squid</p></blockquote>
<p>26. Configure other machines on your network to use Squid.</p>
<p>That&#8217;s pretty much it for a basic config on Mac OS X for a home user. It&#8217;s functional, but by no means completely secure and optimised.</p>
<p>Its worth configuring squid log rotations as well, since the logs can grow quickly. Setting up a cron job to run &#8216;/usr/local/squid/sbin/squid -k rotate&#8217; will overcome this. If you want to archive the logs, you might want to set up your own scripts to do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://maxpowerindustries.com/2009/09/27/how-to-install-and-configure-squid-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
