<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mark Shrader's Weblog</title>
	<atom:link href="http://markshrader.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://markshrader.wordpress.com</link>
	<description>A cool place I can post stuff</description>
	<lastBuildDate>Tue, 25 Jan 2011 16:40:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='markshrader.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mark Shrader's Weblog</title>
		<link>http://markshrader.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://markshrader.wordpress.com/osd.xml" title="Mark Shrader&#039;s Weblog" />
	<atom:link rel='hub' href='http://markshrader.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Set up Linux (Debian), Apache, MySQL, PHP, Ruby on Rails, Mongrel, PHPMyAdmin, GD and more &#8212; from scratch</title>
		<link>http://markshrader.wordpress.com/2007/10/14/step-by-step-debian-webserver/</link>
		<comments>http://markshrader.wordpress.com/2007/10/14/step-by-step-debian-webserver/#comments</comments>
		<pubDate>Sun, 14 Oct 2007 04:29:05 +0000</pubDate>
		<dc:creator>markshrader</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[aliases]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://markshrader.wordpress.com/2007/10/14/step-by-step-debian-webserver/</guid>
		<description><![CDATA[Are you tired of trying to learn Linux while your feet are hopelessly stuck in the quicksand of Windows? Yeah, me too. Trust me I know the drill well &#45;- no way to create a real world learning space &#45;- no way to use the tools you already own to build a free and capable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=markshrader.wordpress.com&amp;blog=1905618&amp;post=1&amp;subd=markshrader&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><font color="#000000">Are you tired of trying to learn Linux while your feet are hopelessly stuck in the quicksand of Windows? Yeah, me too.</font></p>
<p><font color="#000000">Trust me I know the drill well &#45;- no way to create a real world learning space &#45;- no way to use the tools you already own to build a free and capable &#8220;real world&#8221; Linux webserver, without blindly clunking around in dangerous disk partitions &#8230;</font></p>
<p><font color="#000000">Well I was tired too, so I set out to find a way to accomplish my goal without having to spend any more money, yet still create a real world installation that I could use myself. I wanted to document my successes every step of the way, so that I could learn as much as I could as quickly as I could, and then be able to share it with you when I was done.</font></p>
<p><font color="#000099" size="3"><strong>Here&#8217;s what we&#8217;ll be building:</strong></font></p>
<p><font color="#000099">* A virtual Debian Linux machine (Etch), right on your Windows box! (No messy drive partitioning required, I promise!)<br />
* An SSH server so you can connect to Linux with PuTTY<br />
* An Apache webserver (2.2)<br />
* MySQL database (5.0.32 for Debian Etch)<br />
* PHP5<br />
* PHPMyAdmin for MySQL administration<br />
* Ruby on Rails (1.8.5 and 1.2.4 respectively)<br />
* Mongrel &#8211; (1.0.1) fast and clusterable Rails specific webserver<br />
* GD graphics tool for PHP<br />
* Postfix</font></p>
<p><font color="#000000"><span id="more-1"></span></font></p>
<p><font color="#000000">One thing right off the rip: I am NOT a Linux Guru. I am posting these notes for two simple reasons: 1) So that online friends like you can find help building a Linux webserver and 2) so that I can learn more about the process as well.</font></p>
<p><font color="#000000">Second thing: This process took a long damn time and was very difficult to figure out and sequence (I had to scour the internet for each little piece). So if you see an error or a better way to do it, be nice; let&#8217;s figure this thing out together.</font></p>
<p><font color="#000000">Thirdly: Much thanks and gratitude to a lot of friends here on the Internet (Ezra at EngineYard.com to name one). Searching other people&#8217;s online notes really gave me clues and insight to the answers I needed, no matter how deeply buried in blogs they were. To those of you who have previously posted your notes on any of the above Linux subjects&#8230; I salute you!</font></p>
<p><font color="#000000">And fourth but certainly not least: Write back. Reply to this post. Share your insights on better methods, tighter security, and cool tips to help us along the way. It is my hope that this can be a cool resource for people like me who just need a helpful nudge over the line &#45;- so that more people like us can unravel this web-serving mystery called Linux.</font></p>
<p><font color="#000000">Okay, let&#8217;s get started&#8230;</font></p>
<p><font color="#000099" size="4"><strong>1&#41; DOWNLOAD LINUX DEBIAN:</strong></font> <font color="#000099">(Netinst ISO file)</font><br />
<font color="#000000">Why the Debian flavor of Linux? Since I am not the one to ask, many brilliant friends of mine have recommended it as a stable and relevant flavor. Also, since this will ultimately be used as a webserver on a real world box somewhere, we do not want a bunch of excess bloat if we can avoid it. Nothing is perfect, but we will try to keep it as thin as possible. (Save room for all of our wonderful content, right?) Go to debian.org and get the stable Etch netinst ISO file. At the time of this writing, it can be found here: <a href="http://cdimage.debian.org/debian-cd/4.0_r1/i386/iso-cd/debian-40r1-i386-netinst.iso">Get Debian 4.0_r1</a></p>
<p>Download it to your hard drive and remember where you put it.</font></p>
<p><font color="#000000">You will also need a copy of an ISO disk building program and a blank writable CD. For the ISO program, I recommend a great free Windows product from the folks at NTFS.com called Active@ ISO Burner which you can find here: <a href="http://www.ntfs.com/downloads/IsoBurner-Setup.exe">Active@ ISO Burner</a>. </p>
<p>If you already have something else installed, great! For the blank writable CD, any office supply store will do (Staples, OfficeMax, BestBuy, or even your local grocery store!)</font></p>
<p><font color="#000000">Once you have your ISO Burner installed (or whatever you use instead), burn the Debian ISO file you downloaded onto your new CD and label it with a permanent marker. You will need this new install disk several times during this process.</font></p>
<p><font color="#000099" size="4"><strong>2&#41; GET VMWARE SERVER:</strong></font><br />
<font color="#000000">Fortunately for us, the VMWare company has created a great new product called VMWare Server &#8211; And guess what? It&#8217;s free! (Thank you VMWare!)  You can get it here: <a href="http://download3.vmware.com/software/vmserver/VMware-server-installer-1.0.4-56528.exe">VMWare Server</a></font></p>
<p><font color="#000000">This product will allow us to create a real Linux machine right on our Windows box. All we have to do is give it some disk space and click a couple of buttons to set it up, and voila: Insto-Linux!</font></p>
<p><font color="#000000">(By the way, you can do this exact thing on your Intel Macintosh, but the VMWare product is called Fusion and they currently charge $79 dollars for it. I have tested this entire process on my Mac and where the Linux virtual machine is concerned, it works exactly the same.)</font></p>
<p><font color="#000000">You can download the program from their own website but be warned &#8212; it&#8217;s a pretty big file so you better go make cookies while you wait. Follow the link above and download the file (as of this writing, the latest version is 1.0.4), then go get a serial number: <a href="http://register.vmware.com/content/registration.html">Register here!</a> </p>
<p>You will need to fill out a simple form&#8230; no big deal and well worth it! Just answer the questions the best you can, and when you&#8217;re all done they will email you a serial number for installation of your free virtual server. It&#8217;s easy and just takes a few moments to get the &#8220;paperwork&#8221; completed. Do it! Get that baby downloaded! Once it finishes downloading and you have wiped the chocolate off your face, go ahead and install it. Have your new serial number handy when you do.</font></p>
<p><font color="#000099" size="4"><strong>3&#41; INSTALL VMWARE SERVER:</strong></font><br />
<font color="#000000">Locate the install file you downloaded (VMware-server-installer-1.0.4-56528.exe) and double-click to launch. (BTW, if you purchased the Mac version called Fusion, your install process will be slightly different.  Macs are easy, you&#8217;ll figure it out!)</font></p>
<p><font color="#000000">Follow the install process, agree to the license and select the &#8220;Complete&#8221; setup type. If you are prompted with a screen regarding a missing or incorrect IIS installation, don&#8217;t worry, just click ok and keep going. Follow the remaining default screens until you get to the final one. Click &#8220;Install.&#8221;</font></p>
<p><font color="#000000">When the installation is complete, click &#8220;Finish&#8221; and launch VMWare.</font></p>
<p><font color="#000099" size="4"><strong>4&#41; CREATE YOUR NEW VIRTUAL LINUX MACHINE:</strong></font><br />
<font color="#000000">At some point, you will be prompted for the serial number emailed to you from VMWare. Have that handy when you begin this install. Once VMWare opens, select &#8220;Local Host&#8221; and continue to the main Server Console. (Again, the Mac version behaves slightly different.)</font></p>
<p><font color="#000000">From there click the &#8220;New Virtual Machine&#8221; button. In the New Virtual Machine Wizard, first select a &#8220;Typical&#8221; configuration, then select Linux as the Guest Operating System, with a &#8220;Version&#8221; of Ubuntu. (Since there is no Debian option, we will be using a Ubuntu shell and installing Debian into that.)</font></p>
<p><font color="#000000">Next name your virtual machine. I use &#8220;DebianOnUbuntuPreset&#8221; to remind me which configuration I used. Next!</font></p>
<p><font color="#000000">I suggest the NAT network connection type so that your Debian machine can get to the internet through your Windows connection. We are using a minimal &#8220;Net Install&#8221; of Debian so some of the mods we make during our Linux setup will require Internet access.</font></p>
<p><font color="#000000">Next allocate your disk space for your virtual machine. The default space of 8GB seemed adequate yet small enough considering I will be building this image on a VPS someday, so I used it. Select Allocate all disk space now and click Finish. (Give VMWare a moment or three to allocate space.)</font></p>
<p><font color="#000000">Once you are ready to click the green arrow and &#8220;start this virtual machine,&#8221; place the Debian disk you burned earlier into your CD drive. It will need to be in place when we start the install.</font></p>
<p><font color="#000000">Ok, click it&#8230; click the green arrow! After a brief boot up, you will be looking at your very own Linux machine! How cool is that? Once you&#8217;re ready to begin the setup process, click your mouse inside the black area of your Debian screen and press Enter!</font></p>
<p><font color="#000000">(Note: Until we get SSH configured for access via PuTTY, we will have to use this black screen area in the VMWare Server Console to do all our work. Clicking in the screen area grabs and holds your cursor &#45;- at that time, the keyboard works in Linux. Pressing Ctrl-Alt releases the mouse and control returns to your PC. Again this will only be an issue until we get SSH configured for PuTTY.)</font></p>
<p><font color="#000099" size="4"><strong>5&#41; SETTING UP LINUX &#8211; PHASE 1:</strong></font><br />
<font color="#000000">If you haven&#8217;t done so yet, click your mouse in the black area of your Debian screen and press your Enter key. This will kick off the Linux install process.</font></p>
<p><font color="#000000">Use your UP and DOWN keys to move the Red selector around. Press Enter to make your selection. Some of my choices might not apply to you if you are from a different State and Country than I am. I will be listing choices as I made them according to my location and preferences. Obviously you should select yours based on YOUR location and preferences.</font></p>
<p><font color="#000099">Choose Language &gt; <font color="#009900"><strong>English</strong></font></font><br />
<font color="#000099">Choose Language, Choose Country &gt; <font color="#009900"><strong>United States</strong></font></font><br />
<font color="#000099">Select a Keyboard Layout &gt; <font color="#009900"><strong>American English</strong></font></font></p>
<p><font color="#000000">Linux will run a &#8220;Detecting Hardware&#8221; process, scan the CD and load additional components.</font><br />
<font color="#000000">Linux will then detect your host network and configure itself using DHCP</font></p>
<p><font color="#000099">Enter Hostname &gt; <font color="#009900"><strong>czhost</strong></font></font><br />
<font color="#000099">Enter Domain name &gt; <font color="#009900"><strong>chordzap.com</strong></font></font><br />
<font color="#000099">Partition disks, select method &gt; <font color="#009900"><strong>Guided, use entire disk</strong></font></font><br />
<font color="#000000">(Linux thinks the 8GB you gave it is the entire hard drive!  Very cool!)</font></p>
<p><font color="#000099">Select disk to partition &gt; <font color="#009900"><strong>SCSI 1</strong></font></font><br />
<font color="#000099">Partitioning scheme &gt; <font color="#009900"><strong>All files in one partition</strong></font></font><br />
<font color="#000099">Partitioning disks &gt; <font color="#009900"><strong>Finish partitioning and write changes to disk</strong></font></font><br />
<font color="#000099">Write changes to disk? &gt; <font color="#009900"><strong>YES</strong></font></font><br />
<font color="#000099">Select your time zone &gt; <font color="#009900"><strong>Pacific</strong></font></font><br />
<font color="#000099">Setup Root password &gt; <font color="#009900"><strong>deBian1</strong></font></font><br />
<font color="#000099">Repeat to confirm &gt; <font color="#009900"><strong>deBian1</strong></font></font><br />
<font color="#000099">User Real name &gt; <font color="#009900"><strong>Mark Shrader</strong></font></font><br />
<font color="#000099">Username for new account &gt; <font color="#009900"><strong>mark</strong></font></font><br />
<font color="#000099">New user password &gt; <font color="#009900"><strong>LiNuxEtCh2</strong></font></font><br />
<font color="#000099">Confirm user password &gt; <font color="#009900"><strong>LiNuxEtCh2</strong></font></font></p>
<p><font color="#000000">Linux installs &#8220;Base&#8221; system&#8230;</font></p>
<p><font color="#000099">Configure Package Manager, use network mirror? &gt; <font color="#009900"><strong>NO</strong></font></font><br />
<font color="#000099">Software selection &gt; <font color="#009900"><strong>Standard system</strong></font></font><br />
<font color="#000099">GRUB Boot Loader on Master Boot Record? &gt; <font color="#009900"><strong>YES</strong></font></font></p>
<p><font color="#000000">Once the installation completes, it will eject your Debian CD (at least mine did!).  Go ahead and remove the CD and press &#8220;Continue.&#8221;</p>
<p>(If Windows pops up any screens or questions you about the CD, just disregard and close them.  It&#8217;s just Windows way of trying to be helpful)</p>
<p>Check it out: Debian is now loading by itself on your virtual machine!</font></p>
<p><font color="#000099"><strong>LET&#8217;S LOGIN!</strong></font><br />
<font color="#000000">Once the boot process is complete, you will see your new linux cursor:</font><br />
<font color="#000099">{hostname} login:</font></p>
<p><font color="#000000">(since &#8220;czhost&#8221; is my hostname, mine looks like this)</font><br />
<font color="#000099">czhost login:</font></p>
<p><font color="#000000">(Don&#8217;t forget get to click your mouse in the black area of VMWare&#8217;s console if the Linux keyboard is not responding, I have forgotten this several times myself)</font></p>
<p><font color="#000000">At this time, type </font><font color="#009900"><strong>&#8220;root&#8221; </strong></font><font color="#000000">and press the [Enter] key</font><br />
<font color="#000000">(don&#8217;t include the quotes)</font></p>
<p><font color="#000000">Then type the password you created for root and [Enter] it.<br />
(Mine was </font><font color="#009900"><strong>&#8220;deBian1&#8243;</strong></font><font color="#000000"> remember?)</font></p>
<p><font color="#000000">If everything went according to plan, you should now be logged into your own virtual Linux machine!</font><br />
<font color="#000099">{hostname}:~#</font></p>
<p><font color="#000000">(since &#8220;czhost&#8221; is my hostname, mine looks like this)</font><br />
<font color="#000099">czhost:~#</font></p>
<p><font color="#000000">Ok, that&#8217;s the barebones setup. Let&#8217;s keep going&#8230;</font></p>
<p><font color="#000099" size="4"><strong>5b&#41; SETTING UP LINUX &#8211; PHASE 2:</strong></font></p>
<p><font color="#000099" size="4"><strong>6&#41; INSTALL SUDO:</strong></font><br />
<font color="#000000">By recommendation of all our Guru friends, we have to install SUDO so that all changes can be made from our user account instead of root. (Repeat after me, &#8220;Using root is bad&#8221;, &#8220;Using root is bad&#8221;)</font></p>
<p><font color="#000000">Let&#8217;s put the Debian installation CD back in and continue:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install sudo</strong></font></font></p>
<p><font color="#000000">Side Note: We will be using apt-get quite a bit. Do yourself a favor and look it up on Debian&#8217;s website. It&#8217;s a really great tool for installing packages.</font></p>
<p><font color="#000000">Next let&#8217;s edit the sudoers file to include the user we made in setup:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico /etc/sudoers</strong></font></font><br />
<font color="#000000">(pico is a simple editor I like to use, you can use whatever you like)</font></p>
<p><font color="#000000">Add the line</font><br />
<font color="#009900"><strong>{username} ALL=(ALL) ALL</strong></font><br />
<font color="#000000">into the sudoers file, under the &#8220;root&#8221; line. Make sure to replace {username} with the user you created earlier. (Doh!)</font></p>
<p><font color="#000000">**Mine looks like this:</font><br />
<font color="#009900"><strong>mark ALL=(ALL) ALL</strong></font></p>
<p><font color="#000000">Save the file and exit.</font></p>
<p><font color="#000099" size="4"><strong>7&#41; INSTALL SSH, AND CONNECT VIA PUTTY:</strong></font><br />
<font color="#000000">First you will have to download PuTTY. (If you&#8217;re using a Macintosh, it already has a terminal program, so downloading a TTY client won&#8217;t be necessary.) Ok Windows users, get it here: <a href="http://the.earth.li/%7Esgtatham/putty/latest/x86/putty.exe">PuTTY SSH Tool</a></font></p>
<p><font color="#000000">Next install the SSH server:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install openssh-server</strong></font></font></p>
<p><font color="#000000">Set SSH to a higher port for security:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico /etc/ssh/sshd_config</strong></font></font><br />
<font color="#000000">(locate port value 22 and change it to something higher like 8899)</font></p>
<p><font color="#000000">Another security suggestion, recommended by Ezra at EngineYard.com:<br />
In the same sshd_config file, change PermitRootLogin from yes to no</span><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico /etc/ssh/sshd_config</strong></font></font></p>
<p><font color="#009900"><strong>PermitRootLogin no</strong></font></p>
<p><font color="#000000">(This will prevent anyone from logging in as root through ssh. If you choose to do this, you will have to preface your root commands with SUDO. For the sake of this write-up I am sticking with root, however as soon as I can I will edit this blog to show the entire process using SUDO instead &#45;- the more secure method for accessing servers out in the real world.)</font></p>
<p><font color="#000000">Make SSH reload config file to activate port:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>/etc/init.d/ssh reload</strong></font></font></p>
<p><font color="#000000">Prepare to work through Putty now:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>ifconfig</strong></font></font><br />
<font color="#000000">Locate the &#8220;inet addr&#8221; IP number in the &#8220;eth0&#8243; section, that will be your PuTTY address.</font></p>
<p><font color="#000000">Launch and run PuTTY (or whichever terminal program you prefer.)<br />
Enter the IP address from above into Host Name box.<br />
Make sure Port equals your change from above.<br />
Make SSH is selected.<br />
Click open.<br />
PuTTY will open an SSH screen and present a login.<br />
Login as you did before in VMWare&#8217;s console.</font></p>
<p><font color="#000099" size="4"><strong>8&#41; INSTALL DEBIAN UPDATES:</strong></font><br />
<font color="#000000">Open the sources.list file</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico /etc/apt/sources.list</strong></font></font><br />
<font color="#000000">And add these two locations to it:</font><br />
<font color="#009900"><strong>deb http://http.us.debian.org/debian etch main</strong></font><br />
<font color="#009900"><strong>deb http://security.debian.org/debian-security etch/updates main</strong></font><br />
<font color="#000000">Save and exit.</font></p>
<p><font color="#000000">Run updates against the locations you added:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get update</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get dist-upgrade</strong></font></font><br />
<font color="#000000">If a screen comes up telling you no changes have been made or the kernel has not been modified, don&#8217;t worry about it, just enter OK</font></p>
<p><font color="#000099" size="4"><strong>9&#41; INSTALL C COMPILER:</strong></font><br />
<font color="#000000">Before anything else, let&#8217;s get our C compiler ready for installation of Apache and Ruby:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install build-essential zlib1g-dev</strong></font></font></p>
<p><font color="#000099" size="4"><strong>10&#41; INSTALL APACHE 2.2:</strong></font><br />
<font color="#000000">Removes any Apache installations, if they exist:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>dpkg &#45;-purge apache apache2</strong></font></font></p>
<p><font color="#000000">Download Apache source and compile it:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>wget http://apache.rmplc.co.uk/httpd/httpd-2.2.4.tar.gz</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>tar xzvf httpd-2.2.4.tar.gz</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd httpd-2.2.4</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>./configure &#45;-prefix=/usr/local/apache2 &#45;-enable-mods-shared=all &#45;-enable-deflate &#45;-enable-proxy &#45;-enable-proxy-balancer &#45;-enable-proxy-http</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>make</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>make install</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd ..</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>rm -rf httpd*</strong></font></font></p>
<p><font color="#000000">To determine which version of Apache is currently installed, use the following command:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>/usr/local/apache2/bin/httpd -v</strong></font></font><br />
<font color="#000000">(If this does not work for you, you may have Apache installed in a different directory location.  Try /etc/apache2/httpd -v)</font></p>
<p><font color="#000099" size="4"><strong>11&#41; INSTALL RUBY AND RAILS:</strong></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install ruby ruby1.8-dev ri rdoc</strong></font></font></p>
<p><font color="#000000">Create a symbolic link:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>ln -s /usr/bin/irb1.8 /usr/local/bin/irb</strong></font></font></p>
<p><font color="#000000">Install RubyGems:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz</strong></font></font></p>
<p><font color="#000000">Un-compress file:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>tar xvzf rubygems-0.9.0.tgz</strong></font></font></p>
<p><font color="#000000">Change directory:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd rubygems-0.9.0</strong></font></font></p>
<p><font color="#000000">Run Ruby setup:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>ruby setup.rb</strong></font></font></p>
<p><font color="#000000">Back out of Rubygems directory and remove it:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd ..</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>rm -rf rubygems*</strong></font></font></p>
<p><font color="#000000">Install Rails:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>gem install rails &#45;-include-dependencies</strong></font></font></p>
<p><font color="#000099" size="4"><strong>12&#41; INSTALL POSTFIX, MYSQL AND MONGREL:</strong></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install postfix</strong></font></font><br />
<font color="#000000">(Use the &#8220;Internet Site&#8221; default setting and whatever dotcom you want as the name. I used &#8220;chordzap.com&#8221;)</font></p>
<p><font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install mysql-server mysql-common mysql-client libmysqlclient15-dev libmysqlclient15off</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install libmysql-ruby1.8</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>gem install daemons gem_plugin mongrel mongrel_cluster &#45;-include-dependencies</strong></font></font><br />
<font color="#000000">Mongrel choice <font color="#009900"><strong>2. mongrel 1.0.1 (ruby)</strong></font></font><br />
<font color="#000000">Fastthread choice <font color="#009900"><strong>1. fastthread 1.0 (ruby)</strong></font></font></p>
<p><font color="#000000">As an aside, if you ever need to know what version of Mongrel you have installed, just enter:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>mongrel_rails &#45;-version</strong></font></font></p>
<p><font color="#000099" size="4"><strong>13&#41; INSTALL SOME ALIASES:</strong></font><br />
<font color="#000000">While we&#8217;re at it, let&#8217;s make a few aliases to simplify our lives, plus we&#8217;ll add them to bash.bashrc file so they&#8217;ll be ready for us again after our next server restart!</font></p>
<p><font color="#000000">Open the &#8220;/etc/profile&#8221; file for editing:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico /etc/profile</strong></font></font></p>
<p><font color="#000000">First add the following to the bottom of &#8220;profile&#8221; just before the &#8220;export PATH&#8221; statement:</font><br />
<font color="#009900"><strong>if [ "$BASH" ]; then<br />
&nbsp;&nbsp;&nbsp;. /etc/bash.bashrc<br />
fi</strong></font></p>
<p><font color="#000000">Then add your aliases to bash.bashrc. I&#8217;ve added the following aliases for my own convenience but you can add whatever you want. Just open /etc/bash.bashrc with pico and add these to bottom of the file:</font><br />
<font color="#009900"><strong>alias dochome=&#8217;cd /usr/local/apache2/htdocs/chordzap.com/docs&#8217;<br />
alias picohttpd=&#8217;pico /usr/local/apache2/conf/httpd.conf&#8217;<br />
alias picovhttpd=&#8217;pico /usr/local/apache2/conf/extra/httpd-vhosts.conf&#8217;<br />
alias apstop=&#8217;/usr/local/apache2/bin/apachectl stop&#8217;<br />
alias apstart=&#8217;/usr/local/apache2/bin/apachectl start&#8217;<br />
alias apload=&#8217;/usr/local/apache2/bin/apachectl restart&#8217;</strong></font></p>
<p><font color="#000099" size="4"><strong>14&#41; INSTALL PHP5:</strong></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install apache2-mpm-prefork mysql-server-5.0 php5 libapache2-mod-php5 php5-mysql php-pear</strong></font></font></p>
<p><font color="#000000">We need to make a few modifications to the Apache &#8220;httpd.conf&#8221; configuration file to enable PHP:</font></p>
<p><font color="#000000">First, locate the PHP libphp5.so file and verify its location.  Since we are going to refer to it in httpd.conf in a LoadModule statement, we need to make sure we know right where it is.  I found mine in the /usr/lib/apache2/modules directory.   (Use &#8220;find / -name libphp.so&#8221; to search out the file location)</font></p>
<p><font color="#000000">Now that we know where it is, let&#8217;s add it to the httpd file below the last LoadModule statement.  (My last statement shows &#8220;LoadModule rewrite_module lib&#8221; &#8211; put the following code under that line.)</font></p>
<p><font color="#000000">Open httpd.conf for editing:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>picohttpd</strong></font><font color="#000000">(this is an alias we made earlier)</font></font></p>
<p><font color="#000000">Then add this below the last LoadModule statement:</font><br />
<font color="#009900"><strong>LoadModule php5_module /usr/lib/apache2/modules/libphp5.so</strong></font></p>
<p><font color="#000000">We need to add these as well:</font><br />
<font color="#009900"><strong>AddType application/x-httpd-php .php .phtml<br />
AddType application/x-httpd-php-source .phps</strong></font><br />
<font color="#000000">I put mine outside of a Directory condition for now, as shown below:</font></p>
<p><font color="#000000">(my two lines are here, right above the mod_mime_magic module section)</font><br />
<font color="#000099">AddType application/x-httpd-php .php .phtml<br />
AddType application/x-httpd-php-source .phps<br />
#<br />
# The mod_mime_magic module allows the server to use various hints from the<br />
# contents of the file itself to determine its type. The MIMEMagicFile<br />
# directive tells the module where the hint definitions are located.<br />
#<br />
#MIMEMagicFile conf/magic</font></p>
<p><font color="#000099" size="4"><strong>15&#41; SETUP VIRTUAL HOST:</strong></font><br />
<font color="#000000">Make a couple of new domain directories. One for the domain:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>mkdir /usr/local/apache2/htdocs/chordzap.com</strong></font></font><br />
<font color="#000000">And one for the new home:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>mkdir /usr/local/apache2/htdocs/chordzap.com/docs</strong></font></font></p>
<p><font color="#000000">Now add an index.html file to test the new docs &#8220;home&#8221; directory above (alias: dochome):</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico index.html</strong></font></font></p>
<p><font color="#009900"><strong>&lt;html&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;head&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt; This is my test page &lt;/title&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/head&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;body&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h1&gt;Welcome to Local Virtual mydomain.com!&lt;/h1&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/body&gt;<br />
&lt;/html&gt;</strong></font></p>
<p><font color="#000000">Create a PHP test file as well called info.php:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico info.php</strong></font></font><br />
<font color="#000000">Add this simple code to it</font><br />
<font color="#009900"><strong>&lt;?php<br />
&nbsp;&nbsp;&nbsp;phpinfo&#40;&#41;;<br />
?&gt;</strong></font></p>
<p><font color="#000000">Now un-document the following line in httpd.conf doc:<br />
(use the alias)</font> <font color="#009900"><strong>picohttpd</strong></font></p>
<p><font color="#000099">#Virtual hosts<br />
#Include conf/extra/httpd-vhosts.conf <font color="#000000">&lt;- TAKE THE POUND SIGN OFF!</font></font></p>
<p><font color="#000000">Now edit the /usr/loca/apache2/conf/extra/httpd-vhosts.conf document:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>picovhttpd</strong></font></font></p>
<p><font color="#000000">Add the following virtual host, and document-out others:</font></p>
<p><font color="#009900"><strong>&lt;VirtualHost *:80&gt;<br />
&nbsp;&nbsp;&nbsp;#Basic setup<br />
&nbsp;&nbsp;&nbsp;ServerAdmin webmaster@chordzap.com<br />
&nbsp;&nbsp;&nbsp;ServerName www.chordzap.com<br />
&nbsp;&nbsp;&nbsp;DocumentRoot /usr/local/apache2/htdocs/chordzap.com/docs<br />
&nbsp;&nbsp;&nbsp;&lt;Directory /usr/local/apache2/htdocs/chordzap.com/docs&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Order Deny,Allow<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allow from all<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Don&#8217;t show indexes from directories<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Options -Indexes<br />
&nbsp;&nbsp;&nbsp;&lt;/Directory&gt;<br />
&nbsp;&nbsp;&nbsp;ErrorLog logs/chordzap.com-error_log<br />
&nbsp;&nbsp;&nbsp;CustomLog logs/chordzap.com-access_log common<br />
&lt;/VirtualHost&gt;</strong></font></p>
<p><font color="#000000">By the way, at some point an incorrect installation of Apache2 is being autostarted by the system.  (I need a guru buddy to help out here &#45;- it looks like somewhere in my code Apache got installed twice??)  Anyway, there is a ports.conf file which points to Listen 80 and ties up port 80 preventing it from being started by the installation we want to use:</font></p>
<p><font color="#000000">Change incorrect Listen 80 reference to 81</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>pico /etc/apache2/ports.conf</strong></font></font><br />
<font color="#000000">Then turn off autostarting for that installation:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>update-rc.d -f apache2 remove</strong></font></font></p>
<p><font color="#000000">Stop the old server:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>/etc/init.d/apache2 stop</strong></font></font><br />
<font color="#000000">Then use the new alias we made and start the new server:</font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apstart</strong></font></font></p>
<p><font color="#000099" size="4"><strong>16&#41; TEST APACHE AND PHP:</strong></font><br />
<font color="#000000">Now go out to Windows and test your new Linux virtual host settings within any browser:<br />
<a href="http://192.168.x.x/">http://192.168.x.x/</a> (change the x.x to the numbers you found earlier in &#8220;ifconfig&#8221;)</font><br />
<font color="#000000">Do the same with your PHP test page:<br />
<a href="http://192.168.x.x/">http://192.168.x.x/info.php</a> (don&#8217;t forget to change the x.x)</font></p>
<p><font color="#000099" size="4"><strong>17&#41; TEST RUBY AND RAILS AND MONGREL:</strong></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd /usr/local/apache2/htdocs/chordzap.com</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>mkdir rails</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd rails</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>rails test</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>cd test</strong></font></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>mongrel_rails start -d -p 8000</strong></font></font><br />
<font color="#000000">Now open your browser to: <a href="http://192.168.x.x:8000/">http://192.168.x.x:8000/</a> to see default Rails page (ahem&#8230; yep, remember the x.x)</font></p>
<p><font color="#000099" size="4"><strong>18&#41; INSTALL GD &#8211; IMAGE PROCESSING FOR PHP:</strong></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install php5-gd</strong></font></font><br />
<font color="#000000">Restart Apache (alias=apload)</font><br />
<font color="#000000">Open info.php again to check if GD is included in the info screen dump</font></p>
<p><font color="#000099" size="4"><strong>19&#41; INSTALL MYPHPADMIN FOR MYSQL:</strong></font><br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>apt-get install phpmyadmin</strong></font></font><br />
<font color="#000000">(as of this writing: version 2.9.1.1-4)</font></p>
<p><font color="#000000">Add index.php to DirectoryIndex of httpd.conf file</span><br />
<font color="#000099">DirectoryIndex index.html <font color="#009900"><strong>index.php</strong></font></font></p>
<p><font color="#000000">Add the following alias and markup code to the same Virtual Host tag we created above in the httpd-vhosts.conf file. (Alias=picovhttpd)</span></p>
<p><font color="#000000">(Add the chunk of code below between the</font><br />
<font color="#000099">&lt;/Directory&gt;</font><br />
<font color="#000000">and the</font><br />
<font color="#000099">ErrorLog logs/chordzap.com-error_log</font><br />
<font color="#000000">lines.)</font></p>
<p><font color="#000000">This is the chunk:</font><br /> <br />
<font color="#000099">Alias /phpmyadmin /usr/share/phpmyadmin<br />
&lt;Directory /usr/share/phpmyadmin&gt;<br />
&nbsp;&nbsp;&nbsp;# Restrict phpmyadmin access to just my workstation<br />
&nbsp;&nbsp;&nbsp;Order Deny,Allow<br />
&nbsp;&nbsp;&nbsp;Deny from all<br />
&nbsp;&nbsp;&nbsp;Allow from 192.168.32.1 ( &lt;- your Windows workstation IP)<br />
&lt;/Directory&gt;</font></p>
<p><font color="#000000">Now pico the /etc/phpmyadmin/config.inc.php file and make sure the following lines look like this:</font></p>
<p><font color="#000000">(BE SURE TO UNCOMMENT THE LINES!! &#8211; Screwed me up for hours!)</font><br />
<font color="#000099">$cfg['Servers'][$i]['auth_type'] = <font color="#009900"><strong>&#8216;http&#8217;</strong></font>;</font><br />
<font color="#000099">$cfg['Servers'][$i]['user'] = <font color="#009900"><strong>&#8216;root&#8217;</strong></font>;</font><br />
<font color="#000099">$cfg['Servers'][$i]['password'] = <font color="#009900"><strong>&#8221;</strong></font>;</font></p>
<p><font color="#000000">Now change the password:</font><br /> <br />
<font color="#000099">{hostname}~# <font color="#009900"><strong>mysql -u root -p</strong></font></font><br />
<font color="#000099">Enter password: <font color="#009900"><strong>[ENTER]</strong></font></font><br />
<font color="#000000">(since there is no password)</font></p>
<p><font color="#000000">Now enter the command:</font><br />
<font color="#000099">mysql&gt; <font color="#009900"><strong>set password = password(&#8216;???&#8217;);</strong></font></font><br />
<font color="#000000">Just change ??? to whatever you want your new password to be.</font></p>
<p><font color="#000000">To change Login user from &#8216;root&#8217; to something else:<br />
Edit the User table in phpmyadmin, Browse and change &#8216;User&#8217; value to whatever you want.<br />
Edit the /etc/phpmyadmin/config.inc.php file and make sure the ['hostname'] and ['user'] values match what is in your mysql User table &#8211; leave ['password'] alone.<br />
Once changes are made in config.inc.php, restart server (alias: apload) to be sure values are initialized.</p>
<p>MySQL Login thoughts:<br />
If the $cfg settings for ['auth_type'] and ['user'] remain &#8216;http&#8217; and &#8216;root&#8217; respectively, (or whatever ['user'] is current set to), then mysql&gt; set password = password(&#8221;); can be used without having to change config.inc.php and restart the server&#8230; Since auth_type is http, the phpmyadmin login dialog will immediately respond to the new password as long as the user remains unchanged.</p>
<p>Well friends, that&#8217;s it. Like I said at the beginning of this posting, I am not a guru, so use your noggin when you need to. Almost every question you could ever ask is posted on the Internet, so buckle in and do a little homework&#8230; it pays off in the long run! Take your time and have fun!!</font></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/markshrader.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/markshrader.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/markshrader.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/markshrader.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/markshrader.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/markshrader.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/markshrader.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/markshrader.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/markshrader.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/markshrader.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=markshrader.wordpress.com&amp;blog=1905618&amp;post=1&amp;subd=markshrader&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://markshrader.wordpress.com/2007/10/14/step-by-step-debian-webserver/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/28853b7fcbe04d402a8d84f38613550a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mshrader</media:title>
		</media:content>
	</item>
	</channel>
</rss>
