Chinaunix首页 | 论坛 | 博客
  • 博客访问: 645786
  • 博文数量: 245
  • 博客积分: 4732
  • 博客等级: 上校
  • 技术积分: 3102
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-02 14:31
文章分类

全部博文(245)

文章存档

2012年(1)

2011年(42)

2010年(132)

2009年(59)

2008年(11)

我的朋友

分类: LINUX

2008-01-17 18:15:42

 

[Tab]就是用linux命令自动补全。

gd库提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片。 (例如:验证码)
在网站上GD库通常用来生成缩略图或者用来对图片加水印或者对网站数据生成报表。
GD库是一种图片功能,需要在php.ini里设置。
zend是一个软件,优化php环境用的
安装MYSQL5.0
1 关闭SELinux,重启系统;
/etc/selinux/config文件中把SELINUX=enforcing 改为:SELINUX=disabled
保存重起系统
2. 安装MySQL(MySQL server应该可以启动了);
3. 启用SELinux,重启系统,之后MySQL server就可以正常启动了。

对以编译好的mysql
1 建立用户和组
# groupadd mysql(组名)
# useradd -g mysql(组名) -d /usr/local/mysql/data -M mysql(用户名)
2 配制:
./configure
3 改变所有者(设置data的属主为mysql)
[root@localhost mysql]#chown -R mysql.mysql data
如果还行加权限:       #chmod -R 755 data
4 mysql的启动:
[root@localhost support-files]#./mysql.server start
  或者 输入 support-files/mysql.server start
5 mysql的自动启动
复制文件mysql.server并重命名为mysqld
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
cp usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
6 进入数据库
#/usr/local/mysql/bin
#./mysql -uroot -p
7.为了在任何目录下键入 mysql 都能进入数据库,需要将 /usr/local/bin/mysql 移入 /usr/bin 和 /usr/sbin 这两个目录下
#cp /usr/local/bin/mysql /usr/bin
#cp /usr/local/bin/mysql /usr/sbin
mysql 安装完成
8 修改root的密码:
[root@localhost mysql]#bin/mysqladmin -uroot password 123456

apache 启动(编译安装的不要用service httpd start启动)
./apachectl start
授予httpd运行权限
# chmod 755 /etc/rc.d/init.d/httpd
将httpd加入系统SysV服务并设置其开机自启动
# chkconfig --add httpd
# chkconfig --level 3 httpd on
这样,今后如需启动、停止、重启Apache就可以用以下方式了:
# service httpd start
# service httpd stop
# service httpd restart
设置成开机自启动
在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache/bin/apachectl start
这样每次重新启动系统以后,apache也会随系统一起启动.
通过whereis httpd命令得出了
httpd: /usr/sbin/httpd /usr/sbin/httpd.worker /etc/
httpd:/usr/lib/httpd /usr/include/httpd /usr/share/man/man8/httpd.8.gz
先看看chkconfig中是否有httpd的启动选项。然后chkconfig --level 345 httpd on 就搞定了。
另外:apache刚安装后访问ip地址可以出现rh自带的显示界面,但是将html文件放到/var/www/html后却提示没有文件,出现以上情况有两种可能:
1.权限不够,建议从chmod 777开始测试一个文件。
2.如果777后还是无法访问该html,那么可能是selinux在捣鬼了。你可以修改/etc/selinux下的config文件将其中的
SELINUX改成SELINUX=disabled
然后重新启动系统就ok了。

http://www.blogcn.com/u/85/40/mophis/blog/35542808.html
系统:turbolinux Desktop 10 kernel 2.6.8-4
zlib-1.2.1-3   php-4.3.11  mysql-5.0.2-alpha  apache-2.0.53
ZendOptimizer-2.5.7-linux-glibc21-i386
一路 rm -rfi 卸掉了原来的PHP、MYSQL、APACHE、JSD
因为我用的是turbo desktop,所以我原来的东西并非用RPM包安装的,所以也用不上 
rpm -e
这个命令卸载软件包.
1 rpm -qa这个命令查询系统上是否安装过apache软件(linux系统中httpd就是apache)
[root@linuxsir01 root]# rpm -qa | grep httpd
redhat-config-httpd-1.1.0-5
httpd-devel-2.0.47-10
httpd-manual-2.0.47-10
httpd-2.0.47-10
[root@linuxsir01 root]# rpm -e httpd-2.0.47-10
这样就完成了httpd-2.0.47-10这个软件包的卸载。其他的软件包
也用同样的方法卸载,和http有关的软件包你可以完全的去卸载。
2 这里我们用的源代码编译安装方式,所以要确认一下系统是否安装了gcc
[root@localhost mysql-5.0.2-alpha]# gcc -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux/3.3.1/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++,objc,java,f77 --host=i586-pc-linux --build=i586-pc-linux --program-suffix=-3.3.1
Thread model: posix
gcc version 3.3.1
我的已经带了,是3.3.1版本,你没有的话,请另外安装。
一、解压、安装mysql
[root@localhost tmp]tar zxvf mysql-5.0.2-alpha.tar.gz
[root@localhost tmp]cd mysql
[root@localhost mysql-5.0.2-alpha]#./configure
> --prefix=/usr/local/mysql
> --with-extra-charsets=all
选项说明:
--prefix=/usr/local/mysql是指安装mysql的路径
--with-extra-charsets=all 让mysql支持多语言
--with-unix-socket-path=指定mysql.sock存放路径,如果不加这个参数的,默认mysql.sock存放路径是/tmp/mysql.sock
congfigure之后,就开始编译了
[root@localhost mysql-5.0.2-alpha]#make 
如果你确信以上的的步骤符合你的系统的话可以把编译和安装命令一起输入:
[root@localhost mysql-5.0.2-alpha]#make && make install
编译结果没有出错的话,那么安装mysql工作我们已经完成了一半了。接着
[root@localhost mysql-5.0.2-alpha]# make install
完成安装。
我们得把文件my.cnf文件放到/etc/目录下。让mysql服务器启动时能找到它。
安装好mysql后,配制文件应该在/usr/local/mysql/share/mysql目录中,配制文件有几个,有my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf
,不同的流量的网站和不同配制的服务器环境,当然需要有不同的配制文件了。一般的情况下,my-medium.cnf这个配制文件就能满足我们的大多需要;
[root@localhost mysql-5.0.2-alpha]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
接着创建MySQL授权表, 否则数据库也是启动不了。
mysql_install_db,这个命令的用途就是做这个的。mysql_install_db这个命令应该已经安装到了/usr/local/mysql/bin这个目录中。
[root@localhost mysql]#bin/mysql_install_db
看看mysql目录下是不是多了一个 var 目录,在到var目录里面看看,是不是还有两个目录 mysql test ,mysql目录下应该有一些文件,test目录应该是空的。
现在 var 目录下只有两个目录没有别的文件,那是因为我们还没有启动mysql
[root@localhost mysql-5.0.2-alpha]# /usr/local/mysql/bin/mysqld_safe &
[1]+  Exit 1                  /usr/local/mysql/bin/mysqld_safe
[root@localhost mysql-5.0.2-alpha]# 
看到上面的信息表示我们已经成功启动了mysql
刚才启动mysql命令是初始化启动方式,以后的启动我们不会使用这个命令。
在启动mysql过程中你可能会遇到和下面类似的这种情况:
[root@localhost mysql]# bin/mysqld_safe &
[1] 14587
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
STOPPING server from pid file /usr/local/mysql/var/localhost.localdomain.pid
050407 01:44:15 mysqld ended
[1]+ Done bin/mysqld_safe
这时我们应该看看错误记录文件
localhost.localdomain.err
位置在/usr/local/mysql/var/下面。寻找出错的原因,或则把错误信息发布到网络,请求别人的帮助。说道这里我还要嘱咐一下新手,因为我为此增经感到恼怒。不要把求助贴的标题写的过于简单,如:求助、 请帮忙、救救我。如果无法准确表达要求助的信息标题,最好的办法是把错误信息作为标题,这样别人不用看具体的内容就知道是否能帮助你。以前我就因为我不懂,因此无法得到求助,以至我故意去诋毁某个论坛,也导致我的帐号被K。
    好了看看错误消息:
[root@localhost mysql]# more /usr/local/mysql/var/localhost.localdomain.err
050407 01:47:18 mysqld started
/usr/local/mysql/libexec/mysqld: File './localhost-bin.1' not found (Errcode: 13
)
050407 1:47:18 [ERROR] Could not use localhost-bin for logging (error 13). Turn
ing logging off for the whole duration of the MySQL server process. To turn it o
n again: fix the cause, shutdown the MySQL server and restart it.
050407 1:47:18 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
050407 01:47:18 mysqld ended
如果出现这种错误消息,说明是数据库目录权限的问题造成的。也就是无法在数据库的目录(var目录)中创建 ibdatal 文件。这时我们只要改变一下var目录的权限就可以了
[root@localhost mysql]#chmod -R 1777 var/
再次启动mysql,我们到 var 目录看看是不是多了几个文件
ibdata1
ib_logfile0
ib_logfile1
localhost.localdomain.err 这个就是刚才启动失败的错误日志,既然成功了,我们可以删除它,以后再次出现错误的话,系统会重建错误日志,这样查找错误也会比较容易。不过实际的网络管理中不推荐这样做。
验证一下mysql是不是真的启动了,最好的办法就是用客户端去连接mysql
[root@localhost mysql]# bin/mysql 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 5.0.2-alpha
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
启动成功
看看是不是有2个数据库,应该和var目录下的2个目录名字一样
mysql
test
mysql> show databases
    -> ;
