澳门新葡亰娱乐官网最新Linux+Apache+Mysql+PHP安装笔记(转)

下载下列文件至/usr/local/src/ Apache2.tar.gz mysql-5.0.22.tar.gz
php-5.1.2.tar.gz 解压缩: #tar xvzf Apache2.tar.gz #tar xvzf
mysql-5.0.22.tar.gz #tar xvzf php-5.1.2.tar.gz #cd ..
//在/usr/local/目录下成立文件夹 # mkdir apache # mkdir mysql # mkdir
php //Mysql安装进程 #cd ../mysql //找到/usr/local/mysql文件夹
#groupadd mysql #usseradd -g mysql mysql #cd ../mysql-5.0.22
//找到/usr/local/src/mysql-5.0.22文件夹 #./configure
–prefix=/usr/local/mysql –localstatedir=/var/lib/mysql/
–with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static
–with-mysqld-user=mysql –enable-assembler –with-extra-charsets=all
#make ; make install /usr/local/mysql/bin/mysql_install_db
//初叶化mysql //对mysql进行布局 #chown R root /usr/local/mysql #chown
R mysql /var/lib/mysql/ #chgrp R mysql /usr/local/mysql #cp
support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe user=mysql //运行mysql
/usr/local/mysql/bin/mysqladmin u root p password 123 //将密码改为123
enter password: //测量检验一下新密码 /usr/local/mysql/bin/mysql u root p
mysql enter password: //如若顺遂的话就会跻身mysql了. //Apache安装过程./configure –prefix=/usr/local/apache –enable-mods=shared=all
–enable-module=so –disable-info make make install
apache安装进度中,境遇libiconv.so.2的标题,消除措施如下: ln sf
/usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
//在窗口栏中敲入本机IP,如若现身有名的羽毛网页,就算成功了…. //Php安装过程./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql
–with-apxs2=/usr/local/apache/bin/apxs –enable-calendar
–with-openssl=/usr/ –with-config-file-path=/usr/local/php make make
install cp /usr/local/src/php-5.1.2/php.ini-dist /usr/local/lib/php.ini
#cd usr/local/apache/conf //然后打开在对应的地点开展改正 AddType
application/x- .php AddType application/x- .phps DocumentRoot
“/usr/local/apache/htdocs” LoadModule php5_module modules/libphp5.so
//把测量试验的.php文件归入/usr/local/apache/htdocs/,在窗口栏中如能展开页面,则马到成功了
//不以为奇难题1:EOdysseyRO中华V 二〇〇一: Cant connect to local MySQL server through
socket /var/lib/mysql/mysql.sock (2卡塔尔国 //化解方法: 权限难点 chown -PRADO mysql
/var/lib/mysql/ //不以为奇难点2:Warning: MySQL Connection Failed: Cant
connect to local MySQL server // through socket /tmp/mysql.sock (111State of Qatar in
/home/ on line 9 //解决措施: 将/tmp/mysql.sock link 到 /var/lib/mysql
目录里就能够: linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

 一、    安装意况
          1.  
 操作系统:Linux Redhat
AS 5 (安装包定制:开辟全选、服务器一个不选)
          2.    数据库 :  MySQL 5.0.45
          3.    Web服务器:
Apache 2.2.8
          4.    脚本语言:PHP 5.2.6
      二、    筹算软件:
          1.    httpd-2.2.8.tar.gz
          2.    mysql-5.0.45.tar.gz
          3.    freetype-2.3.5.tar.gz
          4.    jpegsrc.v6b.tar.gz
          5.    libpng-1.2.29.tar.gz
          6.    libxml2-2.6.19.tar.gz
          7.    zlib-1.2.3.tar.gz
          8.    gd-2.0.35.tar.gz
          9.    php-5.2.6.tar.gz
          10.   Zend
          11.   Phpmyadmin
          12.   Phpwind
      三、    安装进程
          1.    安装apache 2.2
              [root@Lamp /]# cd /usr/local/src            
 //进入寄存软件包的目录
              [root@Lamp src]# tar zxvf httpd-2.2.8.tar.gz
 //解压缩文件
              [root@Lamp src]# cd httpd-2.2.8
              [root@Lamp httpd-2.2.8]# ./configure 
                                      –prefix=/usr/local/apache 
                                      –enable-mods-shared=all 
                                      –enable-rewrite 
                                      –enable-ssl 
                                      –enable-so
              [root@Lamp httpd-2.2.8]# make
              [root@Lamp httpd-2.2.8]# make install
              [root@Lamp httpd-2.2.8]#
/usr/local/apache/bin/apachectl start
          2.    安装Mysql 5.0.45
              [root@Lamp src]# groupadd mysql
              [root@Lamp src]# useradd -g mysql -s /sbin/nologin -M
mysql
              [root@Lamp src]# tar zxvf mysql-5.0.45.tar.gz
              [root@Lamp src]# cd mysql-5.0.45
              [root@Lamp mysql-5.0.45]# ./configure
–prefix=/usr/local/mysql 
                                                                       
             –with-xcharset=all 
                                                                       
             –with-charset=gbk
              [root@Lamp mysql-5.0.45]# make
              [root@Lamp mysql-5.0.45]# make install
              [root@Lamp mysql-5.0.45]#澳门新葡亰娱乐官网,
/usr/local/mysql/bin/mysql_install_db
              [root@Lamp mysql-5.0.45]# cd /usr/local/mysql/
              [root@Lamp mysql]# chown -R root /usr/local/mysql
              [root@Lamp mysql]# chown -fhv -R mysql:mysql
/usr/local/mysql/var
              [root@Lamp mysql]# chgrp -R mysql /usr/local/mysql
              [root@Lamp mysql]# cp ./share/mysql/my-large.cnf
 /etc/my.cnf
              [root@Lamp mysql]# bin/mysqld_safe –user=mysql
              [root@Lamp mysql]# bin/mysqladmin -u root password
“123456”
        3.安装GD2
          1): 安装zlib
              [root@Lamp mysql]# cd /usr/local/src
              [root@Lamp src]# tar zxvf zlib-1.2.3.tar.gz
              [root@Lamp src]# cd zlib-1.2.3
              [root@Lamp zlib-1.2.3]# ./configure
              [root@Lamp zlib-1.2.3]# make
              [root@Lamp zlib-1.2.3]# make install
          2):安装libxml2
              [root@Lamp src]# tar zxvf libxml2-2.6.19.tar.gz
              [root@Lamp libxml2-2.6.19]# ./configure
