lamp性能上虽然不如lnmp,但用惯了也就懒得换,这里是自己的一点点笔记,用于安装lamp环境,供大家一起学习

升级现有的软件包- apt-get update

  • apt-get dist-upgrade复制代码安装apache,php,以及一些常用的组件(查看php全部可用组件apt-cache search php)- apt-get install apache2 php5 libapache2-mod-php5 php5-gd php5-curl复制代码启用一些必要的apache模块- a2enmod rewrite
  • a2enmod deflate复制代码允许.htaccess- vim /etc/apache2/sites-enabled/000-default
  • AllowOverride All复制代码(可选)安装eaccelerator- apt-get install build-essential php5-dev
  • wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2
  • tar vxf eaccelerator-0.9.6.tar.bz2
  • cd eaccelerator-0.9.6
  • phpize
  • ./configure
  • make
  • make install
  • - vim /etc/php5/conf.d/eaccelerator.ini
  • extension="eaccelerator.so"
  • eaccelerator.shm_size="16"
  • eaccelerator.cache_dir="/var/cache/eaccelerator"
  • eaccelerator.enable="1"
  • eaccelerator.optimizer="1"
  • eaccelerator.check_mtime="1"
  • eaccelerator.debug="0"
  • eaccelerator.filter=""
  • eaccelerator.shm_max="0"
  • eaccelerator.shm_ttl="0"
  • eaccelerator.shm_prune_period="0"
  • eaccelerator.shm_only="0"
  • eaccelerator.compress="1"
  • eaccelerator.compress_level="9"
  • - mkdir -p /var/cache/eaccelerator
  • chmod 0777 /var/cache/eaccelerator复制代码(可选)安装xcache,和上述eAc只能二选一- apt-get install php5-xcache复制代码创建phpinfo.php随后重启apache服务- vim /var/www/phpinfo.php
  • - - /etc/init.d/apache2 restart复制代码安装mysql和phpmyadmin,安装向导会提示输入数据库鹳狸猿密码- apt-get install mysql-server mysql-client php5-mysql
  • apt-get install phpmyadmin
  • /etc/init.d/apache2 restart复制代码创建虚拟主机所在目录(根据个人喜好也可放在/home/www/下,当前其他目录应该也没问题)- mkdir /var/www/www.example.com
  • mkdir /var/www/www.example.com/htdocs
  • mkdir /var/www/www.example.com/logs复制代码创建虚拟主机配置文件- vim /etc/apache2/sites-available/www.example.com
  • #
  • # Example.com (/etc/apache2/sites-available/www.example.com)
  • #
  • - ServerAdmin webmaster@example.com
  • ServerName www.example.com
  • ServerAlias example.com
  • - # Indexes + Directory Root.
  • DirectoryIndex index.php index.html index.htm
  • DocumentRoot /home/www/www.example.com/htdocs/
  • - # Logfiles
  • ErrorLog /home/www/www.example.com/logs/error.log
  • CustomLog /home/www/www.example.com/logs/access.log combined
  • 复制代码启用虚拟主机站点,并重新载入配置- a2ensite www.example.com
  • /etc/init.d/apache2 reload复制代码(可选)创建临时证书并加入SSL支持- openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
  • chmod 600 /etc/apache2/apache.pem
  • a2enmod ssl
  • a2ensite default-ssl
  • vim /etc/apache2/sites-available/default-ssl
  • - AllowOverride All
  • SSLCertificateFile /etc/apache2/apache.pem #搜索SSLCertificateFile,替换原有部分
  • /etc/init.d/apache2 reload复制代码好了,剩下的大家自己折腾了,比起一键安装包,自己动手安装也并不是很复杂,

另外坐等高人弄一个lnmp的apt-get安装教程,哈哈~

[ 本帖最后由 ika 于 2010-5-17 20:03 编辑 ]