+----------+
| Database |
+----------+
| mysql    |
| shuifu   |
| test     |
+----------+
3 rows in set (0.00 sec)
我这里已经有3个数据库了,shuifu 是我昨天建立的,不要误会。
刚才我为什么我输入的命令没有被执行?因为我没有输入 ;
; 符号 是mysql结束符,你想让mysql执行你的指令就必须输入 ;
mysql> exit
Bye
查看数据库:
mysql> show databases;
新建数据库:
mysql> create database [新的数据库名];;
删除数据库:
mysql> drop database  [要删除的数据库名];
指定一个数据库为当前数据库
mysql>use  [数据库名];
备份数据库:
[root@localhost mysql]# /usr/local/mysql/bin/mysqldump -uroot -p 123456 > /root/shuifu.sql
Enter password: 这里输入数据库的密码
这个命令就是备份上面的 shuifu 这个数据库
备份的文件名就是 shuifu.sql
导入数据库:
[root@localhost mysql]#/usr/local/mysql/bin/mysqldump -uroot -p 123456 < /home/shuifu.sql
Enter password:
这个命令就是把刚才我们备份的shuifu.sql这个数据库文件导入到数据库中。
注意看清楚<  >,应该知道了吧,<  导入。 > 导出。
apache的安装  2005-4-7 10:44 
三、php的安装
版本php-4.3.11
解压php
[root@localhost server]# tar zxvf php-4.3.11.tar.gz
[root@localhost server]#cd php ----> 
[root@localhost server]#./configure 
>  --prefix=/usr/local/php 
>  --with-mysql=/usr/local/mysql 
>  --with-apxs2=/usr/local/httpd/bin/apxs 
>  --enable-track-vars 
>  --enable-force-cgi-redirect 
>  --with-config-file-path=/usr/local/httpd/conf 
>  --with-zlib
参数说明:
指定安装路径
>  --prefix=/usr/local/php 
指定mysql安装路径,一定要绝对路径,否则编译会失败,
如果你安装mysql不是用源代码安装的,一定要知道mysql的头文件是否存在。多数新手安装apache
>  --with-mysql=/usr/local/mysql 
这个参数是加入apache中为DSO模块的位置,apache2以下的版本参数是apxs,apache2以上的版本参数是apxs2,
就像这样--with-apxs=PATH
>  --with-apxs2=/usr/local/httpd/bin/apxs \
这个参数是为启动cookie的get/post等追踪功能
>  --enable-track-vars \
让apache支持cgi
>  --enable-force-cgi-redirect \
指定php的配制文件存放的目录是/usr/local/httpd/conf目录,我们安装完成后,也要把php.ini复制到这个目录中来
>  --with-config-file-path=/usr/local/httpd/conf 
让apache支持zlib(当时并未注意,直到安装MAMBO的时候,才给出红色的警告,后来我不得不从新编译PHP)
>  --with-zlib
> --with-gd 支持GD模块,大部分php程序都会有这个要求,没有也无所谓,有些不一定的哦 呵呵
因为我没有安装GD模块,所以我编译的时候也没有加入这个选项。
接下来的步骤和安装mysql的时候一样:
# make
# make install
这里我要指出的是在编译的时候遇到的一些问题,也是新手常遇到的问题
错误:1
configure: error: mysql configure failed. Please check config.log for more information.
可能你用的是icc编译版本并不适合你的系统,换一个mysql版本就可以了。
mysql-***-***-icc.tar.gz
错误:2
error: Cannot find MySQL header files under /usr/bin/
出现这种错误,一般是configure的时候给出的参数时 所指定的路径格式错误,导致找不到mysql的头文件,
默认库文件是在/usr/lib, 头文件是在:/usr/include里,程序会自己寻找,只要正确指定你的mysql安装目录就可以了。
错误:3
checking lex output file root... ./configure: line 2356: lex: command not found
configure: error: cannot find output from lex; giving up
If configure fails try --with-jpeg-dir=


configure: error: libpng.(a|so) not found.
这个错误应该是flex包没有安装或则安装有错误,只要重新安装一下这个包就可以了。
错误:4
If configure fails try --with-jpeg-dir=

configure: error: libpng.(a|so) not found.
你可能想让php支持jpeg格式,但是你没有安装libjpeg包
所以编译的时候没有找到jpeg包的安装目录。
在我的映像中这个包要在安装GD包之前安装,否则编译也会出错,不知道是不是这样?
后期的配置
1 复制php.ini-dist为php.ini,并存放到编译时我们指定的目录 中/usr/local/httpd/conf/php.ini
编辑/usr/local/httpd/conf/php.ini文件,找到如下的一行
;default_charset = "iso-8859-1"
在这行下面加一行
default_charset = "gb2312"
2 配置apache 的 httpd.conf文件,在httpd.conf文件中查找:
# Dynamic Shared Object (DSO) Support
在这部分中加入需要调用PHP模块的位置。
LoadModule php4_module        modules/libphp4.so
查找:
DirectoryIndex index.html
在后面加入 index.php 让PAPCHE 也能打开默认首页为php的文件。
查找:
#AddType application/x-tar .tgz
#AddType application/x-httpd-php .php
重启一下apache。
测试一下PHP环境是不是可以运行。把下面这一句另存为PHP网页(如:test.php),

打开浏览器: 
如果能正确显示系统信息,就表示可以了。
安装MYSQL的时候,完全按照MYSQL的安装手册去装是不会有问题的。不要去看任何乱七八糟的东西,我饶了很多弯,比如有个会写 --with-charset=gbk, 有着一条语句,你的VBB就一定会有问题,因为VBB上传图片之类的会编码,一编码就会按照GBK编,而VBB是按照TEXT存储图片,你的SQL语句就会因为其中某个编码断掉。
上面的问题有个解决的方法,升级到mysql 4.1以上,那里有个新的函数。但是~~~但是升级到4.1, mysqlclient就必须跟着升级,对于linux来说重新编译到还好说,对于Windows 来说,你可能必须用PHP5了,因为PHP 4.4rc2带的还是3.23的客户端,还有人说你可以用某些语句修改一下数据库的字段,算了吧,为了搞懂和继续在MAMBO上面作调整,我还是省了吧。
对于其他的备选件PHP的编译,还是考虑带上GD,否则将来一旦要用到,又要重新编译,这个很麻烦,对于带有图库的站点尤其麻烦。
另外在编译完成后,PHP的编译好像是你缺少什么组件并不中断,比如你编译的时候用了 --with-jpeg,如果系统里面没有,PHP的config还是回过去,总不能MAKE完了才知道吧。
我对编译完全新手,所以只好用笨的办法, config完成后,目录里有一个configure.stats(可能是这个名字)的,后面加 --recheck参数可以查看编译的状态。
比如 ./configure.stats --recheck > whaterver.txt 
生成一个编译状态文本,里面会列出来你config的情况,如果你enable了某项,而后面是NO,你就得琢磨琢磨了。
对于APCHE,我也是摸着石头过河,按照网上的一些说法倒是不会有问题,只是你可以考虑静态编译模组,比如rewrite之类的。
这种东东还是看manual最省事
QUOTE:
httpd.nice
#! /bin/sh
#
# Created by configure
CC="gcc-3.2"; export CC
CFLAGS="-O2 -march=pentium3 -fomit-frame-pointer -ffast-math -finline-functions -pipe"; export CFLAGS
"./configure" \
"--with-maintainer-mode" \
"--enable-layout=dato" \
"--with-mpm=worker" \
"--enable-so" \
"--enable-mods-shared=access auth log_config setenvif mime autoindex dir alias deflate headers rewrite" \
"--disable-include" \
"--disable-env" \
"--disable-status" \
"--disable-asis" \
"--disable-cgid" \
"--disable-negotiation" \
"--disable-imap" \
"--disable-actions" \
"--disable-userdir" \
"EAPI_MM=../mm-1.3.0" \
"$@"

QUOTE:
php.nice
#! /bin/sh
#
# Created by configure

CFLAGS='-O2 -march=pentium3 -fomit-frame-pointer -ffast-math -finline-functions -pipe' \
CC='gcc-3.2' \
'./configure' \
'--host=i686-pc-linux-gnu' \
'--with-maintainer-mode' \
'--with-apxs2=/w3/apache2/bin/apxs' \
'--with-mysql=shared,/w3/mysql' \
'--prefix=/w3/apache2/php' \
'--with-exec-dir=/w3/ext' \
'--with-config-file-path=/w3/apache2' \
'--enable-safe-mode' \
'--enable-memory-limit' \
'--enable-overload' \
'--enable-mbstring=shared' \
'--enable-mbregex' \
'--enable-trans-sid' \
'--enable-exif=shared' \
'--with-zlib' \
'--with-gd=shared' \
'--enable-gd-native-ttf' \
'--enable-gd-imgstrttf' \
'--enable-gd-jis-conv' \
'--with-ttf=/usr/lib' \
'--with-jpeg-dir=/usr/lib' \
'--with-png-dir=/usr/lib' \
'--with-zlib-dir=/usr/lib' \
'--with-xpm-dir=/usr/lib' \
'--with-freetype-dir=/usr/include/freetype2/freetype' \
'--with-iconv=shared' \
'--disable-posix' \
'--disable-sockets' \
'--disable-ipv6' \
'--disable-cgi' \
'--disable-cli' \
'--disable-path-info-check' \
'--disable-rpath' \
'--without-pear' \
'--disable-debug' \
"$@"
The basic commands you must execute to install and use a MySQL binary distribution are:

shell> groupadd mysql
shell> useradd mysql -c "MySQL Server" -d /dev/null -g mysql -s /sbin/nologin
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
If you would like to use mysqlaccess and have the MySQL distribution in some non-standard place, you must change the location where mysqlaccess expects to find the mysql client. Edit the `bin/mysqlaccess' script at approximately line 18. Search for a line that looks like this:
$MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable

Change the path to reflect the location where mysql actually is stored on your system. If you do not do this, you will get a Broken pipe error when you run mysqlaccess.

shell> scripts/mysql_install_db
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
cp support-files/my-medium.cnf /etc/my.cnf

cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf

shell> bin/safe_mysqld --user=mysql &
or
shell> bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x

/usr/local/mysql/bin/mysqladmin -u root -p password your_new_password 

/usr/local/mysql/bin/mysqladmin -u root -p shutdown 
Enter password:123456

020531 13:14:35 mysql ended 
[1]+ Done /usr/local/mysql/bin/safe_mysqld --user=mysql 

If you would like MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself and in section 2.4.3 Starting and Stopping MySQL Automatically.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

You need to add these start and stop commands to the appropriate places in your `/etc/rc*' files when you want to start up MySQL automatically on your server.

On most current Linux distributions, it is sufficient to copy the file mysql.server into the `/etc/init.d' directory (or `/etc/rc.d/init.d' on older Red Hat systems). Afterwards, run the following command to enable the startup of MySQL on system bootup:

shell> chkconfig --add mysql.server

As an alternative to the above, some operating systems also use `/etc/rc.local' or `/etc/init.d/boot.local' to start additional services on bootup. To start up MySQL using this method, you could append something like the following to it:

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

You can also add options for mysql.server in a global `/etc/my.cnf' file. A typical `/etc/my.cnf' file might look like this:

[mysqld]
datadir=/usr/local/mysql/var
socket=/var/tmp/mysql.sock
port=3306
user=mysql

[mysql_server]
basedir=/usr/local/mysql

The mysql.server script understands the following options: datadir, basedir, and pid-file. 

        下载地址
http://blog.chinaunix.net/u/12502/showart_314636.html 配制


http://blog.s135.com/tech/