–prefix=/usr/local/libxml2
              [root@Lamp libxml2-2.6.19]# make
              [root@Lamp libxml2-2.6.19]# make install
          3):安装Zend
              [root@Lamp src]# cp -r ./Zend /usr/local/
          4):安装libpng
              [root@Lamp src]# tar zxvf libpng-1.2.29.tar.gz
              [root@Lamp libpng-1.2.29]# ./configure
–prefix=/usr/local/libpng
              [root@Lamp libpng-1.2.29]# make
              [root@Lamp libpng-1.2.29]# make install
          5):安装freetype
              [root@Lamp src]# tar zxvf freetype-2.3.5.tar.gz
              [root@Lamp freetype-2.3.5]# ./configure
 –prefix=/usr/local/freetype
              [root@Lamp freetype-2.3.5]# make
              [root@Lamp freetype-2.3.5]# make install
          6):安装jpeg6
              [root@Lamp src]# tar zxvf jpegsrc.v6b.tar.gz
              [root@Lamp jpeg-6b]# ./configure
–prefix=/usr/local/jpeg
              [root@Lamp jpeg-6b]# make
              [root@Lamp /]# mkdir /usr/local/jpeg
              [root@Lamp /]# mkdir /usr/local/jpeg/lib
              [root@Lamp /]# mkdir /usr/local/jpeg/include
              [root@Lamp /]# mkdir /usr/local/jpeg/bin
              [root@Lamp /]# mkdir /usr/local/jpeg/man
              [root@Lamp /]# mkdir /usr/local/jpeg/man/man1
              [root@Lamp jpeg-6b]# make install-lib
              [root@Lamp jpeg-6b]# make install
          7):安装GD2
              [root@Lamp src]# tar zxvf gd-2.0.35.tar.gz
              [root@Lampgd-2.0.35]#./configure
–prefix=/usr/local/gd 
                                                                       
     –with-jpeg=/usr/local/jpeg 
                                                                       
     –with-freetype=/usr/local/freetype 
                                                                       
     –with-png=/usr/local/libpng 
                                                                       
     –with-zlib
              [root@Lamp gd-2.0.35]# make
              [root@Lamp gd-2.0.35]# make install
          8):创建 mmcache 目录
              [root@Lamp src]# mkdir /tmp/mmcache
              [root@Lamp src]# chmod 777 /tmp/mmcache
      四、    安装php-5.2.6
              [root@Lamp src]# tar zxvf php-5.2.6.tar.gz
              [root@Lamp php-5.2.6]# ./configure
                                    –prefix=/usr/local/php 
                                   
