mysql-5.5.15-linux2.6-i686.tar.gz //为绿色软件
php-5.3.7.tar.bz2
httpd-2.2.19.tar.bz2
安装gcc glib 包含着开发工具中
Development Tools --开发工具
Legacy Software Development -- 传统软件开发工具
Development Libraries –开发工具库
Java development –源代码基于java
如果是图形的软件包
Kde环境需要安装:
Kde software developmen
t Gnome环境需要安装:
Gnome software development
X software development
删除已经安装过的包及安装产生的文件
1扩展的查询
rpm -qa |grep -E "http|php|mysql" –查看包是否已经安装
--源码安装需要卸载,安装全新的
# yum remove httpd
# yum remove mysql # yum remove php-common-5.1.6-23.el5
2删除已安装产生的配置文件
cd /etc/httpd
rm -fr *
额外被安装的软件一般都安装到/usr/local目录下
额外被安装的源代码一般都安装在/usr/local/src and /usr/src mysql源码安装过程
[root@localhost ~]# tar zxvf mysql-5.5.15-linux2.6-i686.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ln -s mysql-5.5.15-linux2.6-i686/ mysql //做链接
[root@localhost local]# cd mysql
[root@localhost mysql]# less INSTALL-BINARY //查看安装信息
安装步骤
sequence looks like this:
shell> groupadd mysql //建立用户组
shell> useradd -r -g mysql mysql //建立系统账户属于mysql组
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql //上面已经做过
shell> chown -R mysql . //改变所有文件属有者为mysql
shell> chgrp -R mysql . //改变所有文件的属组为mysql
shell> scripts/mysql_install_db --user=mysql //生成初始库
shell> chown -R root . //改回来所有者所属组
shell> chown -R mysql data // 改变data用户
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf //生成配置脚本
shell> bin/mysqld_safe --user=mysql & //以mysql的身份启动mysql
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server //生成服务的启动脚本 [root@localhost mysql]# less INSTALL-BINARY
[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd -r -g mysql mysql
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables... OK
Filling help tables... OK
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql data
[root@localhost mysql]# bin/mysqld_safe --user=mysql &
[root@localhost mysql]# netstat -tupln |grep mysql
tcp 0 0 :::3306 :::* LISTEN 5103/mysqld
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld //生成服务的启动脚本service mysqld start
--chkconfig管理mysqld服务
[root@localhost mysql]# chkconfig --add mysqld
[root@localhost mysql]# vim /etc/init.d/mysqld
# chkconfig: 2345 64 36
--启动优先级序列号是 64 被杀死的号是36
[root@localhost mysql]# chkconfig mysqld on //设置开机启动
[root@localhost mysql]# chkconfig --list mysqld mysqld
0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
更改库文件
标准库文件存放目录
/lib
/usr/lib
/usr/local/lib
库文件存放三个文件里系统会自动找到
[root@localhost mysql]# vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
--定义不标准软件包安装的库文件存放位置
[root@localhost mysql]# cd /etc/ld.so.conf.d/
[root@localhost ld.so.conf.d]# vim mysql.conf //创建新的库文件路径指向文件
/usr/local/mysql/lib
[root@localhost ld.so.conf.d]# ldconfig -v |grep mysql //重新加载库文件--查看能否加载上
/usr/local/mysql/lib:
libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0 //已经加载
更改头文件
-头文件存放位置
/usr/include
/usr/local/include
[root@localhost ld.so.conf.d]# cd /usr/include/
[root@localhost include]# ln -s /usr/local/mysql/include/ mysql //连接到mysql的头文件命名为mysql
[root@localhost ~]# tar -jxvf httpd-2.2.19.tar.bz2 -C /usr/src/
[root@localhost ~]# cd /usr/src/
[root@localhost src]# ll
总计 20
drwxr-xr-x 11 500 mysql 4096 2011-05-21 httpd-2.2.19
drwxr-xr-x 3 root root 4096 2012-08-11 kernels
drwxr-xr-x 7 root root 4096 2012-08-11 redhat
[root@localhost src]# cd httpd-2.2.19/
[root@localhost httpd-2.2.19]# less INSTALL //安装说明文档
http://httpd.apache.org/docs/2.2/install.html
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start //配置步骤
[root@localhost httpd-2.2.19]# ./configure –help //查看帮助文档
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/apache2] //安装的路径
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] //配置脚本存放位置
--enable-so DSO capability //开启DSO (动态共享对象)
--with-z=DIR zlib use a specific zlib library //使用zlib库需要安装 (确保安装了zlib 以及 zlib-devel)
--enable-ssl SSL/TLS support (mod_ssl) //启用加密
[root@localhost httpd-2.2.19]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --with-z --enable-ssl
会检测预编译环境
[root@localhost httpd-2.2.19]# make //编译
[root@localhost httpd-2.2.19]# make install //安装
[root@localhost httpd-2.2.19]# cd /usr/local/apache/ //产生的apache目录
[root@localhost apache]# ./bin/apachectl start //启动apache
[root@localhost apache]# vim /etc/rc.d/rc.local //编写开机脚本
touch /var/lock/subsys/local
/usr/local/apache/bin/apachectl start
[root@localhost ~]# vim /etc/profile //为了启动方便修改环境变量
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
PATH=$PATH:/usr/local/apache/bin //添加的环境变量
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC //在这里边添加环境变量
//要想使生效注销一次在登录就生效了 不用注销的就可以生效的方法是执行下命令
[root@localhost ~]# . /etc/profile
[root@localhost ~]# echo $PATH //查看添加的结果
/usr/local/apache/bin
[root@localhost ~]# apachectl stop //这是在任何位置都可以启动和停止
[root@localhost apache]# cd /usr/include/ //进到标准头文件
[root@localhost include]# ln -s /usr/local/apache/include apache //做一个链接到apache的头文件
[root@localhost include]# cd /etc/ld.so.conf.d/ //链接库文件
[root@localhost ld.so.conf.d]# vim apache.conf /usr/local/apache/lib
[root@localhost ld.so.conf.d]# ldconfig -v |grep apache //重新加载
/usr/local/apache/lib:
[root@localhost ld.so.conf.d]# ldconfig -pv |grep apache //查看是否加载成功
libaprutil-1.so.0 (libc6) => /usr/local/apache/lib/libaprutil-1.so.0
libaprutil-1.so (libc6) => /usr/local/apache/lib/libaprutil-1.so
libapr-1.so.0 (libc6) => /usr/local/apache/lib/libapr-1.so.0
libapr-1.so (libc6) => /usr/local/apache/lib/libapr-1.so
Php的源码安装
php作为apache的模块被调用
[root@localhost ~]# tar -jxvf php-5.3.7.tar.bz2 -C /usr/src/
[root@localhost ~]# cd /usr/src/php-5.3.7/
[root@localhost php-5.3.7]# less INSTALL
Example #1 Installation Instructions (Apache Shared Module Version) for
PHP
1. gunzip apache_xxx.tar.gz
2. tar -xvf apache_xxx.tar
3. gunzip php-xxx.tar.gz
4. tar -xvf php-xxx.tar
5. cd apache_xxx
6. ./configure --prefix=/www --enable-module=so
7. make
8. make install
9. cd ../php-xxx
[root@localhost php-5.3.7]# ./configure -help
--prefix //安装路径
--with-apxs2 //指明apache调用php模块的工具的路径和名称
--enable-mbstring //字符串支持
--with-mysql //指明mysql的路径
--with-mysqli //指明mysql_config的路径名称
[root@localhost php-5.3.7]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring=all
[root@localhost php-5.3.7]# make
[root@localhost php-5.3.7]# make install
[root@localhost php-5.3.7]# vim /etc/httpd/httpd.conf
105 DocumentRoot "/usr/local/apache/htdocs" //网页主页位置
[root@localhost php-5.3.7]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# ll
total 4
-rw-r--r-- 1 root root 44 Nov 21 2004 index.html
[root@localhost htdocs]# vim index.html
<html><body><h1>It works!</h1></body></html>
<?php
phpinfo();
?>
[root@localhost htdocs]# mv index.html index.php
[root@localhost htdocs]# vim /etc/httpd/httpd.conf //配置
167 DirectoryIndex index.php index.html //添加index.php
310 AddType application/x-httpd-php .php //添加 (调用php模块)
[root@localhost htdocs]# apachectl stop
[root@localhost htdocs]# apachectl start
在客户端测试输入http://192.168.145.100
[root@localhost htdocs]# vim index.php //测试mysql能否链接
<?php
$link=mysql_connect('127.0.0.1','root','');
if($link)
echo "ok";
else
echo "failer";
?>
ok说明可以连接上