为Apache配置mod_deflat压缩输出
[ 2007-9-10 10:29 | by 张宴 ]

  [文章作者:张宴 本文版本:v1.0 最后修改:2007.09.10 转载请注明出处:http://blog.s135.com]
1、如果未安装Apache。编译时,加上--enable-deflate,例如:(仅针对Linux版,Windows版无须此步骤)
  ./configure --prefix=/usr/local/apache --enable-rewrite --enable-so --enable-deflate
2、如果已安装Apache。添加mod_deflate模块,例如:(仅针对Linux版,Windows版无须此步骤)
  /usr/local/apache/bin/apxs -i -a -c /home/zhangyan/software/httpd-2.0.59/modules/filters/mod_deflate.c
  注:/home/zhangyan/software/httpd-2.0.59/为Apache源码路径。
3、进行以上步骤后,会在httpd.conf中自动加入一行:(Windows版请将下行最前面的#号去掉)
引用
LoadModule deflate_module     modules/mod_deflate.so
4、编辑httpd.conf,增加:
  Linux版:
引用

DeflateCompressionLevel 9
SetOutputFilter DEFLATE
#DeflateFilterNote Input instream
#DeflateFilterNote Output outstream
#DeflateFilterNote Ratio ratio
#LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
#CustomLog /var/log/deflate_log.log deflate

  Windows版:
引用

DeflateCompressionLevel 9
SetOutputFilter DEFLATE
#DeflateFilterNote Input instream
#DeflateFilterNote Output outstream
#DeflateFilterNote Ratio ratio
#LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
#CustomLog logs/deflate_log.log deflate

  如果将#号去掉,可以在logs/deflate_log.log日志文件中看到文件压缩前后的字节数、压缩比,例如:
  "GET /index.html HTTP/1.1" 49373/276249 (17%)
  压缩前的字节数为276249,压缩后的字节数为49373,压缩比为17%
  5、详细配置见Apache官方网站:

apache在linux下的默认最大进程数为256,无论如何修改httpd.conf都不能超过这个限制。如果想加大这个限制,在编译apache前编辑/home/tmp/apache/src/include/httpd.h,将其中#define HARD_SERVER_LIMIT 256 一行改为#define HARD_SERVER_LIMIT 2048后再编译apache,

针对HTTP服务
  通过修改配置文件中的ServerTokens参数,可以将Apache的相关信息隐藏起来。但是,Red Hat Linux运行的Apache是编译好的程序,提示
信息被编译在程序里,要隐藏这些信息需要修改Apache的源代码,然后,重新编译安装程序,以实现替换里面的提示内容。
  以Apache 2.0.50为例,
编辑ap_release.h文件
修改“#define AP_SERVER_BASEPRODUCT \ "Apache\"”为“#define AP_SERVER_BASEPRODUCT \"Microsoft-IIS/5.0\"”。
编辑 os/unix/os.h文件
修改“#define PLATFORM \"Unix\"”为“#define PLATFORM\"Win32\ "”。修改完毕后,重新编译、安装Apache。
Apache安装完成后,修改httpd.conf配置文件,
将“ServerTokens Full”改为 “ServerTokens Prod”;
将“ServerSignature On”改为“ServerSignature Off”,然后存盘退出。重新启动Apache后,用工具进行扫描,发现提示信息中已经显示操
作系统为Windows。


 

转自

adminjun
qq:279872
网络技术研究会群:8070045
中国linux公社论坛群:4478487
其实这是我用RouterOS和redhat linux进行pppoe服务器的配置及在readius中进行账号和MAC地址绑定全文中的一部分,
1 安装MYSQL
# groupadd mysql
# useradd -g mysql -d /usr/local/mysql/data -M mysql
# tar -zxvf mysql-5.0.27.tar.gz
# cd mysql-5.0.27
./configure --prefix=/usr/local/mysql \ 指定安装目录
> --sysconfdir=/etc \ 配置文件的路径
> --localstatedir=/usr/local/mysql/data \ 数据库存放的路径
> --enable-assembler \ 使用一些字符函数的汇编版本
> --with-mysqld-ldflags=-all-static \ 以纯静态方式编译服务端
> --with-charset=utf8 \ 添加utf8字符支持
> --with-extra-charsets=all 添加所有字符支持
# make
# make install
# /usr/local/mysql/bin/mysql_install_db
# chown -R mysql:mysql /usr/local/mysql/data
# cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
2 安装Apache
# tar -zvxf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./configure --prefix=/usr/local/apache --enable-so
# make
# make install

2.安装apache
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache/conf
--prefix=/usr/local/apache 指定把apahce安装到/usr/local/apache目录中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在这个目录中;
--enable-track-vars 为启动cookie的get/post等追踪功能
--enable-so DSO功能
--enable-mods-shared=all 包含所有的模块为DSO

先安装支持包(注意安装顺序)
安装注意事项:
 
以Apache使用php有两种方式:作为动态模块,其在运行状态时可以载入到web服务器,或者作为静态模块,其可直接编译到web服务器代码中。

对于文本,我们着重于第一种方式。
为了能让Apache2.0模块使php动态载入,Apache服务器必须以动态共享对象(DSO,Dynamic Shared Object)编译。
 可以通过传递 --enable-so 参数到 Apache 2
tar -jxvf httpd-2.2.2.tar.bz2
cd httpd-2.2.2
./configure --prefix=/usr/local/apache2 --enable-so make && make install
//切记要支持Zend Optimizer不可加 --with-mpm=worker选项 
这一过程将会设置,编译,以及将服务器安装到/usr/local/下。
启动apache守护进程:
/usr/local/apache2/bin/apachectl start (开启 start 关闭 stop 重启 restart)
打开浏览器,输入 就能看到一个apache的欢迎页面了,这表示我们已经成功的安装了apache2 。
如make install出现问题,可能是缺少编译器或动态链接库,可重装系统解决。
/usr/local/apache2/conf/目录下conf文件内serverName可修改为127.0.0.1,如出现无法启动apache服务。

 
先列出配置gd2需要的网址
gd-2.0.33.tar.gz

jpegsrc.v6b.tar.gz
ftp.uu.net/graphics/jpeg

libpng-1.2.14.tar.tar

libpng.sourceforge.net
sourceforge.net/projects/libpng
zlib-1.2.3.tar.gz

sourceforge.net/projects/zlib
freetype-2.2.1.tar.gz

freetype.sourceforge.net/index2.html
sourceforge.net/projects/freetype
建立初始目录:
mkdir /usr/local/modules
jpeg目录
# mkdir /usr/local/modules/jpeg6
# mkdir /usr/local/modules/jpeg6/bin
# mkdir /usr/local/modules/jpeg6/lib
# mkdir /usr/local/modules/jpeg6/include
# mkdir /usr/local/modules/jpeg6/man
# mkdir /usr/local/modules/jpeg6/man/man1
安装zlib
# tar xzvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
不要用--prefix自定义安装目录,影响gd的安装
# ./configure
# make
# make install
安装freetype
# tar xzvf freetype-2.2.1.tar.gz
# cd freetype-2.1.5
# ./configure --prefix=/usr/local/modules/freetype
# make
# make install
安装libpng
# tar xzvf libpng-1.2.14.tar.tar
不要用--prefix自定义安装目录,影响gd的安装
# cd libpng-1.2.5
# cp scripts/makefile.std makefile
# make
# make install
安装jpeg
# tar xzvf jpegsrc.v6b.tar.gz
# ./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
# make
# make install
安装GD
# tar xzvf gd-2.0.33.tar.gz
# ./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-
zlib --with-freetype=/usr/local/modules/freetype
# make
# make install
安装php
# mkdir /usr/local/php5
# tar -zxvf PHP-5.1.4.tar.gz
# cd php-5.1.4
# ./configure --prefix=/usr/local/php5 \
>--with-mysql=/usr/local/mysql \
>--with-mysqli=/usr/local/mysql/bin/mysql_config \
>--with-apxs2=/usr/local/apache/bin/apxs \
>--with-gd=/usr/local/modules/gd \
>--with-jpeg-dir=/usr/local/modules/jpeg6 \
>--with-zlib \
>--with-png \
>--with-freetype-dir=/usr/local/modules/freetype \
>--with-xmlrpc \
>--with-config-file-path=/usr/local/php5/etc
# make
# make install
# cp ./php.ini-dist /usr/local/php5/etc/php.ini
修改httpd.conf
#vi /usr/local/apache/conf/httpd.conf
加载php模块,去掉注释“#”,如没有此行,请加上。
LoadModule php5_module modules/libphp5.so
加上此两行
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
到这里全部的安装过程已完成。
在这里我遇到一个问题,我的as4安装时没有选择安装apache服务器,没想到启动后,仍然给我装了。。我晕。所以我
刚刚上面安装的apache2.2.3版本的不能启动,提示端口已被默认安装的apache占用了,所以我们这里还需要修改
Apache的启动脚本(以源码方式编译安装的Apache是没有启动脚本的,但这里由于我的系统默认给我装了低版本的
apache,同时也就有了启动脚本,所以我这里只需要修改就行了)
修改启动脚本
# vi /etc/rc.d/init.d/httpd
启动脚本(如果你的系统没有这个脚本,就把下面内容复制到httpd文件中去):

#!/bin/bash

# Startup script for the Apache2.0.X Web Server
# Fixed by Comsenz - Nanu (nanu@discuz.com)

# chkconfig: - 85 15

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
       . /etc/sysconfig/httpd
fi

INITLOG_ARGS=""

apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog=httpd
RETVAL=0

start() {
       echo -n $"Starting $prog: "
       daemon $httpd $OPTIONS
       RETVAL=$?
       echo
       [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
       return $RETVAL
}
stop() {
       echo -n $"Stopping $prog: "
       killproc $httpd
       RETVAL=$?
       echo
       [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
       echo -n $"Reloading $prog: "
       killproc $httpd -HUP
       RETVAL=$?
       echo
}

case "$1" in
start)
       start
       ;;
stop)
       stop
       ;;
status)
       status $httpd
       RETVAL=$?
       ;;
restart)
       stop
       start
       ;;
condrestart)
       if [ -f /var/run/httpd.pid ] ; then
               stop
               start
       fi
       ;;
reload)
       reload
       ;;
graceful|help|configtest|fullstatus)
       $apachectl $@
       RETVAL=$?
       ;;
*)
       echo $"Usage: $prog