–with-apxs2=/usr/local/apache/bin/apxs 
                                    –with-mysql=/usr/local/mysql 
                                    –with-libxml=/usr/local/libxml2 
                                   
–with-config-file-path=/usr/local/Zend/etc 
                                    –with-gd=/usr/local/gd 
                                   
–with-freetype-dir=/usr/local/freetype/ 
                                    –with-jpeg-dir=/usr/local/jpeg/ 
                                    –with-png-dir=/usr/local/libpng/ 
                                    –with-zlib-dir 
                                    –enable-mbstring 
                                    –enable-sockets
            [root@Lamp php-5.2.6]# make
            [root@Lamp php-5.2.6]# make install
            [root@Lamp php-5.2.6]# cp php.ini-dist
/usr/local/php/lib/php.ini
      五、    修改httpd.con让apache 支持PHP5
            [root@Lamp conf]# vi /usr/local/apache/conf/httpd.conf
            *在LoadModule处添加 LoadModule php5_module
module/libphp5.so
            *在DirectoryIndex处添加 index.php
            *在AddType application处添加
                AddType application/x-httpd-php .php .phtml
                AddType applicatoin/x-httpd-php-source .phps
      六、    测验Apache ,php是或不是正规运作。
            [root@Lamp htdocs]# vi
/usr/local/apache/htdocs/test.php
              具体语句:  <?
                            phpinfo()
                            ?>
              Apache
              Php    
能够见见php新闻表明不荒谬!

服务器篇–之 LAMP安装手记


Server OS: Cent OS

Apache:    http-2.2.11

PHP:PHP-5.2.9

Mysql: 5.1.32

 

GD: gd-2.0.35 

JPEG:jpeg-6b

libpng:libpng-1.2.35

libxml2:libxml2-2.6.19

freetype:freetype-2.3.9 

ZendOptimizer:ZendOptimizer-3.3.0a-linux-glibc21-i386

记得安装Linux的时候不要设置系统暗许的apache,mysql和php以至相关的软件。已经安装的请用rpm
-e * 删除已经设置的包。

 

一,安装apache2

