<?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>semioticpixels scratch pad &#187; crib notes</title>
	<atom:link href="http://www.semioticpixels.com/category/crib-notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.semioticpixels.com</link>
	<description></description>
	<lastBuildDate>Sun, 23 May 2010 20:07:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Plone 2 -&gt; Plone 3 Migration: Setting up</title>
		<link>http://www.semioticpixels.com/2010/03/plone-2-plone-3-migration-setting-up/</link>
		<comments>http://www.semioticpixels.com/2010/03/plone-2-plone-3-migration-setting-up/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 01:22:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[plone]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=270</guid>
		<description><![CDATA[I have 2 old Plone 2.0 websites running on a single Zope instance that I need to:

migrate from it&#8217;s ancient host to a more modern server
upgrade to Plone 3

I&#8217;m migrating away from a 32 bit Red Hat 7(!) server to a 64 bit Ubuntu Hardy Virtual Machine.  The reasons should be obvious from that [...]]]></description>
			<content:encoded><![CDATA[<p>I have 2 old Plone 2.0 websites running on a single Zope instance that I need to:</p>
<ol>
<li>migrate from it&#8217;s ancient host to a more modern server</li>
<li>upgrade to Plone 3</li>
</ol>
<p>I&#8217;m migrating away from a 32 bit Red Hat 7(!) server to a 64 bit Ubuntu Hardy Virtual Machine.  The reasons should be obvious from that statement alone, but in short:  Red Hat 7 reached its end-of-life years ago.  It&#8217;s stable (so far) but all system maintenance has to be done manually with no package or dependency management.  There are many benefits to running within a virtualized environment, namely that I can clone it as many times as I like to develop and test other websites without having to set up a whole new server, and it simplifies our redundancy and backup process. </p>
<p>Anyway, this article is both a cheatsheet and an historical commentary for when I or someone else is trying to solve a problem and has a WTF moment regarding how and why things are set up the way they are. </p>
<p>The server environment I&#8217;m migrating away from is:<br />
- Server: Zope/(Zope 2.7.3-0, python 2.3.3)<br />
- ZServer/1.1<br />
- Plone/2.0.3</p>
<p>I&#8217;ll also be upgrading from Apache 1.3 to Apache 2 and switching from Squid to Varnish for caching </p>
<h3> Getting started: Migrating from Red Hat 7.3 to a Ubuntu 8 VM</h3>
<p>Zope is an &#8220;in-place&#8221; installation, which means it runs from the directory that you put it in.  This is nice and simple, makes it easier to run different versions of Zope on the same server with associated different versions of Python and Plone and, theoretically it should be easy to move to another system altogether.</p>
<p>So, my first pass, I rsynced the Zope directory over from the old server to the new one and tried to compile Python and Zope to see what would happen.  Unfortunately, when I compiled Python, I got a bunch of errors that indicated my version of  Python was optimized for a 32 bit system and &#8230; the new VM is 64 bit. E.g. </p>
<p><code>`Parser/tokenizer_pgen.o' is incompatible with i386:x86-64 output</code></p>
<p>Python  2.3.7 was the oldest version that I could get running on the new VM that didn&#8217;t throw 32 bit errors.  I briefly considered re-compiling Python 2.3.3 with -m32 option to GCC and I could have spent quite a lot of time researching and very likely could have gotten 2.3.3 running on the VM but 2.3.7 was a bugfix release and the most stable of the 2.3 releases and should work fine so I chose to save time by going with it.  We&#8217;ll see if I regret that later.  I was also reminded in the course of this process to clean up my mess with </p>
<p><code>$ sudo make clean</code></p>
<p>When I compiled Python, the following error occurred: <code> Can't locate Tcl/Tk libs and/or headers</code>, so I had to install the tcl/tk libraries (added to setup below)</p>
<p>Plone/2.0.3 is no longer available for download, although I was able to locate a copy of Plone/2.0.5.  I don&#8217;t have a development server to upgrade the website to 2.0.5 so if I have to use it, I  may have to keep my fingers crossed. Since Plone is installed as a Zope Product and doesn&#8217;t require compilation, I will first try to copy over the Products directory of the website and see if it&#8217;ll just work.</p>
<p>I will also need to install PIL and PyXML</p>
<p>When I compiled Zope the first time, I got error messages that zlib was missing. It turns out that Ubuntu ships with zlib, but not zlib-dev installed.  Also, when researching that error, I came across a comment that I would need to install system support (libjpeg62) for PIL so those 2 lines have been added to the VM setup below.</p>
<h3>Initial VM setup</h3>
<h4>update and install basics</h4>
<p><code><br />
$ sudo apt-get install update<br />
$sudo apt-get upgrade<br />
make sure gcc is up to date<br />
$sudo apt-get install build-essential<br />
$sudo apt-get install zlib1g zlib1g-dev libjpeg62 libjpeg62-dev tcl tcl-dev tk tk-dev vim-full lynx<br />
</code></p>
<p>update the locate db so you can find stuff </p>
<p><code>$sudo updatedb</code></p>
<p>change root password<br />
<code>$sudo passwd</code></p>
<p>create a user with sudo privileges:<br />
<code>$ useradd -m -c "real name" -s /bin/bash chris</code></p>
<p>The flags create a home directory with skel profile defaults and this account is linked to the defaults for bash shell, which is important if you like syntax coloring and tab completion.<br />
<code>$passwd chris<br />
$sudo visudo<br />
</code></p>
<p>Find the line that says #User Privilege specification and add<br />
<code><br />
chris ALL=(ALL) ALL<br />
shift ZZ to save and exit<br />
</code><br />
create zope user<br />
$useradd -m -c &#8220;zope&#8221; -s /bin/bash zope<br />
$passwd zope</p>
<p>Do not add zope user to the sudoers list.</p>
<p>Disable root login<br />
<code>$sudo vi /etc/ssh/sshd_config</code></p>
<p>Change &#8220;PermitRootLogin yes&#8221; to &#8220;PermitRootLogin no&#8221;<br />
Reload ssh<br />
<code>$sudo /etc/init.d/ssh reload</code></p>
<h3>create directory structure</h3>
<p>The Library directory in the below structure may look a little over-organized at first pass. However, my next project after completing this migration will be to upgrade from Plone 2.0.3 to Plone 3 which will require several interim upgrades.  This version of the website is running on Zope 2.7.3. Each interim upgrade will be installed to it&#8217;s respective directory within Library/Software keeping everything well organized and easy to roll back to if necessary.</p>
<p>in /usr/local</p>
<p>/usr/local/Zope<br />
&#8230;./Downloads: where downloads will be stored<br />
&#8230;./src: where software will be unarchived<br />
&#8230;./Library: where compiled software will be compiled to<br />
&#8230;&#8230;&#8230;./Software<br />
&#8230;&#8230;&#8230;&#8230;&#8230;/Zope273<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;../Python<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;./Zope<br />
&#8230;/Sites: where each website to be hosted lives<br />
&#8230;&#8230;&#8230;/instancename1<br />
&#8230;&#8230;../instancename2</p>
<p><code><br />
# cd /usr/local/Zope/Downloads<br />
# wget http://www.python.org/ftp/python/2.3.7/Python-2.3.7.tgz<br />
# wget http://www.zope.org/Products/Zope/2.7.0/Zope-2.7.0.tgz<br />
# wget http://internap.dl.sourceforge.net/sourceforge/plone/Plone-2.0.5.tar.gz<br />
# wget http://sourceforge.net/projects/pyxml/files/pyxml/0.8.4/PyXML-0.8.4.tar.gz<br />
# wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz</p>
<p>#cp * /usr/local/Zope/src/<br />
</code></p>
<h3>Install Python 2.3.7</h3>
<p>Build Python 2.3 from source with the following steps:<br />
<code><br />
cd /usr/local/Zope/src/<br />
tar -xvzf Python-2.3.7.tgz<br />
cd Python-2.3.7<br />
./configure --prefix=/usr/local/Zope/Library/Software/Zope273/Python<br />
make<br />
make install<br />
</code></p>
<h3> Install PIL</h3>
<p><a href=" http://www.pythonware.com/products/pil/">More info</a></p>
<p>At the time of this writing, PIL 1.1.6 is compatible with Python 1.5.2 and up and fixes some 64 bit compatibility errors in Python 2.5 (which we&#8217;re not using yet for this Zope installation)</p>
<p>On Ubuntu Hardy, you have to edit setup.py before installing PIL<br />
<code>#sudo vi /usr/local/Zope/src/Imaging-1.1.6/setup.py</code></p>
<p>find the line<br />
<code>#TCL_ROOT = None</code></p>
<p>and replace it with<br />
<code>TCL_ROOT = "/usr/include/tk"</code><br />
<code><br />
#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py build<br />
#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py install<br />
</code></p>
<h3>Install PyXML</h3>
<p><code>cd /usr/local/Zope/src/PyXML-0.8.4/</p>
<p>#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py build<br />
#/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 setup.py install<br />
</code></p>
<h4> Other recommended packages </h4>
<p>elementree has been recommended, but it&#8217;s not installed on the old system so I&#8217;m not going to worry about it atm.</p>
<p>Also, the http://plone.org/documentation/kb/setup-from-source plone article recommends installing DocFinder as an invaluable development tool, but again, I don&#8217;t need this to get the website running so I&#8217;m going to come back to it.</p>
<h3>install zope 2.7.3</h3>
<p>Build Zope 2.7 from source with the following steps:<br />
<code><br />
cd /usr/local/Zope/src<br />
tar -xvzf Zope-2.7.3.tgz<br />
cd Zope-2.7.3<br />
./configure --with-python=/usr/local/Zope/Library/Software/Zope273/Python/bin/python2.3 --prefix=/usr/local/Zope/Library/Software/Zope273/Zope<br />
make<br />
make install<br />
</code></p>
<h4>create zope instance(s)</h4>
<p>The zope user must have write access to create the directory. After the instance is created, edit #&#8221;effective-user zope&#8221; into the etc/zope.conf file, so if you start it as root later it should #su itself to the non-root user. Again: make install should be run as root, #mkzopeinstance.py should not.</p>
<p>Initially, when I tried to create an instance, it failed with the error:<br />
<code># /usr/local/Zope/Library/Software/Zope273/Zope/bin/mkzopeinstance.py: /usr/local/Zope/bin/python: bad interpreter: No such file or directory<br />
</code></p>
<p>I think this was a result of not cleaning up a bad compilation. To fix this edit the first line in  mkzopeinstance.py from<br />
<code>#!/usr/local/Zope/bin/python</code><br />
To<br />
<code>#!/usr/local/Zope/LIbrary/Software/Zope273/Zope/bin/python</code></p>
<p>When Zope is compiled, one of the last things it does is create a symbolic link from where you told Zope the python interpreter you wanted it to use lives to Zope/bin/python. mkzopeinstance.py is looking for that symbolic link, and not looking for python itself.  This provides further separation so that we could theoretically upgrade python without touching Zope and then that symbolic link would only need to be changed.</p>
<p>The instance needs to be created with the zope user, NOT root<br />
<code><br />
# su zope<br />
# /usr/local/Zope/Library/Software/Zope273/Zope/bin/mkzopeinstance.py<br />
# when prompted for the path to your instance, use:<br />
# /usr/local/Zope/Sites/instance1  .... and so forth for each site.<br />
</code></p>
<h4>test Zope</h4>
<p>For the first instance, you can test by running /usr/local/Zope/Sites/instance1/bin/runzope. OR running /usr/local/Zope/Sites/instance1/bin/zopectl start</p>
<p>Once loaded, this will make Zope accessible on http://localhost:8080 (unless you changed the port), with the Zope Management Interface available on http://localhost:8080/manage (obviously if you&#8217;re accessing a remote server, then localhost might not work and you need to use the IP address)</p>
<p>shut down zone by either hitting ctrl+c if runzope was used or by running /usr/local/Zope/Sites/instance1/bin/zopectl stop if zopectl was used to start zone.</p>
<h3>Install the website</h3>
<p><code><br />
cp originalSite/Products/* /usr/local/Zope/Sites/instance1/Products/<br />
cp originalSite/var/Data.fs /usr/local/Zope/Sites/instance1/var/</p>
<p>/usr/local/Zope/Sites/instance1/bin/zopectl start<br />
</code><br />
navigate to the ZMI localhost:8080/manage<br />
(Note that the admin login credentials will match the credentials of the site migrated, not the credentials you compiled Zope with)<br />
The website I migrated over, even though I physically placed the files in the instance1 directory within /usr/local/Zope/Sites/instance1 are in the ZMI under &#8220;Plone&#8221;</p>
<p>click the Root Folder of the ZMI<br />
check the box beside &#8220;Plone&#8221;<br />
click the &#8220;rename&#8221; button and rename it to your instance1 site<br />
(at this point I discovered a dependency on lynx which I&#8217;ve added to the apt-get list above)</p>
<p>navigate to localhost:8080/instance1 to view the website</p>
<p>On first pass, everything worked!</p>
<h4>users</h4>
<p>make sure that all the Zope files belong to the zope user<br />
cd /usr/local<br />
chown zope -R Zope<br />
chgrp zope -R Zope<br />
//////</p>
<h4>start Zope</h4>
<p>Start Zope with the following command:<br />
su zope<br />
/usr/local/Zope/Sites/dev/bin/zopectl start</p>
<h3>check it out</h3>
<p>Go to the http://mydomain.com:8080/manage, log in, create a new Plone site object. </p>
<h3>resources/references</h3>
<ul>
<li><a href="http://plone.org/documentation/kb/setup-from-source">setup from source</a></li>
<li><a href="http://plone.org/documentation/kb/robust-installation">plone installation</a></li>
<p><a href="http://www.python-forum.org/pythonforum/viewtopic.php?f=1&#038;t=10977">resolving tcl/tk error when installing PIL on Ubuntu Hardy</a></li>
</ul>
<p>Next up:</p>
<ul>
<li>VirtualHostMonster and Apache with mod_rewrite &amp; mod_proxy</li>
<li>caching: Cachefu, Pound, Squid, Varnish</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2010/03/plone-2-plone-3-migration-setting-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash settings on Mac Snow Leopard</title>
		<link>http://www.semioticpixels.com/2010/01/bash-settings-on-mac-snow-leopard/</link>
		<comments>http://www.semioticpixels.com/2010/01/bash-settings-on-mac-snow-leopard/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 09:51:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[development environment]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=193</guid>
		<description><![CDATA[I&#8217;ve been slowly migrating from my desktop to my laptop so I&#8217;ve been setting it up piecemeal.
Bash (Terminal) File and Directory Colors
I do a lot of work within Terminal and not having directory and file coloring drives me nuts after a while.  To add colors
cd ~/
vi .bash_profile

add

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

reload it by typing (in Terminal)
 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been slowly migrating from my desktop to my laptop so I&#8217;ve been setting it up piecemeal.</p>
<h3>Bash (Terminal) File and Directory Colors</h3>
<p>I do a lot of work within Terminal and not having directory and file coloring drives me nuts after a while.  To add colors</p>
<pre>cd ~/
vi .bash_profile
</pre>
<p>add<br />
<code><br />
export CLICOLOR=1<br />
export LSCOLORS=ExFxCxDxBxegedabagacad<br />
</code></p>
<p>reload it by typing (in Terminal)<br />
<code> source ~/.bash_profile</code></p>
<p>close out Terminal then start a new Terminal session. Do an <code>ls</code> and directories and files should now have color.  A more in-depth explanation is listed below in &#8220;references&#8221;</p>
<h3>References</h3>
<p><a href="http://www.geekology.co.za/blog/2009/04/enabling-bash-terminal-directory-file-color-highlighting-mac-os-x/">adding file and directory colors to Terminal</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2010/01/bash-settings-on-mac-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>$PATH settings on Mac Snow Leopard</title>
		<link>http://www.semioticpixels.com/2010/01/path-settings-on-mac-snow-leopard/</link>
		<comments>http://www.semioticpixels.com/2010/01/path-settings-on-mac-snow-leopard/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 09:47:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[development environment]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=205</guid>
		<description><![CDATA[Managing Paths
The problem with setting up an environment piecemeal is when you sit down to do something, you have to figure out what rabbit hole you&#8217;d gone down when you left off.  In this case, I remembered installing mysql, but usually the last thing I do when I install mysql is install phpmyadmin because [...]]]></description>
			<content:encoded><![CDATA[
<h3>Managing Paths</h3>
<p>The problem with setting up an environment piecemeal is when you sit down to do something, you have to figure out what rabbit hole you&#8217;d gone down when you left off.  In this case, I remembered installing mysql, but usually the last thing I do when I install mysql is install phpmyadmin because it&#8217;s such a handy productivity tool.  Well, there was no phpmyadmin on my system, but that could be because Snow Leopard came with PHP 5.3 out of the box which is incompatible with most of the popular PHP web applications out there.  </p>
<p>Anyhoo &#8230; so I started by checking my $PATH variable and was surprised by the output.</p>
<p><code>echo $PATH</code> gave me duplicates of /usr/local and /opt/local et. al. and had stuff in it that wasn&#8217;t in my ~/.profile </p>
<p>my ~/.profile had the following in it:<br />
<code><br />
export PATH=/usr/local/sbin:/usr/local/mysql/bin:$PATH<br />
##<br />
# Your previous /Users/username/.profile file was backed up as /Users/username/.profile.macports-saved_2009-12-29_at_11:21:58<br />
##<br />
# MacPorts Installer addition on 2009-12-29_at_11:21:58: adding an appropriate PATH variable for use with MacPorts.<br />
export PATH=/opt/local/bin:/opt/local/sbin:$PATH<br />
# Finished adapting your PATH environment variable for use with MacPorts.<br />
</code></p>
<p>and the second entry made by MacPorts was overriding the first entry.</p>
<p>Pretty funky. </p>
<h3>TheTao of Path Variables</h3>
<ol>
<li>/etc/profile is the default startup script for Bash, which is what I&#8217;m using. (If you&#8217;re using a different shell, then you may have a different startup script).  /etc/profile calls /usr/libexec/path_helper</li>
<li>path_helper first calls /etc/path and /etc/manpath which contain the initial path environment variables. /etc/path contains system-wide defaults:<br />
<code>/usr/bin<br />
/bin<br />
/usr/sbin<br />
/sbin<br />
/usr/local/bin<br />
</code></p>
<li>path_helper then looks for files in the directories: /etc/paths.d and  /etc/manpaths.d and appends the paths found there. On my system, /etc/paths.d and /etc/manpaths.d contain a file named X11 which simply contains the paths for X11.</li>
<li>After /etc/profile has called path_helper, it then looks for /etc/.bashrc.  I have a bashrc (no &#8220;.&#8221;), but my bashrc only has stuff in it specifying the bash shell prompt (<code>name-of-my-computer:directory username$</code>) </li>
<li>Bash next looks for ~/.bash_profile.  This is the file where you&#8217;ll <a href="http://www.semioticpixels.com/2010/01/bash-settings-…c-snow-leopard/">set file and directory colors</a> and could also be where you place your Path environment variables. Obviously, ~/ represents your user directory, so your settings will only be valid for your user.</li>
<li>Next, bash looks for ~/.bash_login. I don&#8217;t have this on my system so it&#8217;s ignored in my case</li>
<li>next, bash looks for ~/.profile which I <em>did</em> have on my system and is the file that XCode wrote to.  </li>
</ol>
<p>Another file that can contain path variables is ~/.MacOSX/environment.plist. This sets environment variables, including paths, for gui applications.  I&#8217;m not using it on my system so don&#8217;t have anything to say about it. </p>
<h3>Recap</h3>
<p>So, what that all means is that instead of exporting PATH environment variables to a .profile or .bash_profile in a user account directory, you (or your application) can, instead, make PATHs global by adding text files to the /etc/paths.d and /etc/manpaths.d directories.  </p>
<p>If you need to control the order of a path, then try this:<br />
 Add a line PATH=&#8221;" before the call to path_helper like this in /etc/profile:<br />
<code><br />
if [ -x /usr/libexec/path_helper ]; then<br />
        PATH=""<br />
        eval `/usr/libexec/path_helper -s`<br />
fi<br />
</code></p>
<p>All that said and done &#8230; I&#8217;ll continue using ~/.bash_profile because it&#8217;s got that warm fuzzy familiarity.  Personal preference, as always.</p>
<h3>References</h3>
<p><a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/path_helper.8.html">man page for path_helper</a><br />
<a href="http://www.opensource.apple.com/source/shell_cmds/shell_cmds-149/path_helper/path_helper.8>description of path_helper </a><br />
<a href="http://littlesquare.com/2008/01/24/upgraded-to-leopard-making-use-of-etcpathsd-and-path_helper/">making use of paths.d</a><br />
<a href="http://www.softec.st/en/OpenSource/DevelopersCorner/MasteringThePathHelper.html">mastering the path_helper</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2010/01/path-settings-on-mac-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rsync over ssh</title>
		<link>http://www.semioticpixels.com/2010/01/rsync-over-ssh/</link>
		<comments>http://www.semioticpixels.com/2010/01/rsync-over-ssh/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 19:29:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[data security]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=174</guid>
		<description><![CDATA[Rysnc from 1 linux box to another and keep the file structure identical
Delete files from the target directory that have been deleted in the source directory
rsync -avz -e ssh --delete  remoteuser@remotehost:/remote/dir/ /this/dir/
Note: the ending {/} is important if you don&#8217;t want to hose a directory.  
Backup a website on a linux box to [...]]]></description>
			<content:encoded><![CDATA[<h3>Rysnc from 1 linux box to another and keep the file structure identical</h3>
<p>Delete files from the target directory that have been deleted in the source directory<br />
<code>rsync -avz -e ssh --delete  remoteuser@remotehost:/remote/dir/ /this/dir/</code></p>
<p><em>Note:</em> the ending {/} is important if you don&#8217;t want to hose a directory.  </p>
<h3>Backup a website on a linux box to your windows machine</h3>
<p>rsync reads &#8220;:&#8221; in a filepath as a remote directory, so if you&#8217;re trying to rsync to &#8220;c://&#8221; rsync will be confused.  Instead of using windows syntax for filepaths, use the cygwin directory structure.</p>
<ol>
<li><a href="http://www.cygwin.com/cygwin-ug-net/setup-net.html">Install cygwin</a> to windows</li>
<li>test rsync and ssh are installed by typing from within the cygwin terminal:<br />
<code>rsync --version</code><br />
<code>ssh -l username somedomain</code>
</li>
<li>create a directory in c://cygwin named backups or whatever you want to call it.</li>
<li><code>rsync -avz -e ssh --delete  remoteuser@remotehost:/remote/dir/ /cygdrive/c/directoryname</code> Change the directory drive to whatever it should be</li>
</ol>
<h3>references</h3>
<p><a href="http://troy.jdmz.net/rsync/index.html">rsync over ssh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2010/01/rsync-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>recover mysql root password</title>
		<link>http://www.semioticpixels.com/2009/10/recover-mysql-root-password/</link>
		<comments>http://www.semioticpixels.com/2009/10/recover-mysql-root-password/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 17:00:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=67</guid>
		<description><![CDATA[You can recover MySQL database server password with following five steps.
Step # 1: Stop the MySQL server process.
Step # 2: Start the MySQL (mysqld) server/daemon process with the &#8211;skip-grant-tables option so that it will not prompt for password
Step # 3: Connect to mysql server as the root user
Step # 4: Setup new root password
Step # [...]]]></description>
			<content:encoded><![CDATA[<p>You can recover MySQL database server password with following five steps.</p>
<p>Step # 1: Stop the MySQL server process.</p>
<p>Step # 2: Start the MySQL (mysqld) server/daemon process with the &#8211;skip-grant-tables option so that it will not prompt for password</p>
<p>Step # 3: Connect to mysql server as the root user</p>
<p>Step # 4: Setup new root password</p>
<p>Step # 5:  Exit and restart MySQL server</p>
<p>Here are commands you need to type for each step (login as the root user):</p>
<h3>Step # 1 : <a href="http://www.cyberciti.biz/faq/mysql-startup-script-under-bsdlinux/">Stop mysql service</a></h3>
<p><code># /etc/init.d/mysql stop</code><br />
Output:</p>
<pre>Stopping MySQL database server: mysqld.</pre>
<h3>Step # 2: Start  MySQL server w/o password:</h3>
<p><code># mysqld_safe --skip-grant-tables &amp;</code><br />
Output:</p>
<pre>[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started</pre>
<h3>Step # 3: Connect to mysql server using mysql client:</h3>
<p><code># mysql -u root</code><br />
Output:</p>
<pre>Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt;</pre>
<h3>Step # 4: <a href="http://www.cyberciti.biz/faq/mysql-change-root-password/">Setup new MySQL root user password</a></h3>
<p><code>mysql&gt; use mysql;<br />
mysql&gt; update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';<br />
mysql&gt; flush privileges;<br />
mysql&gt; quit</code></p>
<h3>Step # 5: Stop MySQL Server:</h3>
<p><code># /etc/init.d/mysql stop</code><br />
Output:</p>
<pre>Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

[1]+  Done                    mysqld_safe --skip-grant-tables</pre>
<h3>Step # 6: <a href="http://www.cyberciti.biz/faq/how-do-i-access-mysql-server-from-the-shell-prompt-command-line/">Start MySQL server and test it</a></h3>
<p><code># /etc/init.d/mysql start<br />
# mysql -u root -p</code></p>
<p><a href="http://www.cyberciti.biz/tips/recover-mysql-root-password.html">reference</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2009/10/recover-mysql-root-password/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>managing plone logs</title>
		<link>http://www.semioticpixels.com/2009/09/managing-plone-logs/</link>
		<comments>http://www.semioticpixels.com/2009/09/managing-plone-logs/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 01:32:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[plone]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=47</guid>
		<description><![CDATA[1. Add rotation script to logrotate
sudo vi /etc/logrotate.conf
add
# system-specific logs may be also be configured here.
/usr/local/Zope/Sites/SiteName/log/Z2.log {
        rotate 5
        weekly
        compress
        size=100k
      [...]]]></description>
			<content:encoded><![CDATA[<h3>1. Add rotation script to logrotate</h3>
<p>sudo vi /etc/logrotate.conf</p>
<p>add</p>
<p># system-specific logs may be also be configured here.<br />
/usr/local/Zope/Sites/SiteName/log/Z2.log {<br />
        rotate 5<br />
        weekly<br />
        compress<br />
        size=100k<br />
        sharedscripts<br />
        postrotate<br />
#close and re-open all Zope log files (z2.log, event.log) The common idiom after rotating Zope log files<br />
               /bin/kill -s SIGUSR2 `cat /usr/local/Zope/Sites/SiteName/var/Z2.pid`<br />
        endscript<br />
}</p>
<p>/usr/local/Zope/Sites/SiteName/log/event.log {<br />
        rotate 5<br />
        weekly<br />
        compress<br />
        size=100k</p>
<p>}</p>
<h3>2. Test log rotation</h3>
<p>Do a test run of the rotation without actually rotating anything:</p>
<p><code>/usr/sbin/logrotate -d /etc/logrotate.conf</code></p>
<p>if the test run completes without any erros, force a rotation:<br />
<code>/usr/sbin/logrotate -f /etc/logrotate.conf</code></p>
<h3>3. Automate with crontab</h3>
<p>On RedHat, crontab may be set up with runparts e.g.<br />
<code><br />
# run-parts<br />
01 * * * * root run-parts /etc/cron.hourly<br />
02 4 * * * root run-parts /etc/cron.daily<br />
22 4 * * 0 root run-parts /etc/cron.weekly<br />
42 4 1 * * root run-parts /etc/cron.monthly<br />
</code></p>
<p>In this case, place a script in the directory where it should run regularly.  I&#8217;m going to rotate weekly for now, so I&#8217;m placing a script in /etc/cron.weekly and naming it zope.cron (you can name it whatever you want. Any script in this directory will run weekely</p>
<p><code><br />
sudo vi /etc/cron.weekly/zope.cron</p>
<p>#rotate Z2.log and event.log in SiteName</p>
<p>0 01 * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null2>&#038;1</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2009/09/managing-plone-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>installing plone on ubuntu/slicehost</title>
		<link>http://www.semioticpixels.com/2009/09/installing-plone-on-slicehost/</link>
		<comments>http://www.semioticpixels.com/2009/09/installing-plone-on-slicehost/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 02:00:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=36</guid>
		<description><![CDATA[Setting up the Slicehost Account
Update everything
sudo apt-get update
sudo apt-get upgrade
install vim full so you can edit files
apt-get install vim-full
update the &#8220;locate&#8221; db
sudo updatedb
Change the root password
sudo passwd
Set up Users
useradd zope (I like useradd because there&#8217;s no reason to have a home directory. If you want your user to have a home directory then use adduser [...]]]></description>
			<content:encoded><![CDATA[<h3>Setting up the Slicehost Account</h3>
<p><strong>Update everything</strong><br />
<code>sudo apt-get update</code><br />
<code>sudo apt-get upgrade</code></p>
<p><strong>install vim full so you can edit files</strong><br />
<code>apt-get install vim-full</code></p>
<p><strong>update the &#8220;locate&#8221; db</strong><br />
<code>sudo updatedb</code></p>
<p><strong>Change the root password</strong><br />
<code>sudo passwd</code></p>
<p><strong>Set up Users</strong><br />
<code>useradd zope</code> (I like useradd because there&#8217;s no reason to have a home directory. If you want your user to have a home directory then use <code>adduser</code> or <code>useradd -D zope</code> to create ~/home/zope)<br />
<code>passwd zope</code><br />
<code>useradd -m  -c "real name" -s /bin/bash auserwithsudoers</code> The flags create a home directory with skel profile defaults and this account is linked to the defaults for bash shell, which is important if you like syntax coloring and tab completion.<br />
<code>passwd auserwithsudoers</code><br />
<code>sudo visudo </code><br />
Find the line that says #User Privilege specification and add<br />
<code>auserwithsudoers ALL=(ALL) ALL</code><br />
<code>shift ZZ </code> to save and exit</p>
<p>Now log out as root and login as your new admin user and test sudo<br />
<code>su auserwithsudoers</code><br />
<code>sudo bash</code></p>
<p><strong> Disable root login</strong><br />
<code>su root</code><br />
<code>sudo vim /etc/ssh/sshd_config</code><br />
Change &#8220;PermitRootLogin yes&#8221; to &#8220;PermitRootLogin no&#8221;</p>
<p><strong>Reload the ssh config</strong><br />
<code>sudo /etc/init.d/ssh reload</code></p>
<h3>Ok! Now we&#8217;re ready to think about plone</h3>
<ol>
<li>Follow the plone install instructions <a href="http://www.semioticpixels.com/2007/12/install-plone-3-on-ubuntu-7-10/">here</a></li>
<li>install some products (<a href="http://plone.org/documentation/tutorial/third-party-products/installing">see plone documentation </a>on using buildout).  Here&#8217;s what I did to install a Press Release product
<ol>
<li>download the product. If there&#8217;s a choice of files, choose the one with the naming convention Products.package.tar.gz.  This is a python egg.</li>
<li><code>su zope<br />
vi /usr/local/Plone/zeocluster/buildout.cfg</code><br />
add the following:<br />
<code>[buildout]<br />
...<br />
eggs =<br />
Products.PressRelease<br />
</code><br />
and save (<code>ctrl + ZZ</code>)</li>
<li><code>sudo /usr/local/Plone/zeocluster/bin/buildout</code></li>
<li><code>sudo /usr/local/Plone/zeocluster/bin/plonectl restart</code></li>
<li>In each Plone site where you want to install the Product, go Site Setup&gt;Add/Remove Products and install the Product.</li>
</ol>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2009/09/installing-plone-on-slicehost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Gutsy Gibbon development server setup</title>
		<link>http://www.semioticpixels.com/2008/01/ubuntu-gutsy-gibbon-development-server-setup/</link>
		<comments>http://www.semioticpixels.com/2008/01/ubuntu-gutsy-gibbon-development-server-setup/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 17:36:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=15</guid>
		<description><![CDATA[I know there are plenty of articles and posts for setting up a development server. Yet I still find the need to write up the exact commands and process for my later self to refer to, especially since I haven&#8217;t found a clone function in VMware Fusion like the linux version has.  A pet [...]]]></description>
			<content:encoded><![CDATA[<p>I know there are plenty of articles and posts for setting up a development server. Yet I still find the need to write up the exact commands and process for my later self to refer to, especially since I haven&#8217;t found a clone function in VMware Fusion like the linux version has.  A pet &#8220;when-I-have-time&#8221; project would be to turn these steps into a bash script.</p>
<p>Again, the environment is <a href="http://releases.ubuntu.com/7.10/">Ubuntu Gutsy Gibbon</a></p>
<h2>Setting up a new LAMP server</h2>
<h3>File Permissions</h3>
<p>If you&#8217;re going to access your web directory from another computer, you&#8217;ll need to change the file permissions on the web directory so you can put files. For example, my development server is a Ubuntu virtual machine but I do some development in a Windows vm and some development on my mac. In both cases, I connect with my development server over an sftp client that&#8217;s integrated into my editor environment.</p>
<p><code>sudo chown yourusername /var/www</code><br />
alternatively,  you might create a new user like &#8220;web&#8221; or &#8220;www&#8221;. If  you&#8217;ll occasionally make your server public, you might want to create a user that does not have sudo access for an extra layer of security.<sup>1</sup></p>
<h3>install Apache 2</h3>
<p><code>sudo apt-get install apache2</code><br />
<code>sudo /etc/init.d/apache2 start</code><br />
test apache by navigating in browser to <a href="http://localhost">localhost</a>.<br />
place an index.html page into /var/www to test that&#8217;s all set up.</p>
<p>I like to stop apache while installing other things, but you can always restart it so it doesn&#8217;t really matter<br />
<code>sudo /etc/init.d/apache2 stop (or restart)</code></p>
<h3>Install php 5</h3>
<p><code>sudo apt-get install php5 libapache2-mod-php5</code><br />
restart apache so it registers with php<br />
<code>sudo /etc/init.d/apache2 restart</code><br />
test that it worked by placing a phpinfo file into /var/www<br />
create the file<br />
<code>vi /var/www/phpinfo.php</code><br />
then type<br />
<code>&lt;?php phpinfo(); &gt;</code></p>
<p>Navigate in browser to <a href="http://localhost/phpinfo.php">localhost/phpinfo.php</a> to see that it&#8217;s working</p>
<h3>install mysql server</h3>
<p><code>sudo apt-get install mysql-server</code><br />
<code>sudo apt-get install libapache2-mod-auth-mysql php5-mysql mysql-client</code></p>
<p>Before you start configuring files,  you need to install the full version of vi.  By default, ubuntu only comes with vim-tiny. You&#8217;ll know it&#8217;s vim-tiny when you try to edit a file with vi and the console reads out characters like ^B.  So,<br />
<code>sudo apt-get install vim-full</code></p>
<p>Now, tell php about mysql<br />
<code>sudo vi /etc/php5/apache2/php.ini</code></p>
<p>It doesn&#8217;t matter where you put it, but I like to put it under the line that says &#8220;Directory in which the loadable extensions (modules) reside&#8221;.<br />
<code> extension=mysql.so</code><br />
restart apache again.<br />
<code>sudo /etc/init.d/apache2 restart</code></p>
<h3>Install phpmyadmin</h3>
<p>This can be done the Ubuntu way or it can be done manually by installing phpmyadmin to /var/www like any other web application.</p>
<h4>The Ubuntu way</h4>
<p>the benefit to doing it this way is that phpmyadmin is installed as a managed package which means it will be updated by our lovely package manager, apt-get which saves us a little time. Since I use phpmyadmin on multiple virtual machines, this makes a cumulative difference.</p>
<p><code>sudo apt-get install phpmyadmin</code></p>
<p>tell apache where phpmyadmin actually lives (which is in /etc/phpmyadmin)<br />
<code>sudo vi /etc/apache2/apache2.conf</code><br />
You can place the following directive anywhere, but I prefer to place it under the line:<br />
<code># Include all the user configurations</code><br />
add the line<br />
<code>Include /etc/phpmyadmin/apache.conf</code></p>
<p>If you didn&#8217;t want to edit your apache.conf, you could always use a symlink instead.</p>
<p>navigate to <a href="http://localhost/phpmyadmin">localhost/phpmyadmin</a> to check that it&#8217;s working</p>
<h4>Some cleanup/maintenance/utility stuff</h4>
<p>If this is a fresh install, you probably need to run the locate database updater so you can use it.<br />
<code>sudo updatedb</code></p>
<p>Done with the LAMP setup! Next up &#8230; subversion and trac</p>
<h2>Footnotes</h2>
<ol class="footnotes"><li id="footnote_0_15" class="footnote">for more on managing user accounts see this <a href="http://www.reallylinux.com/docs/usersubuntu.shtml">O&#8217;Reilly article</a> or for an in-depth treatise that addresses best practices &#8211; check out my favorite reference book <a href="http://www.amazon.com/Essential-System-Administration-Third-Frisch/dp/0596003439/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1201113196&amp;sr=8-1">&#8220;Essential System Administration&#8221;</a>.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2008/01/ubuntu-gutsy-gibbon-development-server-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>install plone 3 on ubuntu 7.10</title>
		<link>http://www.semioticpixels.com/2007/12/install-plone-3-on-ubuntu-7-10/</link>
		<comments>http://www.semioticpixels.com/2007/12/install-plone-3-on-ubuntu-7-10/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 17:19:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crib notes]]></category>
		<category><![CDATA[linux server administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.semioticpixels.com/?p=3</guid>
		<description><![CDATA[This is on a freshly installed Ubuntu 7.10 (Gutsy Gibbon). Modify version numbers as needed

install g++
sudo apt-get install linux-headers-`uname -r` build-essential xinetd
download plone unified installer or in your terminal  type:
wget https://launchpad.net/plone/3.0/3.0.4/+download/Plone-3.0.4-UnifiedInstaller.tar.gz --no-check-certificate
tar -xvzf Plone-3.0.4-Unifiedinstaller-Rev3.tar.gz
cd Plone-3.0.4-Unifiedinstaller
If you need to change the install path for Plone, edit the PLONE_HOME variable in install.sh. I changed mine to [...]]]></description>
			<content:encoded><![CDATA[<p>This is on a freshly installed Ubuntu 7.10 (Gutsy Gibbon). Modify version numbers as needed</p>
<ol>
<li>install g++<br />
<code>sudo apt-get install linux-headers-`uname -r` build-essential xinetd</code></li>
<li>download <a href="http://plone.org/products/plone">plone unified installer</a> or in your terminal  type:<br />
<code>wget https://launchpad.net/plone/3.0/3.0.4/+download/Plone-3.0.4-UnifiedInstaller.tar.gz --no-check-certificate</code></li>
<li><code>tar -xvzf Plone-3.0.4-Unifiedinstaller-Rev3.tar.gz</code><br />
<code>cd Plone-3.0.4-Unifiedinstaller</code><br />
If you need to change the install path for Plone, edit the PLONE_HOME variable in install.sh. I changed mine to /usr/local/Plone304</li>
<li><code>sudo ./install.sh zeo</code></li>
<li> <code>cd /usr/local/Plone304/zeocluster</code><br />
and<br />
<code>sudo vi adminPassword.txt</code><br />
to view admin password</li>
<li> start Plone (first time will take a few minutes):<br />
<code> sudo /usr/local/Plone304/zeocluster/bin/startcluster.sh</code></li>
<li> navigate to localhost:8080 to check that zope is working</li>
<li> in localhost:8080/manage go to Root Folder, click on acl_users=&gt;users=&gt;admin and change admin password to something you&#8217;ll remember</li>
<li> from dropdown menu select Plone Site to create a new site</li>
<li> navigate to plone site: localhost:8080/ploneSiteName</li>
<li>navigate to zmi by: localhost:8080/ploneSiteName/manage</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.semioticpixels.com/2007/12/install-plone-3-on-ubuntu-7-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