{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
       exit 1
esac

exit $RETVAL
我这里只需要找到文件中的:
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
根据我们自己的安装情况更改以上两行中Apache的路径
授予httpd运行权限
# chmod 755 /etc/rc.d/init.d/httpd
将httpd加入系统SysV服务并设置其开机自启动
# chkconfig --add httpd
# chkconfig --level 3 httpd on
这样,今后如需启动、停止、重启Apache就可以用以下方式了:
# service httpd start
# service httpd stop
# service httpd restart

freeradius-1.1.3+mac地址绑定

apache+mysql+php+GD+zend+mmcache安装 
安装Apahe与MySQL,将php安装成支持gif,png,jpeg,freetype,mysql,需要更强大的图形处理能力,可安装ImageMagic。可以分析大流量网站日志(更大流量的网站推荐用Webalizer,不过界面简陋:-,),同时安装mmcache+zend来加速度
二、安装环境描述
操作系统:GNU Linux kernel 2.4.20-8
web服务器:Apache httpd-2.0.50 下载:
数据库服务器:mysql-standard-4.0.20-pc-linux-i686.tar.gz 下载:http://dev.mysql.com/get/Downloads/MySQL-4.0/mysql-standard-4.0.20-pc-linux-i686.tar.gz/from/http://mysql.ihostunit.com/
脚本程序语言:php-4.3.8.tar.gz下载: 其它库文件:
ZLIB:zlib-1.2.1.tar.gz 下载:
FreeType:freetype-2.1.9.tar.gz  
下载:
PNG:libpng-1.2.5.tar.gz
JPEG:jpegsrc.v6b.tar.gz 下载: GD:gd-2.0.28.tar.gz 下载: 已支持gif
mmcache:下载: zend:
下载2
一、下载
gd-2.0.33.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.7.tar.tar
zlib-1.2.2.tar.gz
freetype-2.1.9.tar.gz
php-4.3.9.tar.gz 
三、安装步骤
1.安装mysql(由于安装mysql比较简单,省略)安装在/usr/local/mysql目录 
2.安装apache
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache/conf
--prefix=/usr/local/apache 指定把apahce安装到/usr/local/apache目录中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在这个目录中;
--enable-track-vars 为启动cookie的get/post等追踪功能
--enable-so DSO功能
--enable-mods-shared=all 包含所有的模块为DSO
如果需要更多的选项,可能通过下面的命令来查看;
./configure --help
make
make install
设置成开机自启动
在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache/bin/apachectl start
这样每次重新启动系统以后,apache也会随系统一起启动.
3.安装PHP
  A先安装支持包(注意安装顺序)
建立初始目录:
mkdir /usr/local/modules
#jpeg目录
mkdir /usr/local/modules/jpeg6
mkdir /usr/local/modules/jpeg6/bin
mkdir /usr/local/modules/jpeg6/lib
mkdir /usr/local/modules/jpeg6/include
mkdir /usr/local/modules/jpeg6/man
mkdir /usr/local/modules/jpeg6/man/man1
A1、安装zlib
tar xzvf zlib-1.2.1.tar.gz
cd zlib-1.2.1
#不要用--prefix自定义安装目录,影响gd的安装
./configure
make
make install
A2、安装freetype
tar xzvf freetype-2.1.5.tar.gz
cd freetype-2.1.5
./configure --prefix=/usr/local/modules/freetype
make
make install
A3、安装libpng
tar xzvf libpng-1.2.5.tar.gz
#不要用--prefix自定义安装目录,影响gd的安装
cd libpng-1.2.5
cp scripts/makefile.std makefile
make test
make install
A3、安装jpeg
tar xzvf jpegsrc.v6b.tar.gz
./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
make
make install
A4、安装GD
tar xzvf gd-2.0.28.tar.gz
./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
make
make install
B、安装PHP
tar xzvf php-4.3.8.tar.gz
cd  php-4.3.8
./configure --prefix=/usr/local/php --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png --with-freetype-dir=/usr/local/modules/freetype --enable-magic-quotes --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars --enable-force-cgi-redirect --enable-ftp --with-config-file-path=/usr/local/php/etc
一点说明:
--prefix=/usr/local/php 指定把php-4.3.8安装到/usr/local/php目录中;
--with-mysql=/usr/local/mysql 指定mysql数据服务器安装的位置;
--with-apxs2=/usr/local/apache/bin/apxs 这是加入apache中为DSO模块的位置;
-enable-track-vars 为启动cookie的get/post等追踪功能
--with-config-file-path=/usr/local/php/etc 指定php的配制文件存放的目录是/usr/local/php/etc目录,我们安装完成后,也要把php.ini复制到这个目录中来。
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
更改apache的配制文件:得加几行,目的是让apache能解释php程序。
查找AddType application/x-tar .tgz  行,在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.html.var index.php
进行php.ini文件的配置工作
查找safe_mode=Off,更改为safe_mode=On
1)查找max_execution_time = 30,更改为max_execution_time = 600  
(2)查找max_input_time = 60,更改为max_input_time = 600
(3)查找memory_limit = 8M ,更改为memory_limit = 20M
(4)查找display_errors = On,更改为display_errors = Off
(5)查找register_globals = Off,更改为register_globals = On
(6)查找post_max_size = 8M,更改为post_max_size = 20M
(7)查找upload_max_filesize = 2M,更改为upload_max_filesize = 20M
(8)查找session.auto_start = 0,更改为session.auto_start = 1
执行:wq!命令保存后退出,从而完成了php.ini文件的配置工作。
C安装mmcache
Step 1. Compiling Turck MMCache
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
提示:You must specify the real prefix where PHP is installed in the "export" command. It may be "/usr" "/usr/local", or something else.
Step 2. Installing Turck MMCache 
  make install
Step 3. Configuring Turck MMCache
Turck MMCache can be installed both as Zend or PHP extension, so you need to edit your php.ini file (usually /etc/php.ini).
To install as Zend extension: 
  zend_extension="/usr/lib/php4/mmcache.so"
  mmcache.shm_size="16"
  mmcache.cache_dir="/tmp/mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""
  mmcache.shm_max="0"
  mmcache.shm_ttl="0"
  mmcache.shm_prune_period="0"
  mmcache.shm_only="0"
  mmcache.compress="1"
If you use thread safe build of PHP you must use "zend_extension_ts" instead of "zend_extension".
To install as PHP extension: 
  extension="mmcache.so"
  mmcache.shm_size="16"
  mmcache.cache_dir="/tmp/mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""
  mmcache.shm_max="0"
  mmcache.shm_ttl="0"
  mmcache.shm_prune_period="0"
  mmcache.shm_only="0"
  mmcache.compress="1"
Step 4. Creating cache directory 
  mkdir /tmp/mmcache
  chmod 0777 /tmp/mmcache
4 安装Zend
解压后执行install.sh就可以了  

架设 web 服务器的支持当然首选 mysql,apache,php,选定软件后就从本站的下载中心下载了 mysql(2.23.37),apache(1.3.19),php(4.0.5)
来安装.
我选择的安装顺序为:1)mysql 2)apache 3)php
可以开始安装了,在安装软件时养成先看看 ./configure --help 的习惯是非常重要的,因为会有新的功能安装方法提供. 
一)mysql 的安装
1.下载软件包到 /usr/local/src 内
2.解压软件包 tar -zvxf mysql-2.23.37.tar.gz
3.进入解压后的目录 /usr/local/src/mysql-2.23.37
4.运行安装配置
#./configure --prefix=/usr/local --with-charset=gb2312 --with-extra-charsets=big5,latin1
配置的第一个参数不用说了,因为我们使用简体,所以需要优化简体的查询,我们这也需要对繁体和英文使用,--with-charset 和 --with-extra-char-charsets 就是对这些需要进行配置,好了可以按回车了!
5.编译 mysql
#make
这各过程是漫长的,可以休息一下或者去做其它的事情直到编译完成
6.安装 mysql
#make install
7.安装 mysql 库
#cd /usr/local/lib
#./mysql_install_db
8.启动测试 mysql
#/usr/local/share/mysql/mysql.server start
9.运行 mysql
#/usr/local/bin/mysql
10.为了在任何目录下键入 mysql 都能运行 mysql ,需要将 /usr/local/bin/mysql 移入 /usr/bin 和 /usr/sbin 这两个目录下
#cp /usr/local/bin/mysql /usr/bin
#cp /usr/local/bin/mysql /usr/sbin
mysql 安装完成.^o^
------------------------------------------------------------
二.安装 apache
1.下载软件包到 /usr/local/src
2.解压软件包
3.建立 apache 目录
#cd /usr/local
#mkdir apache
4.进入解压后的目录位置
#cd /usr/local/src/apache-1.3.19
5.运行安装配置
#./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max
注意从这开始与大多数书本和文章介绍的安装方法不同,不必 php 和 apache 交叉配置,后面会介绍 php 的安装方法! 这里的配置意思是 apache 进行最大和最多模块支持安装
6.编译 apache
#make
7.安装 apache
#make install
apache 的安装完成
------------------------------------------------------------
三.安装 php
1.下载软件包到 /usr/local/src
2.解压软件包
3.建立 php 的目录
#cd /usr/local
#mkdir php
4.进入解压后的目录位置
#cd /usr/local/src/php-4.0.5
5.运行安装配置
这里的配置较为复杂:
#./configure --prefix=/usr/local/php --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local --enable-track-vars --disable-debug
特别要指出的是这配置了 apache 自动加载 php 模块功能和 mysql 数据库支持功能
6.编译 php
#make
7.安装 php
#make install
php 安装完成
------------------------------------------------------------
到这 mysql+apache+php 安装完成.我还会继续介绍如何配置 apache 服务器使得 php,mysql 发挥它们出色的功能
安装至此完成,可以使用如下命令启动apache:
server# /usr/local/apache/bin/apachectl start
如果要使用https则使用如下命令启动:
server# /usr/local/apache/bin/apachectl startssl
(键入证书密码,然后回车)
apache的自起动
设置成开机自启动
在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache/bin/apachectl start
这样每次重新启动系统以后,apache也会随系统一起启动.

1 将/usr/local/apache2/bin/apachectl拷贝到/etc/rc.d/init.d/httpd
2,然后在httpd得注释得开头改成
#! /bin/sh
# chkconfig 35 70 30
# description apache
保存!
3,/sbin/chkconfig httpd reset
稍微解释一下上面三步的作用,免得以后自己会忘记
1,将脚本文件考到/etc/rc.d/init.d/httpd,做为服务的启动脚本,/etc/rc.d/init.d/这个文件夹内的脚本都是启动时候的服务的
具体参见
2 # chkconfig 35 70 30
   # description apache
