Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 新手LAMP 搭建过程-少量问题求解

[复制链接]
sixwingangel 发表于 2009-12-29 10:45:02 | 显示全部楼层 |阅读模式
本帖最后由 sixwingangel 于 2009-12-29 11:13 编辑

新手想学习网站的搭建与管理,刚接触LAMP ,没有经验。
页面较长,所以先把问题放在这:

1  ZendOptimizer安装时会提示优化功能不支持当前php版本(PHP5.3.1),这样的话不安装ZendOptimizer行不行?
2 系统方面,我安装过 mysql admin 后,系统的一些程序不能运行了,如 软件中心、软件源、更新管理器、输入法管理器等,有什么办法可以解决?


参照网上的教程尝试着自己安装了一下,系统是新装的Ubuntu9.10 ,除了改过系统语言环境,没怎么配置其他的软件。非 root 用户,所有安装文件的压缩包都在主文件夹,下面的流程基本照搬网上的某教程,某些命令对照自己的情况做了修改,shell>代表默认的命令提示符,加#的命令和步骤是我跳过的和目前还没做的,注释中自己加上的话为方便区分,都带了括号。废话不多说了,下面是我的安装流程和一些问题:
  1. 流程部分
  2. #########################################################################
  3. 下面是所需要的软件:apache,php,mysql,ZendOptimizer
  4. http://www.apache.org
  5. http://www.php.net
  6. http://www.mysql.com
  7. http://www.zend.com

  8. 下面是这是安装GD时所需要的软件
  9. http://www.ijg.org/files/jpegsrc.v6b.tar.gz
  10. http://www.zlib.net/zlib-1.2.3.tar.gz
  11. http://prdownloads.sourceforge.net/libpng/libpng-1.2.8-config.tar.gz?download
  12. http://easynews.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.3.tar.bz2
  13. http://telia.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.3.tar.bz2
  14. #########################################################################

  15. 先安装make gcc g++
  16. shell>sudo apt-get install build-essential

  17. 1.apache

  18. shell>tar -zxf httpd-2.2.14.tar.gz
  19. shell>cd httpd-2.2.14
  20. shell>./configure --prefix=/usr/local/apache --enable-modules=most --enable-so --enable-rewrite
  21. shell>make
  22. shell>sudo make install

  23. #shell>sudo /usr/local/apache/bin/apachectl start


  24. 2.freetype

  25. shell>cd
  26. shell>tar -xjf freetype-2.3.5.tar.bz2
  27. shell>cd freetype-2.3.5
  28. shell>./configure
  29. shell>make
  30. shell>sudo make install

  31. 3.jpeg

  32. shell>cd
  33. shell>tar -zxf jpegsrc.v6b.tar.gz
  34. shell>cd jpeg-6b
  35. shell>sudo mkdir /usr/local/man
  36. shell>sudo mkdir /usr/local/man/man1
  37. shell>./configure --enable-shared --enable-static
  38. shell>make
  39. shell>sudo make install

  40. 4.zlib

  41. shell>cd
  42. shell>tar -zxf zlib-1.2.3.tar.gz
  43. shell>cd zlib-1.2.3
  44. shell>./configure
  45. shell>make
  46. shell>sudo make install

  47. 5.libpng

  48. shell>cd
  49. shell>tar -zxf libpng-1.2.8-config.tar.gz
  50. shell>cd zlib-1.2.8
  51. shell>./configure
  52. shell>make
  53. #shell>make test
  54. shell>sudo make install

  55. 6.gd2

  56. shell>cd
  57. shell>tar -xjf gd-2.0.35.tar.bz2
  58. shell>cd gd-2.0.35/
  59. shell>./configure --prefix=/usr/local/gd2
  60. shell>make
  61. shell>sudo make install

  62. 7.mysql

  63. shell>cd
  64. shell>sudo apt-get install libncurses5-dev  

  65. shell>sudo groupadd mysql
  66. shell>sudo useradd -g mysql mysql

  67. shell>tar -zxf mysql-5.1.41-linux-i686-glibc23.tar.gz
  68. shell>sudo cp -r mysql-5.1.41-linux-i686-glibc23 /usr/local/mysql
  69. shell>cd /usr/local/mysql

  70. #(下面两个命令应该是源码分发版要用到的 放在这作为源码安装流程参考)
  71. #shell>make
  72. #shell>sudo make install

  73. shell>sudo scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql
  74. shell>sudo chown -R root  .   (命令最后有个 '.')
  75. shell>sudo chown -R mysql data
  76. shell>sudo chgrp -R mysql .   (命令最后有个 '.')
  77. shell>sudo cp support-files/my-medium.cnf /etc/my.cnf

  78. #(改密码是重要的一步,不过我是新手,对命令还不熟悉,Pass先,原文命令作为参考,不保证完全正确)

  79. #shell>sudo bin/mysqld_safe & (这个应该是启动服务器)
  80. #shell>/usr/local/mysql/bin/mysqladmin -u root password 'new-password'(改root密码)

  81. 8.php

  82. shell>cd
  83. #安装php的时候,系统默认缺少两个组件

  84. #shell>sudo apt-get install flex
  85. #shell>sudo apt-get install libxml2 libxml2-dev

  86. shell>tar -xjf php-5.3.1.tar.bz2
  87. shell>cd php-5.3.1

  88. shell>./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/include/libxml2/libxml
  89. #(这个参数 '--with-libxml-dir=/usr/include/libxml2/libxml' 是我自己试着加的,原文写的是 --with-xml 配置后会提示这个是未知的参数,看了帮助信息,好像xml默认是允许状态——因为只有一个xml的参数 '--disable-xml' 但我看很多教程都强调要配置(lib)xml 我也不敢省略。帮助信息中有 '--with-libxml-dir=[DIR]' 我就把这个换上去了,后面的路径是在软件包管理器中找的,不知道对不对,不过配置过程中没提示出错。)

  90. shell>make
  91. shell>sudo make install
  92. shell>sudo cp php.ini-development /usr/local/lib/php.ini

  93. 9.config apche

  94. #记得备份httpd.conf
  95. shell>sudo cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak

  96. #(我还不知道是不是全部安装成功,很多的配置步骤就先Pass了,不过还是大致看了看,在httpd.conf中试着加了几条。以下基本是原文)
  97. #shell>vi /usr/local/apache/conf/httpd.conf
  98. AddType application/x-httpd-php .php .phtml
  99. AddType application/x-httpd-php-source .phps

  100. #apache里还有一些参数需要修改
  101. #ServerName 如果不修改这项,启动apache的时候,会报错
  102. #DocumentRoot 改成你希望指定的主目录
  103. #IfModule dir_module 在这里加上你希望作为默认首页的文件,我加了index.htm index.php,中间打个空格就可以了

  104. #如果你想启动apache支持shtml格式,可以这样操作
  105. #找到下面这样一段文字
  106. #This should be changed to whatever you set DocumentRoot to.
  107. #把<Directory "/usr/local/apache/htdocs">改成你的主目录,然后在这里加入Includes,注意区分大小写,因为我不希望有人能看到我的目录结构,所以把Index去掉了
  108. #Options FollowSymLinks Includes
  109. #完成这部以后,查找这两行,把前面的#去掉
  110. AddType text/html .shtml
  111. AddOutputFilter INCLUDES .shtml

  112. 10.php config

  113. #shell>vi /usr/local/lib/php.ini
  114. #register-golbals = On

  115. ########################################
  116. #(要不要装下面这个我还不太确定)
  117. ########################################

  118. 11.ZendOptimizer

  119. shell>tar -zxf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz
  120. shell>cd ZendOptimizer-3.3.0a-linux-glibc21-i386
  121. shell>sudo ./install

  122. #一路按回车键就可以了

  123. #(最后会提示:
  124. Installation has detected PHP version 5.3.1. This version is not compatible with the Zend Optimizer 3.3.0a.  The installation process will continue but in order for the Zend Optimizer to load you must switch to a compatible PHP version. For a detailed compatibility table please refer to http://www.zend.com/store/products/product_compatibility.php
  125. 大致是Zend Optimizer3.3的优化与PHP5.3.1不兼容,安装会继续,但想应用Zend Optimizer的优化功能,需要换到兼容版本的PHP--也就是需要降级的意思)

  126. #########################################################################
  127. 流程结束
