﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>PHP博客-四季无望</title><link>http://www.phpweblog.net/runpin/</link><description>只是忧伤。。。。。。</description><language>zh-cn</language><lastBuildDate>Tue, 16 Mar 2010 13:10:09 GMT</lastBuildDate><pubDate>Tue, 16 Mar 2010 13:10:09 GMT</pubDate><ttl>60</ttl><item><title>孤独的服务器</title><link>http://www.phpweblog.net/runpin/archive/2008/06/05/4499.html</link><dc:creator>四季无望</dc:creator><author>四季无望</author><pubDate>Thu, 05 Jun 2008 02:43:00 GMT</pubDate><guid>http://www.phpweblog.net/runpin/archive/2008/06/05/4499.html</guid><wfw:comment>http://www.phpweblog.net/runpin/comments/4499.html</wfw:comment><comments>http://www.phpweblog.net/runpin/archive/2008/06/05/4499.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.phpweblog.net/runpin/comments/commentRss/4499.html</wfw:commentRss><trackback:ping>http://www.phpweblog.net/runpin/services/trackbacks/4499.html</trackback:ping><description><![CDATA[
		<p>Ubuntu的玩法很多，比如Compiz-Fusion的各种特效，不过玩儿多了也就那么回事儿。今天就来玩玩儿服务器。<a href="/runpin/archive/2008/03/01/2865.html">Lamp的安装</a>前面的帖子已经详细描述过，这里是就用VMware服务器版在Vista上倒腾一下。我这里用的是<a href="http://cdimage.ubuntu.com/jeos/releases/8.04/release/">jeos</a>，也就是Ubuntu 
8.04的超级精简版，只有99兆，专门给虚拟机用的。</p>
		<p>因为嫌VMware体积太庞大，所以才换成VBox。但是后者在网络方面实在差强人意，和VMware根本不是档次，只好又换了回来。VMware的服务器版可以到它的<a href="http://www.vmware.com/download/server/">网站</a>上<a href="http://www.vmware.com/download/server/">下载</a>，都是free的，大概是个人都知道怎么用，所以不多说了。Ubuntu的安装和在VBox上也没啥不同，只是网络链接方式设置为“桥接”（默认的方式），这样虚拟机就有独立的IP地址了，服务器嘛，这点很重要。</p>
		<p>基本系统安装完后，再把Lamp和Rails安装好，基本的gcc/g++编译环境，vim等等，不需要装X和桌面（当然丰简自便）。装好后用VMware 
Player打开，然后看看IP地址，就是下面这个样子：<br /></p>
		<p>
				<a href="/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/001_9.png">
						<img style="border-width: 0px;" alt="001" src="http://www.phpweblog.net/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/001_thumb_1.png" border="0" height="464" width="742" />
				</a>
		</p>
		<p> </p>
		<p>如果仅此而已，那这种玩儿法似乎没什么意思，并且也没装VMware 
Tools，鼠标切换起来超级麻烦，不能和HOST共享文件。。。怎么办呢？我们可以通过在Vista上安装一个SSH客户端软件，通过shell命令“远程”操作Ubuntu。其实这也不是什么新奇的东西，校园网或者有些公司的局域网里都有这东西，只不过这里是在自己单独的机器上实现这种效果。</p>
		<p>先在Ubuntu里安装好ssh：</p>
		<div class="csharpcode">
				<div class="csharpcode">
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);">
								<img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />
								<span style="color: rgb(0, 0, 0);">apt</span>
								<span style="color: rgb(0, 0, 0);">-</span>
								<span style="color: rgb(0, 0, 255);">get</span>
								<span style="color: rgb(0, 0, 0);">install ssh 
openssh</span>
								<span style="color: rgb(0, 0, 0);">-</span>
								<span style="color: rgb(0, 0, 0);">server</span>
						</div>
				</div>
		</div>
		<p>接下来是在Vista上安装一个SSH客户端软件，比如putty、SSH Secure Shell 
Client等等等等，太多了，推荐使用putty，功能强大，又是开源的。不过呢，这里我用的是SecureCRT，因为习惯了，而且非常漂亮。这东东很容易使用，配置什么的基本不用介绍，倒腾10分钟就会了，再不济可以看看帮助文件，用上面的地址192.168.1.107登录后，效果如下：<br /><br /></p>
		<p>
				<a href="/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/002_2.png">
						<img style="border-width: 0px;" alt="002" src="http://www.phpweblog.net/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/002_thumb.png" border="0" height="569" width="747" />
				</a>
		</p>
		<p> </p>
		<p>漂亮的字体，透明效果，复制粘贴一应俱全，开着那个VMware 
Player不用管就可以了，关键可以这东东里开若干个终端，想要在主机和虚拟机之间传输文件，只需要使用Zmodem：</p>
		<p> </p>
		<p>
				<a href="/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/003_2.png">
						<img style="border-width: 0px;" alt="003" src="http://www.phpweblog.net/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/003_thumb.png" border="0" height="569" width="747" />
				</a>
		</p>
		<p> </p>
		<p>不过别忘了先在Ubuntu里安装lrzsz：</p>
		<div class="csharpcode">
				<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);">
						<img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />
						<span style="color: rgb(0, 0, 0);">apt</span>
						<span style="color: rgb(0, 0, 0);">-</span>
						<span style="color: rgb(0, 0, 255);">get</span>
						<span style="color: rgb(0, 0, 0);">install 