这两句的作用是让chkconfig认的出这个脚本服务的性质
第一个数字35表示在运行级别3和5启动,如果要在4也启动那就是345,其他类推
第二个数字表示启动优先级
第三个不大清楚,没来得及查,好像是kill得优先级之类。。
另外在,/etc/rc.d/rc5.d/文件夹里可以看到5这个运行级别得服务
S70httpd表示httpd在5这个级别启动,优先级是70
3这一步后chkconfig可以看到httpd了
也可以用,/sbin/chkconfig --add httpd
下次启动httpd就可以启动了(如果要立即启动用/sbin/service httpd start)
编写apache的自启动文件(Freebsd下):
server# edit /usr/local/etc/rc.d/apache-server.sh 示例:apache-server.sh
server# chmod 755 apache-server.sh
重新启动服务器,Bind9就可以自动运行!
测试服务器:
在/usr/local/apache/htdocs下编辑test.php来测试php是否安装成功 示例:test.php
phpinfo()
?>
在浏览器中的地址栏中输入:即可以显示php的安装信息。
如果你使用的是apachects startssl命令启动的话,你可以
在浏览器中的地址栏中输入:来显示php的安装信息。
http://it.linuxblog.cn/it/net/linux/2006-07-04/638.html

linux下配置APACHE2.0.50+PHP5.0.3+MYSQL4.0.20+GD库
前些天,升级服务器的时候,因为GD库的原因.make不了PHP4.3.8 于是就一步步装了PHP5其实,安装步骤和PHP4只差一点点而已
如果你机器里原来装有了PHP或者APACHE的RPM或者低版本.请先删除
首先,服务器GCC要有,不然什么都不能做.可以用gcc -v来查看是否安装了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
有以上类似信息说明已有GCC,
如果你没有,请先拿安装光盘装好它
请下载以下所有的东西:
httpd-2.0.50.tar.gz
MySQL-client-4.0.20-0.i386.rpm
MySQL-server-4.0.20-0.i386.rpm
php-5.0.3.tar.gz
ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
gd-2.0.28.tar.gz
libxml2-2.5.11.tar.gz
zlib-1.2.1.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.5.tar.gz
xpm-3.4k-2.i386.rpm
gd-devel-1.8.4-11.i386.rpm
可能你的电脑不需要这么多.但最好都下载吧.
这些我都放在我 FTP里 的soft目录下,如果你点左边的<< FTP里 >>看不了,那可能是密码改了,请看我论坛签名里的下载信息.
不过,
可能你看到这贴子的时候会有以上软件新的版本下载了.看着办吧.
开始装吧>>>>>>>>>>>>>>>>>>>>>>>>>
先安装MYSQL 服务器
#rpm -ivh MySQL-server-4.0.20-0.i386.rpm
接着客户端
#rpm -ivh MySQL-client-4.0.20-0.i386.rpm
安装好后试试能不能用
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27651 to server version: 4.0.20-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
说明OK
请自己改mysql的密码
安装GD库基本包
#rpm -ivh gd-devel-1.8.4-11.i386.rpm
安装XPM支持
#rpm -ivh xpm-3.4k-2.i386.rpm
安装libxml2 (记得PHP5只支持libxml2-2.5.10以上版本)
#tar zxvf libxml2-2.5.11.tar.gz
#cd libxml2-2.5.11
#./configure
#make
#make install
开始装GD库支持
-------------------------------------------------------
ZLIB
#tar zxvf zlib-1.2.1.tar.gz
#cd zlib-1.2.1
#./configure
#make
#make install
JPEGSRC
#tar zxvf jpegsrc.v6b.tar.gz
#cd jpegsrc-6b
#./configure
#make
#make install-lib
#make install
LIBPNG
#tar zxvf libpng-1.2.5.tar.gz
#cd libpng-1.2.5
#cp scripts/makefile.linux Makefile
#./configure
#make
#make install-headers
#make install
最后是GD2.*
gd-2.0.28
#tar zxvf gd-2.0.28.tar.gz
#cd gd-2.0.28
#./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
#make
#make install
----------------------------------------------
上面一切都很顺利的话,GD就算成功的安装上了. 如果有问题,应该是缺少支持包,总之是少什么就下载什么来安装上.
跟着下来,开始安装APAHCHE2和PHP5
#tar zxvf httpd-2.0.50.tar.gz
#cd httpd-2.0.50
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install
#tar zxvf php-5.0.3.tar.gz
#cd php-5.0.3
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars --with-zlib-dir=/usr/local -with-mysql=/var/lib/mysql
#make
#make install
我是把他们分别安装在/usr/local/apache2 & PHP目录下的
我原来MAKE PHP4.3.8 的时候,遇到
ext/gd/gd.lo(.text+0x63a): In function `zm_deactivate_gd':
/root/software/php-4.3.8/ext/gd/gd.c:385: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php]Error 1
是因为GD库的freetype没装,后来我马上去下载它安装.就没错误了
有的安装工作做好了,接着我们来配置.
在PHP目录下运行
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
1 在 #AddType application/x-tar .tgz下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
2 LoadModule php5_module modules/libphp5.so请把上面的#号去掉
3 DirectoryIndex index.html index.html.var在后面加 index.php 让它把index.php做为默认页
4 # don't use Group #-1 on these systems!把下面的用户名和组改为
User apache
Group apache
(原来好像是nobody)
5 #ServerName 把#去掉,后面的IP改成你的IP.
6 DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径
比如我是放在/home/easy目录下,所以我以后上传PHP文件就放在/home/easy目录下,然后用IP访问,就能看到首页了
7 为了让中文网页没乱码找到
AddDefaultCharset iso8859-1把后面的iso8859-1改为gb2312
差不多就这些了,至于apache2其它优化,请看 里的apache配置那一分类.
保存httpd.conf文件.
启动它
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下, 我的就是上面所说的 /home/easy
#vi /home/easy/index.php
phpinfo();
保存.试试在测试器里打IP进去就可以看到PHPINFO页了.
用ZendOptimizer-2.5.3加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
一路默认下去应该就好了.
再看看测试页,
找找是不是这样的?
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.3, Copyright (c) 2003-2004, by Zend Technologies with Zend Optimizer v2.5.3, Copyright (c) 1998-2004, by Zend Technologies
好了,全部的安装就完成了.
接下来的工作才是最重要的!
那就是如何用PHP5来为我们制作高效率的网站


本人最近决定将原 Apache-1.3.27+php-4.1.0+Mysql-3.23.47 更换为 Apache-2.0.43+Php-4.2.3+Mysql-3.23.53,本人原先使用的 php 能提供最大 20M 的文件上载功能,支持 session 。当本人决定更新系统时,到网上查阅了不少文档,发现很少有提到成功使用Apache-2.0.43+Php-4.2.3+Mysql-3.23.53,只好自己动手安装配置,在经过几次反复设置后,终于成功,现将本人的安装过程提供给广大初学者,使大家少走冤枉路,如有不到之处,还请不吝指正。
  一、软件下载
  分别下载软件以下软件:
  Apache-2.0.43 ()
  Php-4.2.3 ()
  Mysql-3.23.53 ()
  二、准备安装
  由于本人将所有软件的源代码放置在目录 /home/src 下 ,安装目录为 /server ,下载后的源代码包在/root目录下,故执行以下操作:
  mkdir /home/src
  mkdir /server
  groupadd mysql
  useradd -g mysql -d /home/mysql mysql //建立mysql组及用户
  cd /home/src
  tar zxvf /root/mysql-3.23.53.tar.gz
  tar zxvf /root/httpd-2.0.43.tar.gz
  tar zxvf /root/php-4.2.3.tar.gz
  三、安装配置过程
  使用 vi 编辑一 shell 文件,内容如下:
  -----------------------------------
  cd /home/src/mysql-3.23.53
  ./configure --prefix=/server/mysql
  make
  make install
  /server/mysql/bin/mysql_install_db
  chown -R root /server/mysql
  chgrp -R mysql /server/mysql
  chown -R root /server/mysql/bin
  chgrp -R mysql /server/mysql/bin
  chown -R root /server/mysql/var
  chgrp -R mysql /server/mysql/var
  chmod 777 /server/mysql/var
  chown -R root /server/mysql/var/mysql
  chgrp -R mysql /server/mysql/var/mysql
  chmod 777 /server/mysql/var/mysql
  chown -R root /server/mysql/var/mysql/*
  chgrp -R mysql /server/mysql/var/mysql/*
  chmod 777 /server/mysql/var/mysql/*
  chmod 777 /server/mysql/lib/mysql/libmysqlclient.a
  #安装 mysql-3.23.53
  cd /home/src/httpd-2.0.43
  ./configure --prefix=/server/apache --enable-so
  make
  make install
  #安装 Apache-2.0.43
  cd /home/src/php-4.2.3
  ./configure --with-mysql=/server/mysql --with-apxs2=/server/apache/bin/apxs
  --eable-track-vars --enable-force-cgi-redirect --enable-pic
  --enable-inline-optimiation --enable-memory-limit --enable-bcmath
  --enable-shmop --enable-versioning
  -enable-calendar --enable-dbx --enable-dio --enable-mcal
  --with-config-file-path=/server/apache/conf
  make
  make install
  cp php.ini-dist /server/apache/conf/php.ini
  #安装php-4.2.3 ,以上某些模块可不使用,--with-config-file-path=/server/apache/conf 指定
  #php的配置文件在目录 /server/apache/conf
  ln -s /server/apache/bin/apachectl /bin/apache
  ln -s /server/mysql/bin/mysql /bin/mysql
  #创建符号连接
  ----------------------------------------------------
  四、修改配置文件
  vi /server/apache/conf/httpd.conf
  # 加入以下行(装载php4模块并指定.php 文件)
  # LimitRequestBody (指定php处理的请求数据大小,以下指定为 20M)
  LoadModule php4_module modules/libphp4.so
  
  SetOutputFilter PHP
  SetInputFilter PHP
  LimitRequestBody 20971520
  

  #注解以下行(在文本前加#),使apache显示中文,具体原因未知
  ForceLanguagePriority Prefer Fallback
  AddDefaultCharset ISO-8859-1
  #加入默认的引导文件index.php(找到DirectoryIndex,修改如下:)
  DirectoryIndex index.html index.html.var index.php
  #指定网站目录(假设为 /apache 目录)
  DocumentRoot "/apache"
  vi /server/apache/conf/php.ini
  #找到并修改以下参数
  max_execution_time = 600 ;最大运行时间 600 秒
  max_input_time = 600 ;最大输出时间 600秒
 memory_limit = 20M ;最大内存限制 20M
  file_uploads = On ;允许上载文件
  upload_max_filesize = 20M ;最大文件大小 20M
  post_max_size = 20M ;php可接受的 post 方法大小 20M
  session.auto_start = 1 ;session自动启动
  五、运行
  #启动mysql
  /server/mysql/bin/safe_mysqld --user=mysql &
  #停止mysql
  /server/mysql/bin/mysqladmin shutdown
 #启动apache
  apache start
  #停止apache
 apache stop
  mkdir /apache
  echo "/apache/index.php
  echo "phpinfo();" >>/apache/index.php
  echo "?>" >>/apache/index.php
  #生成/apache/index.php 文件
  在浏览器上输入 linux 机器网址,php 的配置信息将显示出来。

Unix 服务器的安装与配置 (FreeBSD) 之Apache的完全安装(apache+php4+mod_ssl+mod_perl+mod_fastcgi+mod_gzip)
本文主要讨论源代码方式的安装。  
  从互联网下载以下几个程序(本文采用DSO方式安装),按如下步骤进行处理:
1、apache_1.3.27.tar.gz
2、mod_ssl-2.8.12-1.3.27.tar.gz
3、mod_perl-1.0-current.tar
4、mod_gzip-1.3.26.1a.tar.gz
5、mod_fastcgi-2.4.0.tar.gz
6、php-4.3.1.tar.gz
(另需安装pth-1.4.1.tar.gz、mm-1.1.3.tar.gz、perl-5.6.1.tar.gz、zlib-1.1.4.tar.gz、libpng-1.2.5.tar.gz、png、gettext、freetype、jpeg、gd、gd2)
安装pth-1.4.1
server# tar zxvf pth-1.4.1.tar.gz
server# cd pth-1.4.1
server# ./configure --enable-pthread
server# make
server# make test
server# make install
安装mm-1.1.3
server# tar zxvf mm-1.1.3.tar.gz
server# cd mm-1.1.3
server# ./configure --disable-shared
server# make
server# make test
server# make install
安装perl-5.6.1
server# tar zxvf perl-5.6.1.tar.gz
server# cd perl-5.6.1
server# sh Configure -de
server# make
server# make test
server# make install
安装zlib-1.1.4
server# tar zxvf zlib-1.1.4.tar.gz
server# cd zlib-1.1.4
server# ./configure
server# make test
server# make install
安装libpng-1.2.5 (need zlib-1.1.4、png)
server# pkg_add png-version
server# tar zxvf libpng-1.2.5.tar.gz
server# cd libpng-1.2.5
server# cp scripts/makefile.freebsd makefile
server# make
server# make test
server# make install
安装apache_1.3.27 + mod_ssl-2.8.12-1.3.27 (need OpenSSL、MM、Prel_5.6.0) + mod_perl-1.0-current
1、解压缩包(以下文件解压在同一个目录下)
server# tar zxvf apache_1.3.27.tar.gz
server# tar zxvf mod_ssl-2.8.12-1.3.27.tar.gz
server# tar zxvf mod_perl-1.0-current.tar
2、配置mod_ssl-2.8.12-1.3.27
server# cd mod_ssl-2.8.12-1.3.27
server# ./configure --with-apache=../apache_1.3.27 \
--with-mm=../mm-1.1.3 \
--prefix=/usr/local/apache \
--enable-shared=ssl
server# cd ..
3、配置安装mod_perl-1.27
server# cd mod_perl-1.27
server# perl Makefile.PL EVERYTHING=1 APACHE_SRC=../apache_1.3.27/src USE_APACI=1 PREP_HTTPD=1 DO_HTTPD=1 (Freebsd 4.7下有两处错误提示,忽略)
server# make
server# make install
server# cd ..
4、配置安装apache_1.3.27
server# cd apache_1.3.27
server# ./configure --prefix=/usr/local/apache \
--enable-module=ssl \
--activate-module=src/modules/perl/libperl.a \
--enable-module=most \
--enable-shared=max
server# make
server# make certificate(生成证书,按提示选择,并记下密码)
server# make install
安装mod_gzip-1.3.26
server# tar zxvf mod_gzip-1.3.26.1a.tar.gz
server# cd mod_gzip-1.3.26.1a
server# edit Makefile(将APXS的路径 APXS?=/usr/local/sbin/apxs 改成apache安装路径: APXS?=/usr/local/apache/bin/apxs)
server# make
server# make install
安装mod_fastcgi-2.4.0
server# tar zxvf mod_fastcgi-2.4.0.tar.gz
server# cd mod_fastcgi-2.4.0
server# /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
server# /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
安装php-4.3.1 (need gettext、freetype、jpeg、gd、gd2、png、这里假设mysql已经安装并运行)
server# pkg_add gettest-version
server# pkg_add jpeg-version
server# pkg_add gd-version
server# pkg_add gd2-version
server# tar zxvf php-4.3.1.tar.gz
server# cd php-4.3.1
server# ./configure --with-apxs=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/apache/conf \
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/--enable-versioning \
--enable-ftp --enable-bcmath --disable-debug --enable-memory-limit=yes \
--enable-track-vars --enable-sysvsem --enable-sysvshm --with-gettext \
--enable-trans-sid --enable-fastcgi --with-tsrm-pth=pth-config \
--with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-gd=/usr/local \
--enable-gd-native-ttf --with-png-dir=/usr/local --with-zlib=/usr/local \
--with-zlib-dir=/usr/local --with-mm=/usr/local --with-openssl --with-iconv
server# make
server# make install
server# cp php.ini-dist /usr/local/apache/conf/php.ini
配置apache是其支持php,及php.ini文件:
在/use/local/apache/conf下有这两个文件:
  1、/usr/local/apache/conf/httpd.conf 示例:httpd.conf
  2、/usr/local/apache/conf/php.ini 示例:php.ini
在httpd.conf中添加:
  AddType application/x-httpd-php .php .php3
  AddType application/x-httpd-php-source .phps
配置php.ini:
   upload_tmp_dir /tmp
   default_charset gb2312
   register_globals On 
安装至此完成,可以使用如下命令启动apache:
server# /usr/local/apache/bin/apachectl start
如果要使用https则使用如下命令启动:
server# /usr/local/apache/bin/apachectl startssl
(键入证书密码,然后回车)
编写apache的自启动文件(Freebsd下):
server# edit /usr/local/etc/rc.d/apache-server.sh 示例:apache-server.sh
server# chmod 755 apache-server.sh
重新启动服务器,Bind9就可以自动运行!
测试服务器:
在/usr/local/apache/htdocs下编辑test.php来测试php是否安装成功 示例:test.php
phpinfo()
?>
在浏览器中的地址栏中输入:即可以显示php的安装信息。
如果你使用的是apachects startssl命令启动的话,你可以
在浏览器中的地址栏中输入:来显示php的安装信息。



Linux下安装最新Apache2.0.52+PHP5+GD2+MySQL等

由于gd2才开始支持真彩图片的创建,所以,,升级服务器,因为原来的安装都是默认的系统安装,也更因为是个菜鸟,所以,安装很困难,起初根据网上一些文章在我的red hat A 3 上安装测试,不过,测试了安装php4.3.X 和php5.0.X都没有成功,最后,根据其他人的文章,自己搞了将近3天,终于安装上了,下面就我安装中出现的错误和过程写出来和大家分享,以免有像我一样的菜鸟们走弯路! (我可是两天多的时间,安装php的次数不下50次得来的经验,希望大家多多支持,有错误当然欢迎给我指正!转载请注明来自中国智慧在线(http: //article.21e.cn ,谢谢!),以下经过测试在red hat 9 和red hat A 3上通过!

如果你机器里原来装有了PHP或者APACHE的RPM或者低版本.你可以现删除,删除安装简洁一些,不过我的实际操作过程是煤油删除,而直接安装的.当然你也可以跟我一样!
首先,服务器GCC要有,不然什么都不能做.可以用gcc -v来查看是否安装了GCC,

#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)

有以上类似信息说明已有GCC,没有就现安装吧,至于如何安装,我就不说了,可以用光盘安装或者是下载源文件都可以,当然你的版本不一定是3.2.3!

请下载以下所有的东西:

httpd-2.0.X.tar.gz 版本最好是下载最新的啦,下载地址:
MySQL-client-4.0.20-0.i386.rpm
MySQL-server-4.0.20-0.i386.rpm(如果你打算升级mysql的话请下载,下载地址:http: // 当然也是下载最新的版本最好了,由于我不打算安装mysql,就省略了,安装的时候的步骤也是先安装mysql!)
php-5.0.X.tar.gz 下载地址:
ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
zend的最新版安装是好像有点问题,就下载这个版本就可以,zend用来加速php,你可以选择不安装!下载地址:http: //
gd-2.0.28.tar.gz 这个软件的下载地址,php推荐的是: 但是由于某些原因,开发者不支持gif图像的创建,这有点不太方便,所以,我下载了个支持gif图像的,也就是打了gif补丁的:http: //
libxml2-2.X.X.tar.gz 下载地址:
zlib-1.X.X.tar.gz 忘记了,自己找一下吧
jpegsrc.v6b.tar.gz 下载地址:
libpng-1.2.5.tar.gz 下载地址:
freetype2-X.X.tar.gz 下载地址:

xpm-3.4k-2.i386.rpm 忘记了,自己找一下吧

以上都是我下载的官方地址,软件的版本中的X,你自己看看你想用哪个版,不过最好是用最新稳定版本的!如果你以前安装过上述软件的其他版本,你也可以选择不安装!

安装MYSQL 服务器:
#rpm -ivh MySQL-server-4.0.20-0.i386.rpm
#rpm -ivh MySQL-client-4.0.20-0.i386.rpm
安装好后试试能不能用
#mysql 如果设置了密码后测试方法是(mysql -u root -proot -h localhost 注意的是-p后煤没有空格,直接跟密码)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27651 to server version: 4.0.20-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

说明可以了!
请自己改mysql的密码,方法不说了!

安装XPM

#rpm -ivhxpm-3.4k-2.i386.rpm

安装libxml
# tar -zxf libxml2-2.6.16.tar.gz
# cd libxml2-2.6.16
# ./configure (xml默认安装就可以,不要指定路径了,因为安装时php可能找不到它,PHP5只支持libxml2-2.5.10以上版本)
# make
# make install

安装zlib
# tar -zxf zlib-1.2.2.tar.gz
# cd zlib-1.2
# ./configure --prefix=/usr/local/zlib2 (注意,如果您以前没有安装zlib,可以不指定路径,我是没有删除以前的低版本才指定的!以下雷同!)
# make
# make install

安装jpeg
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b/
# ./configure --prefix=/usr/local/jpeg6
# make
# make install-lib
如果你选择默认安装,可能很顺利,指定路径后,请先创建以下文件夹
错误提示:...... /usr/bin/install -c -m 644 jconfig.h /usr/local/jpeg6/include/jconfig.h
/usr/bin/install: 无法创建一般文件‘/usr/local/jpeg6/include/jconfig.h’: 没有那个文件或目录
make: *** [install-headers] Error 1
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/lib
# make install-lib
# make install

安装时如果错误提示:
/usr/bin/install: 无法创建一般文件‘/usr/local/jpeg6/lib/libjpeg.a’: 没有那个文件或目录
make: *** [install-lib] Error 1
创建如下文件夹:
# mkdir /usr/local/jpeg6/lib
# make install
/usr/bin/install -c cjpeg /usr/local/jpeg6/bin/cjpeg
/usr/bin/install: 无法创建一般文件‘/usr/local/jpeg6/bin/cjpeg’: 没有那个文件或目录
make: *** [install] Error 1
# mkdir /usr/local/jpeg6/bin
/usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/jpeg6/man/man1/cjpeg.1
/usr/bin/install: 无法创建一般文件‘/usr/local/jpeg6/man/man1/cjpeg.1’: 没有那个文件或目录
make: *** [install] Error 1
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# make install
好了,直到安装成功!

安装libpng:
# tar -zxf libpng-1.2.7-config.tar.gz
# cd libpng-1.2.7-config
# ./configure --prefix=/usr/local/libpng2
# make
# make install

安装freetype:
# tar -zxf freetype-2.1.9.tar.gz
# cd freetype-2.1.9
# ./configure --prefix=/usr/local/freetype2
# make
# make install

安装gd库:
# tar -zxf gd-2.0.26gif.tar.gz
# cd gd-2.0.26gif
# ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib2/ --with-png=/usr/local/libpng2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype2/ (请指定及格插件的安装路径,否则安装php的时候可能出错!)
# make
# make install

安装apache,(php5安装环境需要apache2.0.46以上版本,下载的时候注意!)
#tar zxvf httpd-2.0.50.tar.gz
#cd httpd-2.0.50
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install

安装php5:
# tar -zxf php5-200411260130.tar.gz
# cd php5-200411260130
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng2/ --with-gd=/usr/local/gd2/ --with-freetype-dir=/usr/local/freetype2/ --enable-trace-vars --with-zlib-dir=/usr/local/zlib2/ -with-mysql=/var/lib/mysql
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
安装libxml的时候如果指定了路径,make的时候可能出错,所以,我安装的时候没指定!
我MAKE PHP4.3.8 和5的时候都遇到:
ext/gd/gd.lo(.text+0x63a): In function `zm_deactivate_gd':
/root/software/php-4.3.8/ext/gd/gd.c:385: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php]Error 1
另外还有一个错误可能是什么: libphp.lo的错误(错误当时没有纪录,忘记了,大概是!)
是因为GD库的freetype没装,或者是安装gd库的时候煤油指定插件的路径!!

