LAMP配置笔记

所需软件包

[root@rhel63 1]# ls
autoconf-2.61.tar.gz    libxml2-2.6.30.tar.gz
freetype-2.3.5.tar.gz   mysql-5.0.41.tar.gz
gd-2.0.35.tar.gz        ncurses-5.9.tar.gz
httpd-2.2.9.tar.gz      php-5.2.6.tar.gz
jpegsrc.v6b.tar.gz      phpMyAdmin-3.0.0-rc1-all-languages.tar.gz
libmcrypt-2.5.8.tar.gz  ZendOptimizer-3.2.6-linux-glibc21-i386.tar.gz
libpng-1.2.31.tar.gz    zlib-1.2.3.tar.gz
 

卸载已安装的相关软件

ps -le | grep mysql
 

关闭selinux ,iptables
vi /etc/sysconfig/selinux
 
iptables -F
 
tar.sh
 
  解压各软件包
 
cd /lamp
ls *.tar.gz > ls.list
 
for TAR in `cat ls.list`     #注意这里  是``  (一个小点,俗称小句号,上句号 ,键盘 数字键1的左面)                                            #   不是‘’       (单引号)
do
    tar -zxf $TAR
done
 
 
sh -x tar.sh
 
rm -rf /usr/local/libxml2

1.libxml2
2.libmcrypt
  cd libltdl/
  ./configure --enable-ltdl-install
  make && make install
3.zlib
    ./configure  不指定路径

cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.a /usr/local/lib
cd /usr/local/lib; chmod 755 libz.a
cd /usr/local/lib; if test -f libz.so.1.2.3; then \
      rm -f libz.so libz.so.1; \
      ln -s libz.so.1.2.3 libz.so; \
      ln -s libz.so.1.2.3 libz.so.1; \
      (ldconfig || true)  >/dev/null 2>&1; \
    fi
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3

make install >/backup/zlib_20130208.install.log
4.libpng
5.jpeg
    cd jpeg-6b
    mkdir /usr/local/jpeg6/
    mkdir /usr/local/jpeg6/bin
    mkdir /usr/local/jpeg6/lib
    mkdir /usr/local/jpeg6/include
    mkdir -p /usr/local/jpeg6/man/man1/
    ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static

6.freetype
7.autoconf   ./configure && make && make install
8. gd
  ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-freetype=/usr/local/freetype/  (zlib 未配置)

9 apache
 ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support

错误:什么so 无法载入 无权限       selinux 的问题        开启权限 chcon -t texrel_shlib_t /usr/local/apache2/modules/mod_rewrite.so(模块名)

10.  mysql
    先编译ncurses
    cd ../ncurses-5.9
    ./configure --with-shared --without-debug --without-ada --enable-overwrite
    (   extended funcs: yes
     xterm terminfo: xterm-new

      bin directory: /usr/bin
      lib directory: /usr/lib
      include directory: /usr/include
      man directory: /usr/man
       terminfo directory: /usr/share/terminfo
     )
    make && make install
    groupadd mysql
    grep mysql /etc/group  查询是否添加成功
        useradd -g mysql mysql
        grep mysql /etc/passwd

(LOG:
[root@rhel63 ncurses-5.9]# groupadd mysql                                                      
groupadd: group 'mysql' already exists
[root@rhel63 ncurses-5.9]# useradd -g mysql mysql
useradd: user 'mysql' already exists
[root@rhel63 ncurses-5.9]# grep mysql /etc/passwd
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
[root@rhel63 ncurses-5.9]# grep mysql /etc/group
mysql:x:27:

    编译mysql
    ./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
    make && make install
 
    1)拷贝配置文件  cp support-files/my-medium.cnf /etc/my.cnf
    2)数据库授权表的建立  /usr/local/mysql/bin/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:
/usr/local/mysql//bin/mysqladmin -u root password 'new-password'
/usr/local/mysql//bin/mysqladmin -u root -h rhel63.xueyue8.com password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql/ ; /usr/local/mysql//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 /usr/local/mysql//bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
)

    3) 改变安装目录的所有者,所有组
        chown -R mysql /usr/local/mysql
        chgrp -R mysql /usr/local/mysql
        ll /usr/local/mysql/var
        ll /usr/local/mysql

    4) 启动 mysql 
        /usr/local/mysql/bin/mysqld_safe --user=mysql &  
    5) 查看服务是否打开 端口情况
        ps -le | grep mysqld
        netstat -an | grep 3306
        /usr/local/mysql/bin/mysqladmin version     查看版本信息
        /usr/local/mysql/bin/mysqladmin variables   查看参数

    6)mysql 命令行  /usr/local/mysql/bin/mysql

    7)设置root 密码 
        /usr/local/mysql/bin/mysql -u root
        mysql>SET PASSWORD FOR 'root'@'localhost'=PASSWORD('123456');
        带密码登录: /usr/local/mysql/bin/mysql -u root -p

    8设置开机自启动
       
        echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.sysinit   或者
        echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local     或者
        cp /lamp/mysql-5.0.41/support-files/mysql.server /etc/rc.d/init.d/mysqld

    9)
        chown root.root /etc/rc.d/init.d/mysqld
        chown 755 /etc/rc.d/init.d/mysqld       
        ls -l /etc/rc.d/init.d/mysqld
        chkconfig --add mysqld
        chkconfig --list mysqld
        chkconfig --levels 245 mysqld off
        chkconfig --list mysqld


11.php
    ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/user/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       yum install libtool
                                         libltdl.so.3      yum install libtool-ltdl

      必要时重新编译下php                         yum install libtool-ltdl-devel

cp php.ini-dist /usr/local/php/etc/php.ini

vi /etc/httpd/httpd.conf
i
/AddType
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    Addtype application/x-httpd-php .php .phtml   (加上的)

/usr/local/apache2/bin/apachectl restart

vi /usr/local/apache2/htdocs/test.php
<?
    phpinfo();
?>

12.zend加速器
 ./install.sh

13.phpmyadmin
[root@rhel63 lamp]# cp -a phpMyAdmin-3.0.0-rc1-all-languages /usr/local/apache2/htdocs/phpmyadmin
[root@rhel63 lamp]# cd /usr/local/apache2/htdocs/phpmyadmin
[root@rhel63 phpmyadmin]# cp config.sample.inc.php  config.inc.php 
[root@rhel63 phpmyadmin]# vi config.inc.php
auto_Type 改成  http
添加 index.php 直接显示
/usr/local/mysql/bin/mysql -u root -p
 

你可能感兴趣的:(PHP,lamp,rhel6.3)