复制代码
--  END --
Have a nice day !!
 楼主| sixwingangel 发表于 2009-12-29 10:50:17 | 显示全部楼层
看了看PHP5新的手册,里面建议在httpd.conf中使用下面的代码,后面摘抄过来一部分,仅供参考。

  1. <FilesMatch \.php$>
  2.     SetHandler application/x-httpd-php
  3. </FilesMatch>

  4. <FilesMatch "\.ph(p[2-6]?|tml)$">
  5.     SetHandler application/x-httpd-php
  6. </FilesMatch>

  7. <FilesMatch "\.(php*|phtm|phtml|asp|aspx)$">
  8.     SetHandler application/x-httpd-php
  9. </FilesMatch>

  10. <FilesMatch "\.phps$">
  11.     SetHandler application/x-httpd-php-source
  12. </FilesMatch>

  13. <FilesMatch "\.(php*|phtm|phtml|asp|aspx)$">
  14.     SetHandler none
  15. </FilesMatch>

  16.     AddType application/x-httpd-php-custom .php
  17.     Action  application/x-httpd-php-custom  /cgi-bin/php-huge

  18. <FilesMatch "\.(php)$">
  19.     SetHandler none
  20. </FilesMatch>

  21.     AddType application/x-httpd-php-custom .php
  22.     Action  application/x-httpd-php-custom  /cgi-bin/php-huge

  23. #下面是从手册上面拷过来的相关信息,英文不好,只看了个大概:
  24. Setup your php.ini

  25. cp php.ini-development /usr/local/lib/php.ini

  26. You may edit your .ini file to set PHP options. If you prefer having php.ini in another location, use --with-config-file-path=/some/path in step 5.

  27. If you instead choose php.ini-production, be certain to read the list of changes within, as they affect how PHP behaves.
  28. #

  29. Edit your httpd.conf to load the PHP module. The path on the right hand side of the LoadModule statement must point to the path of the PHP module on your system. The make install from above may have already added this for you, but be sure to check.

  30. LoadModule php5_module modules/libphp5.so

  31. #

  32. Tell Apache to parse certain extensions as PHP. For example, let's have Apache parse .php files as PHP. Instead of only using the Apache AddType directive, we want to avoid potentially dangerous uploads and created files such as exploit.php.jpg from being executed as PHP. Using this example, you could have any extension(s) parse as PHP by simply adding them. We'll add .php to demonstrate.

  33. <FilesMatch \.php$>
  34.     SetHandler application/x-httpd-php
  35. </FilesMatch>

  36. Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP, but nothing else, we'd use this:

  37. <FilesMatch "\.ph(p[2-6]?|tml)$">
  38.     SetHandler application/x-httpd-php
  39. </FilesMatch>

  40. And to allow .phps files to be handled by the php source filter, and displayed as syntax-highlighted source code, use this:

  41. <FilesMatch "\.phps$">
  42.     SetHandler application/x-httpd-php-source
  43. </FilesMatch>

  44. mod_rewrite may be used To allow any arbitrary .php file to be displayed as syntax-highlighted source code, without having to rename or copy it to a .phps file:

  45. RewriteEngine On
  46. RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]

  47. The php source filter should not be enabled on production systems, where it may expose confidential or otherwise sensitive information embedded in source code.
  48. ...  ...  ...

  49. When I upgrade to apache 2.2, this:

  50. AddType application/x-httpd-php .php5
  51. AddType application/x-httpd-php .php42
  52. AddType application/x-httpd-php .php4
  53. AddType application/x-httpd-php .php3
  54. AddType application/x-httpd-php .php
  55. AddType application/x-httpd-php .phtm
  56. AddType application/x-httpd-php .phtml
  57. AddType application/x-httpd-php .asp

  58. ...does not worked for me, so I did this:

  59. <FilesMatch "\.(php*|phtm|phtml|asp|aspx)$">
  60. SetHandler application/x-httpd-php
  61. </FilesMatch>

  62. Another interesting point with Apache 2.2 is following.
  63. Let suppose we installed PHP as module. But for some directory, we need to use PHP as CGI (probably because of custom configuration). This can be done using:

  64. <FilesMatch "\.(php*|phtm|phtml|asp|aspx)$">
  65. SetHandler none
  66. </FilesMatch>

  67. AddType application/x-httpd-php-custom .php
  68. Action  application/x-httpd-php-custom  /cgi-bin/php-huge

  69. Note type must be different than "application/x-httpd-php" and also you need to deactivate the handler on sertain extention. You can do mixed configuration:

  70. <FilesMatch "\.(php)$">
  71. SetHandler none
  72. </FilesMatch>

  73. AddType application/x-httpd-php-custom .php
  74. Action  application/x-httpd-php-custom  /cgi-bin/php-huge

  75. in such case files like *.php5 and so on will be parsed via module, but *.php will go to php-huge executable.
复制代码
回复

使用道具 举报

 楼主| sixwingangel 发表于 2009-12-29 10:52:51 | 显示全部楼层
这个是安装完MYSQL 后的提示信息,里面有一些建议,如何改密码之类的:
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-17 02:53 , Processed in 0.036065 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表