复制PHP.INI文件到正确位置
在PHP目录下运行
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
1 #AddType application/x-tar .tgz 下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
如果你搜索其它地方没有以下这行
LoadModule php5_module modules/libphp5.so
请把上面的#号去掉
2 找到 DirectoryIndex index.html index.html.var
在后面加 index.php 让它把index.php做为默认页
3 找到 # don't use Group #-1 on these systems!
把下面的用户名和组改为
User apache
Group apache
(原来好像是nobody)
4 #ServerName 把#去掉,后面的IP改成你的IP.
5 找到 DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径
6 为了让中文网页没乱码 找到
AddDefaultCharset iso8859-1
把后面的iso8859-1改为gb2312 或者是干脆off
其他的选项就自己修改吧!或者到 有一个专门的httpd.conf的说明!
保存httpd.conf文件.
启动apache
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下.访问就应该可以看到php的版本等信息了!
如无意外.PHP脚本已经可以连接mysql了.
用ZendOptimizer加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
安装的时候注意输入正确的安装apache的路径等内容!
安装完毕,再看看phpinfo页面的zend选项就发现了!!
如果你以前的apache没有删除,而你又想使用
# /etc/init.d/httpd restart
这样重起apache的话,那就修改/etc/init.d/httpd这个文件,修改其中的apahce的三个路径就可以了!!
apache+php+mysql+gd.......了,恭喜!!