lrzsz</span>
				</div>
		</div>
		<div class="postBody" id="2f20ef5a-4ad1-4a21-8e22-8ce1bf7765a2" contenteditable="true" style="border-width: 0px; margin: 4px 0px 0px; padding: 0px;">
				<p>现在用IE或FF打开192.168.1.107，效果如下：</p>
				<p>
						<a href="/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/004_2.png">
								<img style="border-width: 0px;" alt="004" src="http://www.phpweblog.net/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/004_thumb.png" border="0" height="564" width="767" />
						</a>
				</p>
				<p> </p>
				<p>再装一个PHPMyAdmin：</p>
				<p>
						<br />
				</p>
				<p>
						<img src="http://www.phpweblog.net/images/phpweblog_net/runpin/006.png" alt="006.png" border="0" height="565" width="743" />
						<br />
				</p>
				<p>
						<br />
				</p>
				<p>打开<a href="http://192.168.1.107/phpmyadmin">http://192.168.1.107/phpmyadmin</a>看看：</p>
				<p>
						<br />
				</p>
				<a href="file:///C:/Users/maomao/AppData/Roaming/Windows%20Live%20Writer/PostSupportingFiles/fca9b49f-3cdb-4302-a7f6-c7979c7efd33/0055.png">
				</a>
				<img src="http://www.phpweblog.net/images/phpweblog_net/runpin/WindowsLiveWriter/10fbc8cc2225_8A35/005_2.png" alt="005_2.png" border="0" height="480" width="561" />
				<br /> 
				<p>或者修改一下c:\Windows\System32\drivers\etc\hosts文件，给192.168.1.107一个有意义的名字，比如<a href="http://www.maomao.com/">www.maomao.com</a>，就基本搞定了。在Vista上用IDE之类的东西写好的PHP、Ruby的源文件上传的相应位置即可。</p><p>当然，还可以在Ubuntu中安装vftp之类的ftp类软件来上传文件。</p><p>Now，在自己的机器上就架设好了一台服务器，用户只有一个，就是俺自己了。以后就可以尝试着怎么攻击自己、怎么破坏自己、怎么利用自己，OH 