(这里笔者把软件包都放/root下了卡塔尔

# cd /root 
进去目录/root
# tar -zvxf httpd-2.2.11.tar.gz 
解压httpd-2.2.11.tar.gz 
# cd httpd-2.2.11
进入httpd-2.2.11目录

# mkdir -p /usr/local/apache2
生成/usr/local/apache2目录
# ./configure –prefix=/usr/local/apache2
或者
# ./configure –prefix=/usr/local/apache –enable-modules=so
–enable-rewrite

陈设是不是支持重写

# make

编译

# make install
安装apache
# vi /usr/local/apache2/conf/httpd.conf
设置DocumentRoot 的路径

保留退出,以往好似此简单布置apache。

# /usr/local/apache2/bin/apachectl -k start 
启动apahce
用浏览器查看http://www.wengdo.com(这里写你本身网址,如http://localhost/),得到It
works,表明apache已经布置成功了。


# /usr/local/apache2/bin/apachectl -k stop
停止apache

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

重启Apache

 

把httpd 增加到系统的运转项里

# cp
/usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

# chmod 700
/etc/rc.d/init.d/httpd

# vi
/etc/rc.d/init.d/httpd

在第三行后扩大

# Comments to support
chkconfig on RedHat Linux

# chkconfig: 2345 90
90

# description:http
server

只顾:未有这几行,在选拔chkconfig时会提示您:service
httpd does not support chkconfig。

chkconfig –add httpd

chkconfig –level 345 httpd
on

如此那般,在运营品级345上httpd就足以活动运维了。

 

二,Mysql的安装

 

*# cd /root
# tar -zvxf  mysql-5.1.32-linux-i686-glibc23.tar.gz
# mkdir -p /usr/local/mysql (省略也可)
# cp -r  mysql-5.1.32-linux-i686-glibc23/
/usr/local/mysql
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

增添mysql客商及客户组
# groupadd mysql
# useradd -g mysql mysql
改良mysql目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
生成mysql系统数据库
# /usr/local/mysql/scripts/mysql_install_db –user=mysql&
启动mysql服务
# /usr/local/mysql/bin/mysqld_safe –user=mysql&
如出现 Starting mysqld daemon
with databases from /usr/local/mysql/data
意味着平常运转mysql服务了, 按Ctrl + C 跳出
修改 mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password “wengdo”**

wengdo
这里能够换为你自身的密码

 

把您编写翻译目录的叁个剧本COPY过去

# cp /usr/local/mysql/support-files/mysql.server
/etc/rc.d/init.d/mysqld

# chkconfig –add mysqld

用ntsysv设置使mysql每一回运转都能自行运维。

好了,至此mysql安装完结,你能够那样起步你的mysql服务

# /etc/rc.d/init.d/mysqld start

下边那步比较重大,

# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
# ln -s /usr/local/mysql/include/mysql /usr/include/mysql

大家能够不做那步,大能够在编写翻译其余软件的时候自定义myslq的库文件路线,但自己要么向往把库文件链接到暗许的职位,这样你在编写翻译相像PHP,Vpopmail等软件时得以不用钦命mysql的库文件地址。

 

三,安装GD库 (假设你用系统自带的GD库,可以简单这一步)

  • 安装 jpeg6 

制造目录:
# mkdir -p /usr/local/jpeg6 
# mkdir -p /usr/local/jpeg6/bin 
# mkdir -p /usr/local/jpeg6/lib 
# mkdir -p /usr/local/jpeg6/include 
# mkdir -p /usr/local/jpeg6/man 
# mkdir -p /usr/local/jpeg6/man1
# mkdir -p /usr/local/jpeg6/man/man1

# cd /root
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure –prefix=/usr/local/jpeg6/ –enable-shared
–enable-static
# make
# make install

  • 安装libpng 
    # cd /root
    # tar -zvxf libpng-1.2.35.tar.gz
    # cd libpng-1.2.35
    # cp scripts/makefile.std makefile 
    # make
    # make install 

  • 安装 freetype
    # cd /root 
    # tar -zvxf freetype-2.3.9.tar.gz 
    # cd freetype-2.3.9
    # mkdir -p /usr/local/freetype
    # ./configure –prefix=/usr/local/freetype 
    # make
    # make install

  • 安装GD库

# cd /root
# tar -zvxf gd-2.0.35.tar.gz
# mkdir -p /usr/local/gd2
# cd gd-2.0.35
# ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg6/
 –with-png=/usr/local/lib/ –with-zlib=/usr/local/lib/
–with-freetype=/usr/local/freetype/ –enable-m4_pattern_allow
# make
# make install

四,安装PHP5

php5必须有libxml2支持!
安装libxml2
# cd /root
# tar -zxvf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /usr/local/libxml2
# ./configure –prefix=/usr/local/libxml2
# make

# make install
 

安装php5
# cd /root
# tar -zvxf php-5.2.9.tar.gz 
# mkdir -p /usr/local/php
# cd php-5.2.9
# ./configure –prefix=/usr/local/php
–with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql=/usr/local/mysql/ 
–with-curl=/usr/local/curl –enable-ftp 
–with-libxml-dir=/usr/local/libxml2 
–with-expat-dir=/usr/lib –enable-soap 
–with-xsl=/usr/local/libxslt –enable-xslt 
–with-gd=/usr/local/gd2/ 
–with-jpeg-dir=/usr/local/jpeg6/ 
–with-zlib-dir=/usr/local/lib/
–with-png=/usr/local/lib/
–with-freetype-dir=/usr/local/freetype/ 
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini (别忘记了)

其中./configure 后的 
–prefix=/usr/local/php 
–with-apxs2=/usr/local/apache2/bin/apxs 
–with-mysql=/usr/local/mysql/
–with-libxml-dir=/usr/local/libxml2
是必需的选项

–with-gd=/usr/local/gd2/ 
–with-jpeg-dir=/usr/local/jpeg6/ 
–with-png=/usr/local/lib 
–with-zlib-dir=/usr/lib
–with-freetype-dir=/usr/local/freetype
那是让PHP援助GD库的配备选项

–with-curl=/usr/local/curl 支持CURL库
–enable-ftp 展开FTP库函数援助

–enable-soap –with-xsl=/usr/local/libxslt –enable-xslt
让PHP协助SOAP, 上边那几个相同用得少, 可以去掉
 

 

若是服务器自带
GD库及其有关的库,可以用上面这些措施去安插PHP

# ./configure
–prefix=/usr/local/php –with-mysql=/usr/local/mysql
–with-freetype-dir=/usr –with-png-dir=/usr –with-gd
–enable-gd-native-ttf –with-ttf –with-gdbm –with-gettext
–with-iconv –with-jpeg-dir=/usr –with-png –with-zlib –with-xml
–enable-calendar –with-apxs=/usr/local/apache2/bin/apxs

 

五,安装 ZendOptimizer

 

# cd /root

# tar -zxvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz

# cd ZendOptimizer-3.3.0a-linux-glibc21-i386

# ./install.sh

接下来现身图形分界面,按提醒Next

 

六,配置部分新闻

配置 httpd.conf
让apache支持PHP
# vi /usr/local/apache2/conf/httpd.conf
找到 AddType
application/x-gzip .gz .tgz 在其下加多如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

重启apache
# /usr/local/apache2/bin/apachectl restart
在您设置的目录里建一剧情为
<? phpinfo(卡塔尔国; ?> PHP文件, 输入UQX56L地址查看PHP配置是还是不是科学
 

 

安装时或然会现身的一对主题素材

  • 问题一:
     

编写翻译最新的GD库2.0.35本子,用暗中认可的 ./configure编写翻译
当make的时候,现身以下错误

configure.ac:64: error: possibly undefined macro: AM_ICONV
      If this token and others are legitimate, please use
m4_pattern_allow.
      See the Autoconf documentation.
make: *** [configure] Error 1

消除措施:
编译加m4_pattern_allow参数,上面已增加
# ./configure –enable-m4_pattern_allow

  • 问题二

数据库或然会见世那样的大谬不然
“Can’t connect to local MySQL server through socket
‘/tmp/mysql.sock'”
检查是不是留存特别socket文件,可以在/etc/my.cnf 中内定 socket =
/tmp/mysql.sock
使用.mysqld_safe –socket=/tmp/mysql.sock & 启动mysql进程,

有时pam_mysql使用/var/lib/mysql/mysql.sock
为此做个一连 ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
要么是修正/etc/my.cnf

有希望是权力难点,看看mysql的荒唐日志,一步一步调度

 

  • 问题三
     

重启Apache出错
重复开动apache报如下错误:
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/libphp5.so into server:
/usr/local/apache2/modules/libphp5.so: cannot restore segment prot
after reloc: Permission denied

原因:是Linux有三个SELinux爱戴方式引起的。

消弭办法

1关闭SELINUX的方法:
# vi /etc/selinux/config 
将SELINUX=enforcing 改成SELINUX=disabled 需求重启
以此办法大概会对服务器带给危机。

2不关闭SELINUX的方法:
# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t
/usr/local/apache2/modules/libphp5.so
# service httpd restart
# setenforce 1

 

  • 问题四
     

PHP 在Make 也许Make install的时候出错,报错消息:
Installing PEAR environment: /usr/local/lib/php/
/usr/local/php-5.2.5/sapi/cli/php: error while loading shared
libraries: /usr/local/gd2/lib/libgd.so.2: cannot restore segment prot
after reloc: Permission denied
make[1]: *** [install-pear-installer] Error 127
make: *** [install-pear] Error 2

安装出错,这个时候输入 tail /var/log/messages 查看错误日志
# tail /var/log/messages


Mar 3 06:40:46 localhost setroubleshoot: SELinux is preventing
/usr/local/php-5.2.5/sapi/cli/php from loading
/usr/local/gd2/lib/libgd.so.2.0.0 which requires text relocation. For
complete SELinux messages. run sealert -l
6e29749f-3908-480d-bcc1-9042f8a9e846

您能够找到 run sealert -l
6e29749f-3908-480d-bcc1-9042f8a9e846,试行它 
# sealert -l 6e29749f-3908-480d-bcc1-9042f8a9e846


The following command will allow this access:
chcon -t textrel_shlib_t /usr/local/gd2/lib/libgd.so.2.0.0
找到 following command chcon -t textrel_shlib_t
/usr/local/gd2/lib/libgd.so.2.0.0
# chcon -t textrel_shlib_t /usr/local/gd2/lib/libgd.so.2.0.0
再度运转make install 或make

  • 问题五
     

忘了mysql的root口令怎么做
# /usr/local/mysql/support-files/mysql.server stop
# mysqld_safe –skip-grant-tables & 
# mysqladmin -u user password ‘newpassword’
# mysqladmin flush-privileges

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图