Chinaunix首页 | 论坛 | 博客
  • 博客访问: 81178
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 157
  • 用 户 组: 普通用户
  • 注册时间: 2013-10-29 13:48
个人简介

学习ING

文章分类

全部博文(19)

文章存档

2014年(2)

2013年(17)

我的朋友

分类: 系统运维

2013-12-11 16:24:37

原文地址:LAMP详细搭建步骤 作者:乡村小农民

*************************** Linux + Apache + PHP + Mysql *************************


----------------- APACHE2.4源码安装方法 ------------------

安装前先安装 apr、apr-util和pcre源码包,否则会提示缺少这几个包,无法进行编译安装
#tar zxvf apr-1.4.6.tar.gz
#cd apr-1.4.6
#./configure --prefix=/usr/local/src/apr
执行到最后提示: rm: cannot remove `libtoolT': No such file or directory
解决方法:
#vim configure
找到:RM='$RM'     把RM='$RM'改为RM='$RM  -f'  重新执行 ./configure --prefix=/usr/local/src/apr

#make
#make install

#tar zxvf par-util-1.5.2.tar.gz
#cd apr-util-1.5.2
#./configure --prefix=/usr/local/src/apr-util --with-apr=/usr/local/src/apr/bin/apr-1-config
#make
#make install

#tar zxvf pcre-8.32.tar.gz 
#cd pcre-8.32
#./configure --prefix=/usr/local/src/pcre
#make
#make install

安装apache
#tar zxvf httpd-2.4.7.tar.gz
#cd httpd-2.4.7
#./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/lib/openssl --with-apr=/usr/local/src/apr --with-apr-util=/usr/local/src/apr-util --with-pcre=/usr/local/src/pcre
#make
#make install
启动apache

#/usr/local/apache/bin/apachectl


--------------------------- MYSQL5.5源码安装方法 -----------------------------
安装步骤

# groupadd mysql
# useradd -g mysql mysql
#cd /usr/local
#tar zxvf mysql-5.5.30-linux2.6-i686.tar.gz          直接按常规解压
# ln -s mysql-5.5.30-linux2.6-i686 mysql
#cd mysql
# scripts/mysql_install_db --user=mysql
# chown -R root .
#chown -R mysql data
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
#su - mysql
-bash-4.1$ cd /usr/local/mysql/

-bash-4.1$ scripts/mysql_install_db --user=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 lixuan 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!

复制启动文件和配置文件
[mysql@localhost root]$ su - root
Password:
[root@localhost ~]#cd  /usr/local/mysql/
[root@localhost mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql]# cp /usr/local/mysql/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf


#/etc/init.d/mysqld start
#service mysqld restart
#chkconfig mysqld on


#mysqladmin -u root password 'lixuan'

#ln -s /usr/local/mysql/bin/mysql /usr/bin/ ------------------自己添加

登录mysql验证
#mysql -uroot -plixuan

mysql>


----------------------------- PHP5.5安装方法 -----------------------------


在安装php之前,先要安装gd库,以让php支持gif,jepg,png等

# rpm -qa | grep jpeg
libjpeg-6b-37
libjpeg-devel-6b-37

# rpm -qa | grep libpng
libpng-devel-1.2.10-7.1.el5_0.1
libpng-1.2.10-7.1.el5_0.1

# rpm -qa | grep freetype
freetype-devel-2.2.1-20.el5_2
freetype-2.2.1-20.el5_2

# rpm -qa | grep zlib
zlib-devel-1.2.3-3
zlib-1.2.3-3

# rpm -qa | grep gd
gd-2.0.33-9.4.el5_1.1
gdb-6.8-27.el5
sysklogd-1.4.1-44.el5
gd-devel-2.0.33-9.4.el5_1.1
gdbm-1.8.0-26.2.1
gdm-2.16.0-46.el5
gdbm-devel-1.8.0-26.2.1

# rpm -qa | grep curl
curl-devel-7.15.5-2.el5
curl-7.15.5-2.el5

正式安装PHP

#安装libmcrypt.2.5.8.tar.gz    -------如果不安装会提示报错,必须安装
#tar zxvf libmcrypt.2.5.8.tar.gz
#cd libmcrypt.2.5.8
#./configure --prefix=/usr/local/libmcrypt
#make
#make install

# tar zxvf php-5.5.6.tar.gz
# cd php-5.5.6
# ./configure --prefix=/usr/local/src/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-config-file-path=/usr/local/src/php --enable-sockets --with-mcrypt=/usr/local/src/libmcrypt  --with-xpm-dir=/usr/lib64/ --with-ssl=/usr/lib64/openssl --with-iconv  --enable-fpm --with-gd
#make
#make install

配置apache与php结合

#vim /usr/local/apache/conf/httpd.conf

找到 AddType application/x-gzip .gz .tgz在其下面添加一行

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

 
找到  DirectoryIndex index.html修改为:

DirectoryIndex index.html default.php index.php


验证apache与php结合成功

新建下面文件
# cat /usr/local/apache/htdocs/test.php


重启apache
# /usr/local/apache/bin/apachectl restart

在浏览器中输入:

阅读(1568) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~