ubuntu搭建LAMP+zend+restfull web service
1.增加本地源,编辑:/etc/apt/sources.list
添加163源:
deb http://mirrors.163.com/ubuntu/ oneiric main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-backports main restricted universe multiverse
?
添加本地DVD源:
sudo apt-cdrom -m -d /media/your-mount-point【dvd挂载点】 add
?
更新列表:
sudo apt-get update
?
2.安装LAMP
sudo apt-get install apache2 php5 mysql-server phpmyadmin
sudo apt-get install php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin?
// 而phpmyadmin安装后还要建立个链接才能访问,以apache默认网站目录/var/www为例,输入下面命令即可:?
sudo ln -s /usr/share/phpmyadmin /var/www?
// 启用mod_rewrite模块
sudo a2enmod rewrite
?
a.配置phpmyadmin,在浏览器中输入:
http://localhost/phpmyadmin
*需要注意,使用root帐号登录。否则会出现权限错误。
添加新DB(如:zenddb)和用户(如:zendadm)给zend framwork使用。并且赋予zendadm对zenddb的完全权限。
另外,添加DB和用户给wordpress使用。
?
b.修改apache设置,支持虚拟目录及多站点。
sudo vim /etc/apache2/sites-enabled/000-default
// 具体写法请参考Apache官方文档。记得把AllowOverride None改为All,否则不能用自定义的永久链接格式。
c.重启Apache服务
sudo /etc/init.d/apache2 restart
////////////////////////////////////////////////////
配置文件位置:
?1>apache 的配置文件路径 /etc/apache2/apache2.conf
?2>apache 网站字符编码配置路径 /etc/apache2/conf.d/charset
?3>php.ini 路径 /etc/php5/apache2/php.ini
?4>mysql配置文件 路径 /etc/mysql/my.cnf 一般不要使用,尤其是新手
?5>phpmyadmin配置文件路径 /etc/phpmyadmin/apache.conf
?6>默认网站根目录 /var/www
////////////////////////////////////////////////////
?
3.安装wordpress
sudo wget http://cn.wordpress.org/wordpress-3.0.5-zh_CN.tar.gz
// 解压到/var/www/blog:
sudo tar zxvf wordpress-3.0.5-zh_CN.tar.gz -C /var/www/blog
// 进入到blog目录安装wordpress
http://localhost/blog/wp-admin/install.php
?
4.安装zend_framework
参考:http://files.zend.com/help/Zend-Server-Community-Edition/zend-server-community-edition.htm#deb_installation.htm
a.下载zend ce(社区免费版)http://www.zend.com/products/server-ce/downloads
b.解压安装脚本
tar -xvf ZendServer-5.6.0-RepositoryInstaller-linux.tar.gz
c.安装基于php 5.3的zend_framework:
sudo ./install_zs.sh? 5.3 ce
d.测试运行,在浏览器输入:
https://localhost:10082/ZendServer
http://localhost:10081/ZendServer
e.添加环境变量:
sudo vim /etc/profile
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
source /etc/profile
?