My，好孤独啊。</p><p>真实的网络环境就这样被虚拟出来了，爱怎么折腾都可以。“快乐的人生一切是游戏”嘛。</p></div>
<img src ="http://www.phpweblog.net/runpin/aggbug/4499.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.phpweblog.net/runpin/" target="_blank">四季无望</a> 2008-06-05 10:43 <a href="http://www.phpweblog.net/runpin/archive/2008/06/05/4499.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Ubuntu 7.10上搭建LAMP和ralis2.0.2开发环境</title><link>http://www.phpweblog.net/runpin/archive/2008/03/01/2865.html</link><dc:creator>四季无望</dc:creator><author>四季无望</author><pubDate>Sat, 01 Mar 2008 11:27:00 GMT</pubDate><guid>http://www.phpweblog.net/runpin/archive/2008/03/01/2865.html</guid><description><![CDATA[在ubuntu 7.10上安装LAMP很简单，这里只是做一个记录，以备重装系统时需要。<br /><br /><b>第一步：配置网络</b><br />因为ubuntu默认安装是通过DHCP进行的，IP地址是动态的，但服务器需要一个静态IP地址，所以这里需要修改。当然，如果安装LAMP的目的只是为了在自己机器上玩玩儿，可以忽略这一步：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo vi </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">network</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">interfaces</span></div><br />修改interfaces之前，需要用ifconfig命令查看一下自己机器现在的IP地址，netmask应该都是255.255.255.0，我的路由器上的network是192.168.18.0，所以broadcast就是192.168.18.255，gateway就是192.168.18.1。除了IP地址，其他参数都可以在路由器的配置文件中看到。这样，interfaces的配置就修改为：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> This file describes the network interfaces available on your system<br /># and how to activate them. For more information, see interfaces(5).<br /><br /># The loopback network interface</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">auto lo<br />iface lo inet loopback<br /><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> The primary network interface</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">auto eth0<br />iface eth0 inet static<br />        address </span><span style="color: rgb(128, 0, 0);">192.168</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">18.100</span><span style="color: rgb(0, 0, 0);"><br />        netmask </span><span style="color: rgb(128, 0, 0);">255.255</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">255.0</span><span style="color: rgb(0, 0, 0);"><br />        network </span><span style="color: rgb(128, 0, 0);">192.168</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">18.0</span><span style="color: rgb(0, 0, 0);"><br />        broadcast </span><span style="color: rgb(128, 0, 0);">192.168</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">18.255</span><span style="color: rgb(0, 0, 0);"><br />        gateway </span><span style="color: rgb(128, 0, 0);">192.168</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">18.1</span></div><br />接着，重新启动网络：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo /</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">init</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">networking restart</span></div><br />最后，要修改主机名，把域名作为主机名，通过域名就可以访问你的主机了，比如我的就是www.maomao.com，呵呵：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo vi </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hosts</span></div><br />把内容修改为：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">127.0</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">0.1</span><span style="color: rgb(0, 0, 0);">       localhost</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">localdomain   localhost<br /></span><span style="color: rgb(128, 0, 0);">192.168</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">18.100</span><span style="color: rgb(0, 0, 0);">   www</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com<br /><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> The following lines are desirable for IPv6 capable hosts</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">     ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">localhost ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">loopback<br />fe00</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">localnet<br />ff00</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mcastprefix<br />ff02</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">allnodes<br />ff02</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">allrouters<br />ff02</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 0);">3</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">allhosts</span></div><br />现在，执行：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo echo www</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hostname<br /></span><span style="color: rgb(0, 0, 0);">sudo /</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">init</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hostname</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">sh start</span></div><br />这样，主机名就修改好了，查看一下结果：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo hostname<br />sudo hostname </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">f</span></div><br />上面这两条命令得到的结果应该都是www.maomao.com，否则看看那一步有问题。<br /><br /><br /><b>第二步，安装一些开发必备的软件：<br /><br /></b><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install binutils cpp fetchmail flex gcc libarchive</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">zip</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">perl libc6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev libcompress</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">zlib</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">perl <br />libdb4</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev libpcre3 libpopt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev lynx m4 make ncftp nmap openssl perl perl</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">modules unzip zip zlib1g</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev <br />autoconf automake1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">9</span><span style="color: rgb(0, 0, 0);"> libtool bison autotools</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev g</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);"> build</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">essential</span></div><br />再把Quota安装好，主要用来监视磁盘使用状况的，这是可选择的：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install quota</span></div><br />编辑<span class="system">/etc/fstab配置，主要是添加</span><span class="system">usrquota,grpquota到/（mount）点上去：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> /etc/fstab: static file system information.<br />#<br /># &lt;file system&gt; &lt;mount point&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt;</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">proc            </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">proc           proc    defaults        </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> /dev/sda1</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">UUID</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">9fc157ff</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">975c</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">4f20</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">9fef</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">6a70085abdbd </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">               ext3    defaults</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">errors</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">remount</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ro</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">usrquota</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"><br />grpquota </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(128, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> /dev/sda5</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">UUID</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">48fb7dd8</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">f099</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">4d63</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ac1b</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">30e886ac7436 none            swap    sw              </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">dev</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">scd0       </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">media</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">cdrom0   udf</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">iso9660 user</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">noauto</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">exec</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">dev</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">fd0        </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">media</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">floppy0  auto    rw</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">user</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">noauto</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">exec</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">       </span><span style="color: rgb(128, 0, 0);">0</span></div><br />接着就是启动Quota：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo touch </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">quota</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">user </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">quota</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">group<br /></span><span style="color: rgb(0, 0, 255);">sudo chmod</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">600</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">quota</span><span style="color: rgb(0, 0, 0);">.*</span><span style="color: rgb(0, 0, 0);"><br />sudo mount </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">o remount </span><span style="color: rgb(0, 0, 0);">/</span></div><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo quotacheck </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">avugm<br />sudo quotaon </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">avug</span></div><br /><b><br />第三步，安装MySQL<br /><br /></b><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install mysql</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">server mysql</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">client libmysqlclient15</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev</span></div><br />结束的时候会要求你输入root密码，注意这里不是ubuntu的root密码，是MySQL的root密码，随便了，但是它只会要你输入一次，所以不要搞错了，免得以后又要修改：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">New password </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> the MySQL </span><span style="color: rgb(0, 0, 0); font-weight: bold;">"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">root</span><span style="color: rgb(0, 0, 0); font-weight: bold;">"</span><span style="color: rgb(0, 0, 0);"> user</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&lt;--</span><span style="color: rgb(0, 0, 0);"> 我的MySQL密码</span></div><br />然后是修改MySQL的配置文件，让它监视所有端口，而不只是localhost的，这一步是可选的，如果只是玩玩儿的话：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo vi </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mysql</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 255);">my</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">cnf</span></div><br />找到</span><span class="system">bind-address           = 127.0.0.1，把它注释掉：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);"><img src="http://www.phpweblog.net/images/dot.gif" /></span><span style="color: rgb(0, 0, 0);">]<br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Instead of skip-networking the default is now to listen only on<br /># localhost which is more compatible and is not less secure.<br />#bind-address           = 127.0.0.1<br />#</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);"><img src="http://www.phpweblog.net/images/dot.gif" /></span><span style="color: rgb(0, 0, 0);">]</span></div><br />重启MySQL：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo /</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">init</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mysql restart</span></div><br />看看它是否生效了：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo netstat </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">tap </span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">grep</span><span style="color: rgb(0, 0, 0);"> mysql</span></div><br />输出应该类似如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(128, 0, 128);">@www</span><span style="color: rgb(0, 0, 0);">:~</span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> netstat -tap | grep mysql</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">tcp        </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">*:</span><span style="color: rgb(0, 0, 0);">mysql                 </span><span style="color: rgb(0, 0, 0);">*:*</span><span style="color: rgb(0, 0, 0);">                     </span><span style="color: rgb(0, 0, 255);">LISTEN</span><span style="color: rgb(0, 0, 0);">     </span><span style="color: rgb(128, 0, 0);">5286</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">mysqld<br />maomao</span><span style="color: rgb(128, 0, 128);">@www</span><span style="color: rgb(0, 0, 0);">:~</span><span style="color: rgb(0, 128, 0);">#</span></div><br /><b>第四步：安装Apache2和PHP5<br /><br /></b><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install apache2 apache2</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">doc apache2</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mpm</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">prefork apache2</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">utils libexpat1 ssl</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">cert</span></div><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install libapache2</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mod</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">php5 php5 php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">common php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">curl php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">gd php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">idn php</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">pear <br />php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">imagick php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">imap</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"> php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mcrypt php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">memcache php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mhash php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ming php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mysql php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ps php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">pspell <br />php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">recode php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">snmp php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">sqlite php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">tidy php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xmlrpc php5</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">xsl</span></div><br />这一步会询问</span><span class="system">Continue installing libc-client without Maildir support?，点击forward就可以了。<br /><br />然后要编辑</span><span class="system">/etc/apache2/mods-available/dir.conf文件，把修改一下index的默认类型：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">IfModule mod_dir</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">c</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />      </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">DirectoryIndex index.html index.cgi index.pl index.php index.xhtml</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">      DirectoryIndex </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">html </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">htm </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">shtml </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">cgi </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">php </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">php3 </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">pl </span><span style="color: rgb(0, 0, 255);">index</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">xhtml<br /><br /></span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">IfModule</span><span style="color: rgb(0, 0, 0);">&gt;</span></div><br />现在，启动一些Apache2的模块，很有用的：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo a2enmod ssl<br />sudo a2enmod rewrite<br />sudo a2enmod suexec<br />sudo a2enmod include</span></div><br />最后要重启Apache2：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sduo /</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">init</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">apache2 force</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">reload</span></div><br /><b>第五步：建立一个Apache2的虚拟HOST：</b><br /><br />这个不用说了，用处大了，即使你是玩玩儿。这样至少不用把所有PHP文件放到/var/www下面才能使用，你可以放到自己家目录下或者任何方便维护的地方。<br /><br />我们要在/etc/apache2/sites-available下新建一个文件，比如这里是maomao.com.conf，内容如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">VirtualHost www</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />ServerAdmin info</span><span style="color: rgb(128, 0, 128);">@localhost</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">我们这里要使用www.maomao.com和local.maomao.com这两个域名</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">ServerAlias local</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com<br />DocumentRoot </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">home</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">public_html<br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">if using awstats</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">ScriptAlias </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">awstats</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">lib</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">cgi</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">指定log文件的位置</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">CustomLog </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">var</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 255);">log</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">apache2</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">access</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 255);">log</span><span style="color: rgb(0, 0, 0);"> combined<br /></span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">VirtualHost</span><span style="color: rgb(0, 0, 0);">&gt;</span></div><br />然后，</span>切换到/etc/apache2/sites-enabled/目录下，在这里建立一个链接：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo ln </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">s </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">apache2</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">sites</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">available</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">conf maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">conf</span></div><br />再到/etc/hosts里添加local.maomao.com：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">127.0</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">0.1</span><span style="color: rgb(0, 0, 0);">    localhost</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">localdomain    localhost<br /></span><span style="color: rgb(0, 0, 0);">127.0</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">1.1</span><span style="color: rgb(0, 0, 0);">    ubuntu</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">localhost    ubuntu<br /></span><span style="color: rgb(0, 0, 0);">192.168</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">18.6</span><span style="color: rgb(0, 0, 0);"> www</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com local</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">com<br /><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> The following lines are desirable for IPv6 capable hosts</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">     ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">localhost ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">loopback<br />fe00</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">localnet<br />ff00</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">mcastprefix<br />ff02</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">allnodes<br />ff02</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">allrouters<br />ff02</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);"> ip6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">allhosts</span></div><br />OK，重启Apache2：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo /</span><span style="color: rgb(0, 0, 0);">etc</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">init</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">d</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">apache2 reload</span></div><br />在<span class="system"><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">home</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">maomao</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">public_html下建立一个phpinfo.php文件，内容为：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 128);">phpinfo</span><span style="color: rgb(0, 0, 0);">();<br /></span><span style="color: rgb(0, 0, 0);">?&gt;</span></div><br />然后，打开firefox，输入：http://local.maomao.com/phpinfo.php，看看是否正常工作。<br /><br />至此，LAMP就搞定了。下面是配置rails的开发环境。<br /><br /><b>第六步：建立rails开发环境</b><br /><br />现在的rails的版本是2.0.2，使用SQLite作为默认数据库，而且似乎不启动数据库就搞不定一个基本的HelloWorld，改动实在太。。。，唉，接着来：<br /><br />基本步骤是安装Ruby、SQLite、gem、rails和mongrel：<br /><br /><b>安装Ruby</b>：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install </span><code>ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby</code><span style="color: rgb(0, 0, 0);"></span></div><br />然后建立链接：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo ln </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">s </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">ruby1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">local</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">ruby<br />sudo ln </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">s </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">ri1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">local</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">ri<br />sudo ln </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">s </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">rdoc1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">local</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">rdoc<br />sudo ln </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">s </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">irb1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">local</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">irb</span></div><br />查看是否正常安装：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">ruby </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">v</span></div><br /><b>安装</b></span></span><b>rubygems</b>：<br /><br />可以用apt安装，但是版本是0.9.4的，还要升级，很麻烦，不如直接下载安装：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">mkdir</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">~/</span><span style="color: rgb(0, 0, 0);">sources<br />cd </span><span style="color: rgb(0, 0, 0);">~/</span><span style="color: rgb(0, 0, 0);">sources<br /></span><span style="color: rgb(0, 0, 0);"><img src="http://www.phpweblog.net/images/dot.gif" /></span><span style="color: rgb(0, 0, 0);"><br />wget http</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />tar xzvf rubygems</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1.0</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">tgz<br />cd  rubygems</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1.0</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"><br /><br />sudo ruby setup</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">rb<br /></span><span style="color: rgb(0, 0, 0);"><img src="http://www.phpweblog.net/images/dot.gif" /></span><span style="color: rgb(0, 0, 0);"><br />sudo ln </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">s </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">gem1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">usr</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">gem</span></div><br />看看版本：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">gem </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">v</span></div><br />无论什么时候，要升级，输入：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo gem update<br />sudo gem update </span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 128, 128);">system</span></div><br /><b>安装SQLite：<br /></b><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install sqlite3 libsqlite3</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> libsqlite3</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev</span></div><br /><b>安装MySQL的ruby支持：</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">get install  libmysql</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ruby1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span></div><br /><b>安装rake：</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo gem install rake</span></div><br /><b>安装rails：</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo gem install rails </span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">source http</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">gems.rubyonrails.org/</span></div><br /><b>安装</b><span><b>mongrel：</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo gem install mongrel</span></div><br /><b>让rails可以访问SQLite：</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo gem install sqlite3</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ruby</span></div><br /><b>让rails可以访问MySQL：</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo gem install mysql</span></div><br /><b>安装imagemagick:</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo aptitude install imagemagick librmagick</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ruby1</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);"> librmagick</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">ruby</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">doc libfreetype6</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">dev xml</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">core</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"></span></div><br />检查一下是否正确：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">irb<br />#irb(main):</span><span style="color: rgb(0, 0, 0);">001</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />require </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">RMagick</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br />#</span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);"><br />#irb(main):</span><span style="color: rgb(0, 0, 0);">002</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />require </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">mysql</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br />#</span><span style="color: rgb(0, 0, 0);">=&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);"><br />#irb(main):</span><span style="color: rgb(0, 0, 0);">003</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />exit</span></div><br /><b>最后，安装</b></span><b>postfix和subversion<br /><br /></b><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo aptitude install postfix subversion</span></div><br />OK，目前足够了，下面就是建立一个简单的测试app，看看一切是否正常：<br /><br />首先，家目录下建立一个新目录rails，在这个目录里打开控制台，输入：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">rails </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">d mysql demo</span></div><br />这里，目的是建立一个名为demo的应用程序，但是rails 2.0.2默认的数据库是SQLite，所以要加-d mysql参数，如果使用的是SQLite，则无需这么做。<br /><br />然后，进入demo目录，输入：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">ruby script</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">generate controller App</span></div><br />打开app/controllers/app_controller.rb文件，内容为：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> AppController </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> ApplicationController<br />end</span></div><br />修改成：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> AppController </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> ApplicationController<br />    def greeting<br />    end<br />end</span></div><br />接着，在app/views/app中新建一个文件greeting.rhtml，内容是：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">Ruby on Rails</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">h1</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">maomao，你吃了没有！</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">h1</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />启动phpmyadmin建立一个新的数据库，名字是demo，用户名是maomao，密码maomao，然后修改demo/config目录下的database.yml，只需修改development部分就可以了：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">development:<br />    adapter: mysql<br />    encoding: utf8<br />    database: demo<br />    username: maomao<br />    password: maomao<br />    socket: /var/run/mysqld/mysqld.sock</span></div><br />最后，在demo目录下启动mongrel服务器：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">ruby script/server</span></div><br />在firefox中输入地址：http://localhost:3000/app/greeting,如果看见“maomao，你吃了没有!”，那就搞定了。<br /><br /><img src ="http://www.phpweblog.net/runpin/aggbug/2865.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.phpweblog.net/runpin/" target="_blank">四季无望</a> 2008-03-01 19:27 <a href="http://www.phpweblog.net/runpin/archive/2008/03/01/2865.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在xampp中安装GeSHi</title><link>http://www.phpweblog.net/runpin/archive/2007/09/21/1989.html</link><dc:creator>四季无望</dc:creator><author>四季无望</author><pubDate>Fri, 21 Sep 2007 02:42:00 GMT</pubDate><guid>http://www.phpweblog.net/runpin/archive/2007/09/21/1989.html</guid><wfw:comment>http://www.phpweblog.net/runpin/comments/1989.html</wfw:comment><comments>http://www.phpweblog.net/runpin/archive/2007/09/21/1989.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.phpweblog.net/runpin/comments/commentRss/1989.html</wfw:commentRss><trackback:ping>http://www.phpweblog.net/runpin/services/trackbacks/1989.html</trackback:ping><description><![CDATA[
		<h2>一、简介</h2>
		<p>
				<tt>GeSHi</tt>是什么东西？简单说，就是一个软件，用来加亮网页中的源代码。名称据说跟中国的“夏至”有关系，没有具体研究过。不过这个名字刚好和汉语拼音中的“格式”同音。它的英文全名是"<tt>Generic Syntax Highlighter</tt>"，也就是“通用语法加亮器”。具体细节可以到<a title="GeSHi" href="http://qbnz.com/highlighter/" target="_blank">GeSHi</a>网站上研究。</p>
		<p>很多博客和维基都集成了<tt>GeSHi</tt>，比如<tt>wordpress</tt>、<tt>dokuwiki</tt>等。不过呢，如果自己有一个网站，写了很多源码想给人看，如何让这些源码美观一些，就像在<tt>vim</tt>等编辑器中显示的那么漂亮呢。下满是我安装的一些经验：</p>
		<h2>二、安装</h2>
		<p>我用<tt>xampp</tt>建立在本本上建立了一个<tt>Apache</tt>、<tt>MySQL</tt>和<tt>PHP</tt>的开发环境。在<tt>C</tt>盘根目录上有一个文件夹是<tt>xampp</tt>。文档根目录在<tt>C:\xampp\htdocs</tt>，<tt>http://localhost/</tt>就是从这里开始。</p>
		<p>下载<tt>GeSHi</tt>，解压到<tt>C:\xampp\php\includes</tt>。<tt>GeSHi</tt>的文档说可以放到别处，但实际很麻烦。<tt>GeSHi</tt>本身就是<tt>PHP</tt>的一个类，使用<tt>include</tt>调用，所以不如直接加到<tt>PHP</tt>的<tt>include</tt>路径中去。如果没有<tt>includes</tt>文件夹，自己建立一个，然后把解压后的文件放到里面。注意，<tt>includes</tt>里应该有一个文件叫<tt>geshi.php</tt>，还有三个文件夹<tt>contrib</tt>、<tt>docs</tt>和<tt>geshi</tt>。</p>
		<p>接下来，修改<tt>php.ini</tt>文件，这个文件在<tt>C:\xampp\apache\bin</tt>中，打开后，在447行上可以看见：</p>
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);">
				<span style="color: rgb(0, 0, 0);">include_path </span>
				<span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.;C:\xampp\php\pear\</span><span style="color: rgb(0, 0, 0);">"</span></div>
		<br />修改为：<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0);">include_path </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.;C:\xampp\php\pear\;C:\xampp\php\includes\</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span></div><p>这其实就是把<tt>GeSHi</tt>所在的路径加到<tt>php.ini</tt>文件里。安装到此就完成。</p><h2>三、使用</h2><p>这里有段用<tt>vim</tt>写的<tt>C++</tt>代码：</p><img alt="cpp.png" src="http://www.phpweblog.net/images/phpweblog_net/runpin/cpp.png" border="0" height="284" width="740" /><p>要把彩色代码在网页上显示的话，可以直接用<tt>vim</tt>转换成<tt>HTML</tt>格式复制到网页上。但这里是要用<tt>GeSHi</tt>来实现，所以呢，使用下面的方法：</p><p>在<tt>htdocs</tt>文件夹里新建一个<tt>PHP</tt>文件，<tt>highlighter.php</tt>。内容如下（这段代码改编自<tt>GeSHi</tt>的说明文档）：</p><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 0);">&lt;?</span><span style="color: rgb(0, 0, 0);">php<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 包含GeSHi库</span><span style="color: rgb(0, 128, 0);"><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">include_once</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">geshi.php</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 定义需要加亮的源代码<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />// 定义需要何种语言来加亮</span><span style="color: rgb(0, 128, 0);"><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(128, 0, 128);">$source</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">#include &lt;iostream&gt;<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />using namespace std;<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />int main()<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />{<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />    cout &lt;&lt; "这是很简单的C++代码！" &lt;&lt; endl;<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />    return 0;<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" />}</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(128, 0, 128);">$language</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">cpp</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 建立一个GeSHi的对象</span><span style="color: rgb(0, 128, 0);"><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(128, 0, 128);">$geshi</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=&amp;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> GeSHi(</span><span style="color: rgb(128, 0, 128);">$source</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(128, 0, 128);">$language</span><span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 输出加亮后的结果</span><span style="color: rgb(0, 128, 0);"><br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">echo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$geshi</span><span style="color: rgb(0, 0, 0);">-&gt;</span><span style="color: rgb(0, 0, 0);">parse_code();<br /><img src="http://www.phpweblog.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 0);">?&gt;</span></div><p>在浏览器中输入：<tt>http://localhost/hello_cpp.php</tt>，就会看到彩色工整的源代码了。下面是在<tt>editplus</tt>中的效果：</p><img alt="high.png" src="http://www.phpweblog.net/images/phpweblog_net/runpin/high.png" border="0" height="383" width="751" /><h2>说明：</h2><p>上面那段代码执行的时候有些迟滞，这和<tt>GeSHi</tt>以及<tt>include_once()</tt>函数有关，如果你的网页上有很多需要加亮的代码，感觉会更明显。</p><p>那段代码中的<tt>$source</tt>变量后跟随的内容就是需要加亮的代码。</p><img src ="http://www.phpweblog.net/runpin/aggbug/1989.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.phpweblog.net/runpin/" target="_blank">四季无望</a> 2007-09-21 10:42 <a href="http://www.phpweblog.net/runpin/archive/2007/09/21/1989.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用virtualbox1.5在vista上安装ubuntu7.04</title><link>http://www.phpweblog.net/runpin/archive/2007/09/08/1936.html</link><dc:creator>四季无望</dc:creator><author>四季无望</author><pubDate>Sat, 08 Sep 2007 15:55:00 GMT</pubDate><guid>http://www.phpweblog.net/runpin/archive/2007/09/08/1936.html</guid><wfw:comment>http://www.phpweblog.net/runpin/comments/1936.html</wfw:comment><comments>http://www.phpweblog.net/runpin/archive/2007/09/08/1936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.phpweblog.net/runpin/comments/commentRss/1936.html</wfw:commentRss><trackback:ping>http://www.phpweblog.net/runpin/services/trackbacks/1936.html</trackback:ping><description><![CDATA[以前一直用vmware 5在xp上虚拟ubuntu。个人只是把linux操作系统作为爱好来学习和使用，因为日常工作基本都是在windows上，比如写程序、倒腾数据库等等都离不开VS2005以及IIS等。双系统切换太麻烦，vmware是个不错的选择。买了本本后，操作系统是vista，很喜欢，但vmware 5不兼容vista，vmware 6体积太大，资源消耗太多，所以就尝试刚刚发布的<a target="_blank" href="http://www.virtualbox.org/">virtualbox1.5</a>。这是一个开源软件，支持vista，体积只有13兆。<br /><br />作为主机的本本，操作系统是vista，CPU是T5500，内存2G。给ubuntu的虚拟机分配512M内存，8G的虚拟磁盘，如图：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/virtualbox.jpg" alt="virtualbox.jpg" border="0" height="552" width="732" /><br /><br />安装盘是从ubuntu网站上下载的ubuntu-7.04-alternate-i386.iso文件。尝试使用7.04服务器版光盘安装，但是在我机器上，只要安装了virtualbox1.5后，光驱就无法识别任何光盘，卸载后则一切正常，不知道是什么原因。所以只好用iso文件来安装。<br /><br />安装过程没什么多说的，但是如果不用默认安装而用expert模式，完成后无法启动ubuntu虚拟机，几次尝试都被报知“kernel panic”，实在不明就里。<br /><br />virtualbox官网论坛上有人说安装ubuntu7.04的时候必须关闭acpi、打开IO acpi，但实际情况，在我的机器上，如果关闭acpi，根本无法进入安装界面。所以，安装前我把两者都打开了，如图：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/ioacpi.jpg" alt="ioacpi.jpg" border="0" height="540" width="552" /><br /><br />所以我使用ubuntu-7.04-alternate-i386.iso，以默认方式安装命令行系统。过程不赘述，和真实机器安装方式一致。然后在安装会提示重新启动，下图是启动界面：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/startup1.jpg" alt="startup1.jpg" border="0" height="504" width="756" /><br /><br />这一步是关键，我碰到的99%的问题是在这里。经常地，会在“starting up...”后显示“kernel panic”，比如，不用default方式安装的话。这在vmware上几乎没有出现过，除非linux核心损坏。<br /><br />如果一切正常，就可以很快进入登录界面，下图是我登录后的终端窗口：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/longin.jpg" alt="longin.jpg" border="0" height="504" width="756" /><br /><br />这里的字体很难看，如果是expert安装，可以选择终端的字体。当然，这里也可以使用<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo dpkg</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 255);">reconfigure</span><span style="color: rgb(0, 0, 0);"> console</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">setup</span></div><br />这条命令来修改终端字体，但使用这条命令要注意，设置完成后会有好一会儿的停顿，需要等待它自己结束，如果使用ctl-c来强制终止，grub菜单设置就会出错，启动的时候又会报告“kerenl panic”，这样工作就白费了。所以一定要在每一步尝试前做一次snapshot，如图：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/snapshot.jpg" alt="snapshot.jpg" border="0" height="552" width="732" /><br /><br />这是修改后的终端字体：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/font.jpg" alt="font.jpg" border="0" height="504" width="756" /><br /><br />接下来的事情就是升级、安装xorg、安装gnome-core，基本的命令无非是：<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">get </span><span style="color: rgb(0, 0, 255);">update</span><span style="color: rgb(0, 0, 0);"><br />sudo apt</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">get dist</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">upgrade<br />sudo apt</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">get install x</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">window</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">system</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">core xserver</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">xorg<br />sudo apt</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">get install synaptic gksu deborphan libgnome2</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">perl gnome</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">core</span></div><br />如果你不幸是电信或者网通用户，这个过程一般很漫长，如果能找到快一些的sources，可以提升你对ubuntu的兴趣，但我可以保证所有快的sources都不在中国大陆，教育网除外。<br /><br />接下来就可以进入gnome了，之前需要安装guest additons，这样才可以定制分辨率以及鼠标，过程如下：<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sudo apt</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">get install build</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">essential<br />sudo apt</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">get install linux</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">headers</span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">`uname </span><span style="color: rgb(128, 128, 128);">-</span><span style="color: rgb(0, 0, 0);">r`<br /></span></div><br />这一步和vmware一样，需要编译器和头文件，接下来是在光驱中载入<code class="computeroutput">VBoxGuestAdditions.iso</code>文件，详细步骤可以看它的帮助文件，很详细，然后的过程比vmware简单，无非就是：<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">sh .</span><span style="color: rgb(128, 128, 128);">/</span><span style="color: rgb(0, 0, 0);">VBoxLinuxAdditions.run</span></div><br />下图是我安装好后进入gnome后的截图：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/gnome1.jpg" alt="gnome1.jpg" border="0" height="704" width="1060" /><br /><br />但是，在一切似乎搞定之后，重启系统（安装完guest addtions必须这么做），十有八九会收到”kernel panic“的错误，进不了系统。之所以如此，因为在安装好后，第一次登录的升级时，也就是使用sudo apt-get dist-upgrade后，ubuntu的核心被升级为linux 2.6.20-16-generic，而原来未升级前是linux 2.6.20-15-generic。virtualbox1.5似乎不支持前者，需要在启动的时候点击Esc键，选择后者才能进入，如图：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/startup.jpg" alt="startup.jpg" border="0" height="504" width="756" /><br /><br />上图中，升级后的核心已经被我删除了，使用的还是未升级前的核心。所以，在进行到安装guest addtions之前，最好先把升级后的核心删除（保留也可以，只是有些麻烦）。<br /><br />再一次进入gnome，这时就可以加载共享文件，读取主机上的文件了，如图所示：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/gnome2.jpg" alt="gnome2.jpg" border="0" height="704" width="1060" /><br /><br />打开共享文件夹：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/gnome3.jpg" alt="gnome3.jpg" border="0" height="704" width="1060" /><br /><br />安装文泉驿字体后可以浏览中文网页了：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/gnome4.jpg" alt="gnome4.jpg" border="0" height="704" width="1060" /><br /><br />vista的分辨率是1280x800，为了浏览方便和美观，我把ubuntu虚拟机设置为1024x600，很古怪的分辨率，就是修改一下xorg.conf，如图：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/gnome5.jpg" alt="gnome5.jpg" border="0" height="704" width="1060" /><br /><br />到这一步，总算老天开眼，可以说搞定了。回到终端下也很方便，随时都可以按需要学习bash或者命令行操作等等，比如下面是.bashrc文件：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/bashrc.jpg" alt="bashrc.jpg" border="0" height="504" width="756" /><br /><br />最后是安装应用程序，比如fcitx、LAMP等，这是最后的结果：<br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/final.jpg" alt="final.jpg" border="0" height="704" width="1060" /><br /><br /><br /><img src="http://www.phpweblog.net/images/phpweblog_net/runpin/full.jpg" alt="full.jpg" border="0" height="800" width="1280" /><br /><br />总结一下，virtualbox1.5在网络功能等很多方面和vmware还有很大差距，但是它的优势确实非常明显的。在vista或者ubuntu主机上虚拟xp，启动速度比真实机器上安装的xp要快。应用上，除了没有3d加速等（几乎所以虚拟机都不提供），虚拟的xp速度不亚于真实机器。<br /><br />不过virtualbox1.5的bug实在不少，安装过程中碰到的许多问题都有些莫名其妙。比如会让光驱失灵，不支持虚拟磁盘的压缩等，希望这个软件能改进。<br /><br /><br /><img src ="http://www.phpweblog.net/runpin/aggbug/1936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.phpweblog.net/runpin/" target="_blank">四季无望</a> 2007-09-08 23:55 <a href="http://www.phpweblog.net/runpin/archive/2007/09/08/1936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>