一.测试开发环境
[root@localhost ~]# yum grouplist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
rhel-cluster
| 1.3 kB 00:00
rhel-clusterstorage
| 1.3 kB 00:00
rhel-erver
| 1.3 kB 00:00
rhel-vt
| 1.3 kB 00:00
Installed Groups:
Administration Tools
Authoring and Publishing
Development Libraries
Development Tools
Editors
FTP Server
GNOME Desktop Environment
GNOME Software Development
Games and Entertainment
Graphical Internet
Graphics
Legacy Network Server
Legacy Software Development
Legacy Software Support
Mail Server
Network Servers
Office/Productivity
Printing Support
Server Configuration Tools
Sound and Video
System Tools
Text-based Internet
X Software Development
X Window System
Available Groups:
Cluster Storage
Clustering
DNS Name Server
Engineering and Scientific
Java Development
KDE (K Desktop Environment)
KDE Software Development
MySQL Database
News Server
OpenFabrics Enterprise Distribution
PostgreSQL Database
Virtualization
Web Server
Windows File Server
Done
编译环境由以上几个才能编译成功
源代码安装通常状况下的源代码安装的软件都是吧源代码存放在/usr/local/src目录下
源代码安装的内核存放在/usr/src目录下
额外安装的软件(绿色软件)原软件存放在/usr/local/目录下
解压缩
[root@localhost ~]# unzip -zxvf mysql-5.5.15-linux2.6-i686.tar.gz -C /usr/local/
解压缩后查看自带的说明性文档
[root@localhost mysql-5.5.15-linux2.6-i686]# ls
bin
data include lib mysql-test scripts sql-bench
COPYING docs INSTALL-BINARY man README
share support-files
查看INSTALL-BINARY
[root@localhost mysql-5.5.15-linux2.6-i686]# less INSTALL-BINARY
shell> groupadd mysql
shell> useradd -r -g 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 .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
A more detailed version of the preceding description for
二.按照上面的步骤安装mysql
shell> groupadd mysql
(建立组)
shell> useradd -r -g 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 .
(把全部者再改成root)
shell> chown -R mysql data
# Next command is optional
(下面为可选命令)
shell> cp support-files/my-medium.cnf /etc/my.cnf
(能够选择)
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysqld
(之后启动就能够用service启动了)
建立链接库文件
[root@localhost ~]# cd /etc/ld.so.conf.d/
[root@localhost ld.so.conf.d]#
[root@localhost ld.so.conf.d]# vim mysql.conf
1 /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
三.安装apache
1.[root@localhost ~]# tar -jxvf httpd-2.2.19.tar.bz2 -C /usr/local/src
2.[root@localhost httpd-2.2.19]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --with-z
说明:
--prefix //安装路径
--sysconfdir //配置文件位置
--enable-so //造成动态连接库
--enable-ssl //支持
ssl功能
--with-z //确保安装了
zlib
3.[root@localhost httpd-2.2.19]#make //生成文件
4. [root@localhost httpd-2.2.19]#make install //把生成的文件放到相应的位置
[root@localhost ~]# cd /usr/local/apache/bin
[root@localhost bin]# ./apachectl start //执行脚本,启动服务
[root@localhost bin]# netstat -tupln |grep 80
tcp 0 0 :::80 :::* LISTEN 29847/httpd
5.设置成为开机启动
vim /etc/rc.d/rc.local //开机脚本
文件内容加上:
/usr/local/apache/bin/apachectl start
6.库文件
[root@localhost bin]# cd /etc/ld.so.conf.d
[root@localhost ld.so.conf.d]# vim httpd.conf
文件内容:
/usr/local/apache/lib
[root@localhost ld.so.conf.d]# ldconfig -v
[root@localhost ld.so.conf.d]# ldconfig -vp |grep apr
7.头文件
[root@localhost ld.so.conf.d]# cd /usr/include/
[root@localhost include]# ln -s /usr/local/apache/include/ apache
四.安装php
1. [root@localhost ~]# tar -jxvf php-5.3.7.tar.bz2 -C /usr/local/src
[root@localhost ~]# cd /usr/local/src/php-5.3.7/
2.[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
说明:
--with-apxs2=/usr/local/apache/bin/apxs //将php编译成apache的模块,容许apache的apxx调用该模块
--with-mysql=/usr/local/mysql //指明
mysql的安装位置
--with-mysqli=/usr/local/mysql/bin/mysql_config //调用
myql接口
[root@localhost php-5.3.7]# make
[root@localhost php-5.3.7]# make install
3.cd /usr/local/apache/htdocs // apache 站点主目录
vim index.html
mv index.html index.php
vim /etc/httpd/httpd.conf
文件内容加入
:
166 AddType application/x-httpd-php .php //apache //须要加入这句话才能处理
php页面
168 加入
index.php
4./usr/local/apache/bin/apachectl start //启动
apache服务
5./usr/local/mysql/bin/mysql //进入数据库
/usr/local/mysql/bin/mysqladmin –
u root –p password ‘123’ //建立账号