CentOS:5.5
Apache:2.2.9
PHP:5.2.6
MySQL:5.0.41
条件:
yum install gcc
yum install gcc-c++
vi/etc/yum.repos.d/CentOS-CentOS-Base.repo
rpm -qa |grep mysql 是否安装
ps -le |grep mysql 进程是否启动
yum remove httpd 卸载
不能用rpm查询用源码安装的软件
SELinux
vi /etc/sysconfig/selinux
Netfilter/iptables 防火墙(默认禁用80)
iptables -F 禁用
----------------------------------------------------------------------
指解压
cd /var/soft/lamp
ls *.tar.gz >ls.list
for TAR in `cat ls.list`
do
tar -zxf $TAR
done
----------------------------------------------------------------------
源码安装
1、解压 .tar.gz tar -zxf
2、./configure 配置
3、make 编译
4、make install 安装、拷贝
----------------------------------------------------------------------
安装libxml2
./configure --prefix=/usr/local/libxml2/
make
make install
查看指定的选项
./configure --help | grep zlib
删除源码安装程序
rm -rf /usr/local/安装目录
rm -rf /源码安装包目录
重新安装
----------------------------------------------------------------------
安装libmcrypt
./configure --prefix=/usr/local/libmcrypt/
make
make install
目录下有libltdl库也要安装一下
cd libltdl
./configure --enable-ltdl-install
可以查看
./configure --help |grep libltdl
----------------------------------------------------------------------
安装zlib
./configure 不指定安装目录(指定后无法定位)
卸载不指定安装目录的程序
make install > /bakcup/zlib_20150905.install.log
----------------------------------------------------------------------
安装libpng
./configure --prefix=/usr/local/libpng/
----------------------------------------------------------------------
安装jpeg-6b 要先手动创建所需的目录
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jepg6/include
mkdir -p /usr/local/jepg6/man/man1 同时创建多个目录
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
----------------------------------------------------------------------
安装freetype
./configure --prefix=/usr/local/freetype/
----------------------------------------------------------------------
安装freetype 最好不要指它安装目录(指定后无法定位)
./configure
----------------------------------------------------------------------
安装gd 要用到之前安装的库
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
--enable-m4_pattern_allow
----------------------------------------------------------------------
安装apache 用到之前安装的库
./configure --prefix=/usr/local/apache/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir
--enable-so --enable-deflate=shared --enable-expires-shared --enable-rewrite=shared --enable-static-support
检查进程 ps -le |grep httpd
SELinux问题(权限)
chcon -t texrel_shlib_t filename 即可更改(绝对路径)
----------------------------------------------------------------------
安装mysql
要先安装ncurse
./configure --with-shared --without-debug --without-ada --enable-overwrite
make
make install
---------------------------------------------------------------
groupadd mysql
grep mysql |etc/group
useradd -g mysql mysql
grep mysql /etc/passwd
./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
make
make install
生成配置文件
cp support-files/my-medium.cnf /etc/my.cnf(如有则覆盖)
/usr/local/mysql/bin/mysql_install_db --user=mysql(创建授权表)
chown -R root /usr/local/mysql 更改所属组
chown -R mysql /usr/local/mysql/var 更改所属组
chown -R mysql /usr/local/mysql 更改所属组
chgrp -R mysql /usr/local/mysql 更改所属组
ls -ld /usr/local/mysql 查看权限
/usr/local/mysql/bin/mysqld_safe --user=mysql &
ps -le |grep mysqld 查看进程
netstat -an |grep 3306 查看端口
/usr/local/mysql/bin/mysqladmin version 查看版本
/usr/local/mysql/bin/mysql -u root 登录
SET PASSWORD FOR ‘root‘@‘localhost‘=PASSWORD(‘kening.com‘) 设置密码(单引号)
echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local 写入开机运行(第一种)
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld 写入开机运行(第二种)
chown root.root /etc/rc.d/init.d/mysqld 改变所有者及组
chmod 755 /etc/rc.d/init.d/mysqld 改变权限
ls -l /etc/rc.d/init.d/mysqld 查看权限
chkconfig --add mysqld 添加
chkconfig --list |grep mysqld 查看
chkconfig --levels 245 mysqld off 关闭
----------------------------------------------------------------------
安装php
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-
apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-
jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-
mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-
mbstring=all --enable-sockets
make
make install
可能少libtool-ltdl
yum install libtool-ltdl 安装
cp php.ini-dist /usr/local/php/etc/php.ini
修改
vi /etc/httpd/httpd.conf
添加
Addtype application/x-httpd-php .php .phtml
/usr/local/apache/bin/apachectl start 启动
完成安装
----------------------------------------------------------------------
安装Zend加速器
./install.sh 界面和windows相似
一路同意
/usr/local/php/etc/ 指定php配置文件路径
/usr/local/apache/bin/apachectl 指定启动路径
一路确定
----------------------------------------------------------------------
安装phpmyadmin
cp -R ./phpMyAdmin-3.0.0-rc1-all-languages /usr/local/apache/htdocs/phpMyAdmin
cp config.sample.inc.php config.inc.php
vi config.inc.php
修改 $cfg[‘Servers‘][$i][‘auth_type‘] = ‘http‘;//默认为cookie
lamp环境搞定