Unix 服务器的安装与配置 (FreeBSD) 之Apache的完全安装(apache+php4+mod_ssl+mod_perl+mod_fastcgi+mod_gzip)

本文主要讨论源代码方式的安装。  

  从互联网下载以下几个程序(本文采用DSO方式安装),按如下步骤进行处理:
1、apache_1.3.27.tar.gz
2、mod_ssl-2.8.12-1.3.27.tar.gz
3、mod_perl-1.0-current.tar
4、mod_gzip-1.3.26.1a.tar.gz
5、mod_fastcgi-2.4.0.tar.gz
6、php-4.3.1.tar.gz
(另需安装pth-1.4.1.tar.gz、mm-1.1.3.tar.gz、perl-5.6.1.tar.gz、zlib-1.1.4.tar.gz、libpng-1.2.5.tar.gz、png、gettext、freetype、jpeg、gd、gd2)

安装pth-1.4.1
server# tar zxvf pth-1.4.1.tar.gz
server# cd pth-1.4.1
server# ./configure --enable-pthread
server# make
server# make test
server# make install

安装mm-1.1.3
server# tar zxvf mm-1.1.3.tar.gz
server# cd mm-1.1.3
server# ./configure --disable-shared
server# make
server# make test
server# make install

安装perl-5.6.1
server# tar zxvf perl-5.6.1.tar.gz
server# cd perl-5.6.1
server# sh Configure -de
server# make
server# make test
server# make install
安装zlib-1.1.4
server# tar zxvf zlib-1.1.4.tar.gz
server# cd zlib-1.1.4
server# ./configure
server# make test
server# make install
安装libpng-1.2.5 (need zlib-1.1.4、png)
server# pkg_add png-version
server# tar zxvf libpng-1.2.5.tar.gz
server# cd libpng-1.2.5
server# cp scripts/makefile.freebsd makefile
server# make
server# make test
server# make install
安装apache_1.3.27 + mod_ssl-2.8.12-1.3.27 (need OpenSSL、MM、Prel_5.6.0) + mod_perl-1.0-current
1、解压缩包(以下文件解压在同一个目录下)
server# tar zxvf apache_1.3.27.tar.gz
server# tar zxvf mod_ssl-2.8.12-1.3.27.tar.gz
server# tar zxvf mod_perl-1.0-current.tar
2、配置mod_ssl-2.8.12-1.3.27
server# cd mod_ssl-2.8.12-1.3.27
server# ./configure --with-apache=../apache_1.3.27 \
--with-mm=../mm-1.1.3 \
--prefix=/usr/local/apache \
--enable-shared=ssl
server# cd ..
3、配置安装mod_perl-1.27
server# cd mod_perl-1.27
server# perl Makefile.PL EVERYTHING=1 APACHE_SRC=../apache_1.3.27/src USE_APACI=1 PREP_HTTPD=1 DO_HTTPD=1 (Freebsd 4.7下有两处错误提示,忽略)
server# make
server# make install
server# cd ..
4、配置安装apache_1.3.27
server# cd apache_1.3.27
server# ./configure --prefix=/usr/local/apache \
--enable-module=ssl \
--activate-module=src/modules/perl/libperl.a \
--enable-module=most \
--enable-shared=max
server# make
server# make certificate(生成证书,按提示选择,并记下密码)
server# make install
安装mod_gzip-1.3.26
server# tar zxvf mod_gzip-1.3.26.1a.tar.gz
server# cd mod_gzip-1.3.26.1a
server# edit Makefile(将APXS的路径 APXS?=/usr/local/sbin/apxs 改成apache安装路径: APXS?=/usr/local/apache/bin/apxs)
server# make
server# make install
安装mod_fastcgi-2.4.0
server# tar zxvf mod_fastcgi-2.4.0.tar.gz
server# cd mod_fastcgi-2.4.0
server# /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
server# /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so
安装php-4.3.1 (need gettext、freetype、jpeg、gd、gd2、png、这里假设mysql已经安装并运行)
server# pkg_add gettest-version
server# pkg_add jpeg-version
server# pkg_add gd-version
server# pkg_add gd2-version
server# tar zxvf php-4.3.1.tar.gz
server# cd php-4.3.1
server# ./configure --with-apxs=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/apache/conf \
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/--enable-versioning \
--enable-ftp --enable-bcmath --disable-debug --enable-memory-limit=yes \
--enable-track-vars --enable-sysvsem --enable-sysvshm --with-gettext \
--enable-trans-sid --enable-fastcgi --with-tsrm-pth=pth-config \
--with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-gd=/usr/local \
--enable-gd-native-ttf --with-png-dir=/usr/local --with-zlib=/usr/local \
--with-zlib-dir=/usr/local --with-mm=/usr/local --with-openssl --with-iconv
server# make
server# make install
server# cp php.ini-dist /usr/local/apache/conf/php.ini
配置apache是其支持php,及php.ini文件:
在/use/local/apache/conf下有这两个文件:
  1、/usr/local/apache/conf/httpd.conf 示例:httpd.conf
  2、/usr/local/apache/conf/php.ini 示例:php.ini
在httpd.conf中添加:
  AddType application/x-httpd-php .php .php3
  AddType application/x-httpd-php-source .phps
配置php.ini:
   upload_tmp_dir /tmp
   default_charset gb2312
   register_globals On 
  安装至此完成,可以使用如下命令启动apache:
server# /usr/local/apache/bin/apachectl start
如果要使用https则使用如下命令启动:
server# /usr/local/apache/bin/apachectl startssl
(键入证书密码,然后回车)
编写apache的自启动文件(Freebsd下):
server# edit /usr/local/etc/rc.d/apache-server.sh 示例:apache-server.sh
server# chmod 755 apache-server.sh
重新启动服务器,Bind9就可以自动运行!
测试服务器:
在/usr/local/apache/htdocs下编辑test.php来测试php是否安装成功 示例:test.php
phpinfo()
?>
在浏览器中的地址栏中输入:即可以显示php的安装信息。
如果你使用的是apachects startssl命令启动的话,你可以
在浏览器中的地址栏中输入:来显示php的安装信息。

