<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AquarLife &#187; LAMP</title>
	<atom:link href="http://www.aquarhead.com/tag/lamp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aquarhead.com</link>
	<description>天空中的羽翼距离你还有多远 在你隐藏的感情之中寻找我的踪迹</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:08:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><cloud domain='www.aquarhead.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>CakePHP自学笔记（一）：利用Ubuntu搭建开发环境</title>
		<link>http://www.aquarhead.com/2010/03/cakephp-notes-1/</link>
		<comments>http://www.aquarhead.com/2010/03/cakephp-notes-1/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 14:26:06 +0000</pubDate>
		<dc:creator>AquarHEAD</dc:creator>
				<category><![CDATA[Code Fortress]]></category>
		<category><![CDATA[AquarTutorial]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.aquarhead.com/?p=725</guid>
		<description><![CDATA[AquarTutorial 第一期 -CakePHP自学笔记 >>（一）：利用Ubuntu搭建开发环境]]></description>
			<content:encoded><![CDATA[<p>AquarTutorial 第一期<br />
-CakePHP自学笔记</p>
<p>>>（一）：利用Ubuntu搭建开发环境</p>
<p><-<-<-<-<-<-<-<-<-<-<-<-<-</p>
<h3>安装Ubuntu系统</h3>
<p>首先，到<a href="http://www.ubuntu.com/">Ubuntu官方网站</a>下载最新版的<a href="http://www.ubuntu.com/getubuntu/download">Ubuntu Desktop LiveCD</a>，如果速度慢也可以到<a href="http://mirrors.163.com/ubuntu-releases/">网易</a>或者<a href="http://mirrors.sohu.com/ubuntu-releases/">搜狐</a>的开源镜像站点去下载。然后把镜像刻录到一张空的CD盘上面。</p>
<p>[Choice 1]你可以直接在Windows里面安装一个Ubuntu系统，优点：安装卸载方便，缺点：速度稍慢。推荐没用过Linux的同学用这种方法装。<br />
[Choice 2]重启电脑，从光驱引导，安装Ubuntu系统，优点：完全释放系统资源，缺点：不适合新手。</p>
<p>安装完系统后，可以调整一些设置，详细的教程以后再写。</p>
<h3>安装LAMP服务器</h3>
<p>所谓LAMP Server也就是Linux操作系统+Apache服务器+MySQL数据库+PHP（以前也指Perl，现在貌似都是PHP了），在Ubuntu中安装LAMP简单至极，这也是选择Ubuntu进行开发的一个原因。</p>
<p>首先，你需要打开一个终端，即应用程序->附件->终端（英文系统里是Application->Accessories->Terminal），也就是所谓的壳（Shell）。然后输入下面的命令：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-i</span></pre></div></div>

<p>然后输入你登录时的密码，按回车应该出现root@的字样就说明你已经获得了根用户（root）的权限，在这种模式下你可以安装软件、更新系统、调整系统级的配置等等，下面我们开始安装LAMP服务器，执行：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tasksel</pre></div></div>

<p>会出现一个蓝色的页面，用上下箭头改变高亮条的位置，调整到LAMP Server的选项上面按空格，然后按Tab键切换到OK按钮上按回车，这样Ubuntu系统就会自动安装包括Apache，MySQL和PHP等一系列程序，安装时MySQL会让你设置管理员（也叫root）密码，还有一次是确认密码，这个密码要记牢，管理数据库时要用到。</p>
<p>此时我们的服务器已经安装完成。你可以用任意浏览器访问 http://localhost 这个网址如果出现一个It works!样子的网站就说明一切OK了。附图演示：<br />
<div id="attachment_731" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.aquarhead.com/wp-content/uploads/2010/03/screenshot_037.png"><img src="http://www.aquarhead.com/wp-content/uploads/2010/03/screenshot_037-300x129.png" alt="Apache Works" title="Apache Works" width="300" height="129" class="size-medium wp-image-731" /></a><p class="wp-caption-text">Apache Works</p></div></p>
<p>接下来，我们安装phpMyAdmin这个MySQL数据库管理软件，有了它你就可以很方便地管理数据库，继续在终端里执行：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> phpmyadmin</pre></div></div>

<p>安装时会有配置选项，用空格选择apache2然后按Tab点OK，装完后会询问是否允许建立数据库，选Yes并输入数据库管理员的密码，随后会设置phpMyAdmin的密码，这个也要记住。</p>
<p>最后，我们需要修改Apache的一些配置以便让Cake能正常运行，继续执行（每次一行，第二条命令中可以使用Tab键自动补齐功能）：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2enmod rewrite
gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-enabled<span style="color: #000000; font-weight: bold;">/</span>000-default</pre></div></div>

<p>会打开一个文字编辑器，把<Directory />和<Directory /var/www>里面的AllowOverride 后面的None改成All。保存并关闭gedit。</p>
<p>重启Apache服务器，加载新配置：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>P.S.不要退出终端</p>
<h3>部署CakePHP的开发环境</h3>
<p>首先到Cake的官方网站下载其代码，这份笔记基于1.2.6版本，写这份笔记的时候下载地址是<a href="http://github.com/cakephp/cakephp1x/zipball/1.2.6">这个</a>。</p>
<p>下载后解压到桌面，重命名一下，下面以caketest为例继续，回到我们的终端，执行：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>你的用户名<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>caketest <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">777</span> <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www</pre></div></div>

<p>这样我们已经完成了CakePHP开发模式的部署，注意不要改动caketest目录下cake里面的文件，那里是CakePHP的核心文件。我们的第一个Cake程序将在app子目录下面开始。</p>
<p>用浏览器打开 http://localhost/caketest 或者你起的随便什么名字（比如diablo）。应该看到下面这样的网页。<br />
<div id="attachment_732" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.aquarhead.com/wp-content/uploads/2010/03/screenshot_038.png"><img src="http://www.aquarhead.com/wp-content/uploads/2010/03/screenshot_038-300x170.png" alt="CakePHP Develop Environment Done" title="CakePHP Develop Environment Done" width="300" height="170" class="size-medium wp-image-732" /></a><p class="wp-caption-text">CakePHP Develop Environment Done</p></div></p>
<p>现在你可以用两次exit命令退出终端了。</p>

	Tags:<a href="http://www.aquarhead.com/tag/aquartutorial/" title="AquarTutorial" rel="tag">AquarTutorial</a>,<a href="http://www.aquarhead.com/tag/cakephp/" title="CakePHP" rel="tag">CakePHP</a>,<a href="http://www.aquarhead.com/tag/lamp/" title="LAMP" rel="tag">LAMP</a>,<a href="http://www.aquarhead.com/tag/ubuntu/" title="Ubuntu" rel="tag">Ubuntu</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.aquarhead.com/2010/03/cakephp-notes-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