http://sery.blog.51cto.com/10037/5564
作者:田逸()
apache服务器的最新稳定发布版本是httpd-2.2..0,官方下载地址是:。我们通过下面的步骤来快速的
搭建一个web服务器。
1、 下载源码文件httpd-2.2.0.tar.gz 到linux服务器的某个目录。
2、 解压文件 # tar zxvf httpd-2.2.0.tar.gz .
3、 配置 # ./c ╟refix=/usr/local/apache //指定安装目录,以后要删除安装就只需删除这个目录。
4、 编译和安装。 # make ; make install .
5、 编写启动脚本,把它放到目录 /etc/rc.d/init.d/里,这里取名为httpd,其内容如下:
#!/bin/bash
#descripti server
#chkc 235 98 98
case "$1" in
start)
echo "starting apache daemon..."
/usr/local/apache2/bin/apachectl -k start
;;
stop)
echo "stopping apache daemon..."
/usr/local/apache2/bin/apachectl -k stop
;;
restart)
echo "restarting apache daemon..."
/usr/local/apache2/bin/apachectl -k restart
;;
status)
statusproc /usr/local/apache2/bin/httpd
;;
*)
echo "usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
注意:#descripti server 这一行必须加上,否则在执行命令 # chkc ╟add httpd 时会出现“service apache does not support chkc 2345
98 98 表示在执行命令 # chkc ╟add httpd 时会在目录 /etc/rc2.d/ 、/etc/rc3.d/ /etc/rc5.d 分别生成文件 s98httpd和 k98httpd。这
个数字可以是别的。
6、 执行命令 # chkc ╟add httpd ,进入目录/etc/rc3.d/检查是否生成文件 s98httpd及k98httpd.
7、 启动服务 # service httpd start .

 

 

前提: raid5;新建用户并加入root组:useradd -g root luoin(以后的程序都由此用户安装)

安装MYSQL5.0 MAX(编译好的MSQL

安装前的准备工作

1 关闭SELinux,重启系统;

/etc/selinux/config文件中把SELINUX=enforcing 改为:SELINUX=disabled

保存重起系统。(安装MySQL后再改回来)
2
我们用的源代码编译安装方式,所以要确认一下系统是否安装了gcc:  gcc –v

开始安装

1 建立用户和组
# groupadd mysql
# useradd -g mysql -d /usr/local/mysql/data -M mysql
2
配制:
./configure
3
改变所有者(设置data的属主为
mysql)
[root@localhost mysql]#chown -R mysql.mysql data
如果还不行加权限
:       #chmod -R 755 data
4 mysql
的启动
:
[root@localhost support-files]#./mysql.server start
5 mysql
的自动启动

复制文件mysql.server并重命名为mysqld
cp /usr/local/mysql/support-files/mysql.server  /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
cp usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
6
进入数据库

#/usr/local/mysql/bin
#./mysql -uroot -p
7.
为了在任何目录下键入 mysql 都能进入数据库,需要将 /usr/local/bin/mysql 移入 /usr/bin /usr/sbin 这两个目录下
#cp /usr/local/bin/mysql  /usr/bin
#cp /usr/local/bin/mysql  /usr/sbin
mysql
安装完成

8
修改root的密码:
[root@localhost mysql]#bin/mysqladmin -uroot password 123456              (
刚安装好MYSQL后修改的密码 )

                   #bin/mysqladmin –uroot –p 123456 password luoinadmin (再次修改密码)

备份数据库:
[root@localhost mysql]# /usr/local/mysql/bin/mysqldump -uroot -p 123456 
数据库名> /root/luoin.sql
导入数据库:

[root@localhost mysql]#/usr/local/mysql/bin/mysqldump -uroot -p 123456 
数据库名< /home/luoin.sql
注意:<  导入。 > 导出。

创建一个论谈用户(grant 权限 on 数据库名,表名 to 用户名@local indentified by ‘密码’)

#grant select,inster,del,updata on luoin,* to luoin@local indentified by ‘adminluoin’

MySQL集群和同步

这篇文档旨在介绍如何安装配置基于2台服务器的MySQL集群。并且实现任意一台服务器出现问题或宕机时MySQL依然能够继续运行。
注意!

虽然这是基于2台服务器的MySQL集群,但也必须有额外的第三台服务器作为管理节点,但这台服务器可以在集群启动完成后关闭。同时需要注意的是并不推荐在集群启动完成后关闭作为管理节点的服务器。尽管理论上可以建立基于只有2台服务器的MySQL集群,但是这样的架构,一旦一台服务器宕机之后集群就无法继续正常工作了,这样也就失去了集群的意义了。出于这个原因,就需要有第三台服务器作为管理节点运行。

另外,可能很多朋友都没有3台服务器的实际环境,可以考虑在VMWare或其他虚拟机中进行实验。

下面假设这3台服务的情况:

Server1: mysql1.vmtest.net 192.168.0.1
Server2: mysql2.vmtest.net 192.168.0.2
Server3: mysql3.vmtest.net 192.168.0.3
Servers1
Server2作为实际配置MySQL集群的服务器。对于作为管理节点的Server3则要求较低,只需对Server3的系统进行很小的调整并且无需安装MySQLServer3可以使用一台配置较低的计算机并且可以在Server3同时运行其他服务。

二、在Server1Server2上安装
MySQL
上下载
mysql-max-5.0.27-linux-i686.tar.gz
注意:必须是max版本的MySQLStandard版本不支持集群部署!

以下步骤需要在Server1Server2上各做一次
# mv mysql-max-5.0.27-linux-i686.tar.gz /usr/local/
# cd /usr/local/
# groupadd mysql
# useradd -g mysql mysql
# tar -zxvf mysql-max-5.0.27-linux-i686.tar.gz
# mv mysql-max-5.0.27-linux-i686 mysql
# cd mysql
# scripts/mysql_install_db --user=mysql
# chown -R root .                         
# chown -R mysql data                               改变文件拥有者
# chgrp -R mysql .                                     改变档案群组 
# cp support-files/mysql.server    /etc/rc.d/init.d/mysqld
# chmod +x /etc/rc.d/init.d/mysqld
# cp support-files/my-large.      cnf /etc/my.cnf
# chkconfig --add mysqld
此时不要启动MySQL

三、安装并配置管理节点服务器
(Server3)
作为管理节点服务器,Server3需要ndb_mgmndb_mgmd两个文件:

上下载
mysql-max-5.0.27-linux-i686.tar.gz
# mkdir /usr/src/mysql-mgm
# cd /usr/src/mysql-mgm
# tar -zxvf mysql-max-5.0.27-linux-i686.tar.gz
# cd mysql-max-5.0.27-linux-i686
# mv bin/ndb_mgm .
# mv bin/ndb_mgmd .
# chmod +x ndb_mg*
# mv ndb_mg* /usr/bin/
# cd
# rm -rf /usr/src/mysql-mgm
现在开始为这台管理节点服务器建立配置文件:
# mkdir /var/lib/mysql-cluster
# cd /var/lib/mysql-cluster
# vi config.ini
config.ini中添加如下内容:

[NDBD DEFAULT]
NoOfReplicas=2
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
# Managment Server
[NDB_MGMD]
HostName=192.168.0.3 #
管理节点服务器Server3IP地址

# Storage Engines
[NDBD]
HostName=192.168.0.1 #MySQL
集群Server1IP地址
DataDir= /var/lib/mysql-cluster
[NDBD]
HostName=192.168.0.2 #MySQL
集群Server2IP地址

DataDir=/var/lib/mysql-cluster
#
以下2[MYSQLD]可以填写Server1Server2的主机名。

#
但为了能够更快的更换集群中的服务器,推荐留空,否则更换服务器后必须对这个配置进行更改。

[MYSQLD]
[MYSQLD]
保存退出后,启动管理节点服务器Server3

# ndb_mgmd
启动管理节点后应该注意,这只是管理节点服务,并不是管理终端。因而你看不到任何关于启动后的输出信息。

四、配置集群服务器并启动
MySQL
Server1Server2中都需要进行如下改动:

# vi /etc/my.cnf
[mysqld]
ndbcluster
ndb-connectstring=192.168.0.3 #Server3
IP地址

[mysql_cluster]
ndb-connectstring=192.168.0.3 #Server3
IP地址

保存退出后,建立数据目录并启动MySQL

# mkdir /var/lib/mysql-cluster
# cd /var/lib/mysql-cluster
# /usr/local/mysql/bin/ndbd --initial -f /var/lib/mysql-cluster/config.ini
# /etc/rc.d/init.d/mysqld start
可以把/usr/local/mysql/bin/ndbd加到/etc/rc.local中实现开机启动。

注意:只有在第一次启动ndbd时或者对Server3config.ini进行改动后才需要使用--initial参数!

五、检查工作状态

回到管理节点服务器Server3上,并启动管理终端:

# /usr/bin/ndb_mgm
键入show命令查看当前工作状态:(下面是一个状态输出示例)

[root@mysql3 root]# /usr/bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.1 (Version: 4.1.9, Nodegroup: 0, Master)
id=3 @192.168.0.2 (Version: 4.1.9, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.3 (Version: 4.1.9)
[mysqld(API)] 2 node(s)
id=4 (Version: 4.1.9)
id=5 (Version: 4.1.9)
ndb_mgm>
如果上面没有问题,现在开始测试MySQL

注意,这篇文档对于MySQL并没有设置root密码,推荐你自己设置Server1Server2MySQL root密码。

Server1中:
# /usr/local/mysql/bin/mysql -u root -p
> use test;
> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;
> INSERT INTO ctest () valueS (1);
> SELECT * FROM ctest;
应该可以看到1 row returned信息(返回数值1)。

如果上述正常,则换到Server2上重复上面的测试,观察效果。如果成功,则在Server2中执行INSERT再换回到Server1观察是否工作正常。

如果都没有问题,那么恭喜成功!

六、破坏性测试

Server1Server2的网线拔掉,观察另外一台集群服务器工作是否正常(可以使用SELECT查询测试)。测试完毕后,重新插入网线即可。

如果你接触不到物理服务器,也就是说不能拔掉网线,那也可以这样测试:

Server1Server2上:

# ps aux | grep ndbd
将会看到所有ndbd进程信息:

root 5578 0.0 0.3 6220 1964 ? S 03:14 0:00 ndbd
root 5579 0.0 20.4 492072 102828 ? R 03:14 0:04 ndbd
root 23532 0.0 0.1 3680 684 pts/1 S 07:59 0:00 grep ndbd
然后杀掉一个ndbd进程以达到破坏MySQL集群服务器的目的:

# kill -9 5578 5579
之后在另一台集群服务器上使用SELECT查询测试。并且在管理节点服务器的管理终端中执行show命令会看到被破坏的那台服务器的状态。

测试完成后,只需要重新启动被破坏服务器的ndbd进程即可:

# ndbd
注意!前面说过了,此时是不用加--inital参数的!

阅读(4354) | 评论(0) | 转发(0) |
0

上一篇:linux base

下一篇:服务器架构

给主人留下些什么吧!~~