最新Linux+Apache+Mysql+PHP安装笔记(转)

图片 3

PHP ======================================= cd apache_1.3.14
./configure –prefix=/usr/local/apache_php /** * this step need 1
minutes **/ cd ../php-4.0.3pl1 ./configure –prefix=/usr/local/php
–with-apache=../apache_1.3.14 –with-mysql=/usr/local/mysql

 

LAMP平台安装Xcache和Memcached加速网站运行 
http://www.linuxidc.com/Linux/2015-06/118835.htm 

这是最简单的安装,请扩展成自己需要的

三,安装GD库 (如果你用系统自带的GD库,可以省略这一步)

#chmod 755 /app/local/apache/htdocs/

作者信息 ================================= Macro Zeng

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

#cd libxml2-2.7.4

Mysql ======================================= pkgadd -d
mysql-3.23.28-gamma-sun-solaris2.7-sparc (进入解包后的目录)
./scripts/mysql_install_db

# make

报错提示:cannot remove `libtoolT’: No such file or directory ,

Others ====================================== cd ../php-4.0.3pl1 cp
php.ini-dist /usr/local/lib/php.ini /** * modify
/usr/local/apache_php/conf/ * modify /usr/local/lib/php.ini **/

下面这步比较关键,

#cd ../

Apache ======================================= cd ../apache_1.3.14
./configure –prefix=/usr/local/apache_php
–activate-module=src/modules/php4/libphp4.a /** * successful message
: Creating Makefile in src/… * this step need 2 minutes **/ make
/** * successful message : <=== src/support <=== src * this
step need 1 minutes **/ make install /** * successful message :
<=== [config] * this step need 1 minutes * creat the
/usr/local/apache_php directory **/

libpng:libpng-1.2.35

#cd /usr/local/src/

接触 solaris : 安装 apache + php + mysql

 

groupadd mysql

–with-ftp –with-xml –enable-track-vars /** * NOTE:You must install
gd lib before you use –with-gd * this step need 2 minutes **/ make
/** * If not find libtool,you must redirector the make path to
/usr/css/bin * successful message : Making all in pear * this step
need 5 minutes **/ make install /** * successful message : done *
this step need 1 minutes * creat the /usr/local/php directory **/

 

#cd libgd-2.1.1

Before Start ======================================= install gtar :
install gcc : gcc-2.8.1-sol7-sparc-local install gzip :
gzip-1.3-sol7-sparc-local install make : make-3.77-sol7-sparc-local
install gd 1.8.3 : install autoconf-2.13-sol7-sparc-local; install
perl-5.005_02-sol7-sparc-local gd-1.8.3.tar.gz
zlib-1.1.3-sol7-sparc-local.gz jpeg-6b-sol7-sparc-local.gz
libpng-1.0.2-sol7-sparc-local.gz xpm-3.4k-sol7-sparc-local.gz

# description:http
server

#./configure –prefix=/usr/local/apr-util
–with-apr=/usr/local/apr/bin/apr-1-config

 

#cd /usr/local/src

用ntsysv设置使mysql每次启动都能自动运行。

#make && make install

 

#./configure

  • 问题五
     

#./configure –prefix=/usr/local/libpng

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

?>

安装时可能会出现的一些问题

最后保存退出#/app/local/apache/bin/apachectl -t#测试httpd.conf
如果有错误,会有提示, 如果是正确的则显示为 “Syntax OK”

如果服务器自带
GD库及其相关的库,可以用下面这个方式去配置PHP

#./configure –prefix=/app/local/apache –enable-mods-shared=all
–enable-so –enable-proxy-ajp –enable-rewrite
–with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util
–with-pcre=/usr/local/pcre

  • 安装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库

CentOS 7下搭建LAMP平台环境 
http://www.linuxidc.com/Linux/2015-06/118818.htm

重启apache
# /usr/local/apache2/bin/apachectl restart
在你设置的目录里建一内容为
<? phpinfo(); ?> PHP文件, 输入URL地址查看PHP配置是否正确
 

#cd ../

四,安装PHP5

#cd cmake-3.1.3

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

说明已经启动
#vi /app/local/apache/htdocs/info.php

数据库可能会出现这样的错误
“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的错误日志,一步一步调整

wget

–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库的配置选项

在端口22下一行加入80 3306端口配置(分别是apache和mysql的端口)

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

#tar zxvf cmake-3.1.3.tar.gz

配置是否支持重写

#./configure –prefix=/usr/local/pcre

# 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目录

#make && make install

大家可以不做这步,大可以在编译其他软件的时候自定义myslq的库文件路径,但我还是喜欢把库文件链接到默认的位置,这样你在编译类似PHP,Vpopmail等软件时可以不用指定mysql的库文件地址。

#tar zxvf jpegsrc.v9b.tar.gz

把你编译目录的一个脚本COPY过去

#tar -xvf libpng-1.2.56.tar

GD: gd-2.0.35 

报错提示:cannot remove `libtoolT’: No such file or directory ,

六,配置一些信息

wget

# Comments to support
chkconfig on RedHat Linux

#./configure –prefix=/usr/local/apr

二,Mysql的安装

#ln -s /app/local/mysql/my.cnf /etc/my.cnf

好了,至此mysql安装完毕,你可以这样起动你的mysql服务

wget

 

#ps -ef|grep httpd

Mysql: 5.1.32

#cd ../

# chkconfig: 2345 90
90

#./configure -prefix=/usr/local/freetype

  • 问题四
     

#make && make install

wengdo
这里可以换为你自己的密码

#tar zxvf httpd-2.4.18.tar.gz

重启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

mkdir -p /app/local/{php,apache,mysql,data}
groupadd -g 500 www
useradd -u 500 -g 500 -G 500 -s /sbin/nologin www

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

wget

然后出现图形界面,按提示Next

找到: Options  Indexes FollowSymLinks
修改为:Options  FollowSymLinks
找到:AllowOverride None
修改为:AllowOverride All

chkconfig –add httpd

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-04/130356.htm

(这里我把软件包都放/root下了)

然后安装mysql,首先安装cmake

# ./install.sh

wget

Apache:    http-2.2.11

wget
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

# chkconfig –add mysqld

找到;ServerName www.example.com:80
改为ServerName localhost:80
找到:AddType application/x-gzip .gz .tgz
在该行下面添加:AddType application/x-httpd-php .php
找到DirectoryIndex index.html
改为:DirectoryIndex index.html index.htm index.php
找到User daemon Group daemon
注释后添加:User www
                    Group www

PHP:PHP-5.2.9

#tar zxvf  apr-1.5.2.tar.gz

 

wget

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

#cd ../

# make install
 

root    12130  1259  0 15:49 pts/0    00:00:00 grep httpd
root    23172    1  0 14:13 ?        00:00:00
/app/local/apache/bin/httpd -k start
www      23173 23172  0 14:13 ?        00:00:02
/app/local/apache/bin/httpd -k start
www      23174 23172  0 14:13 ?        00:00:02
/app/local/apache/bin/httpd -k start
www      23175 23172  0 14:13 ?        00:00:02
/app/local/apache/bin/httpd -k start

  • 问题三
     

#make && make install

libxml2:libxml2-2.6.19

#cd ../

编译

#mkdir /usr/local/jpeg6/man/man1

 

#tar zxvf libxml2-2.7.4.tar.gz

 

wget


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

#tar zxvf mysql-5.5.47.tar.gz

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

Ubuntu 14.10 下安装 LAMP 服务图文详解 
http://www.linuxidc.com/Linux/2014-12/110082.htm

# ./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

#./configure –prefix=/usr/local/libmcrypt

建立目录:
# 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

#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 (别忘记了)

#make && make install

Server OS: Cent OS

wget

把httpd 添加到系统的启动项里

通过搜狐镜像获取apache、mysql、php

 

#tar zxvf pcre-8.10.tar.gz

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

#./scripts/mysql_install_db –user=mysql –basedir=/app/local/mysql
–datadir=/app/local/data

  • 问题一:
     

#chkconfig mysql on

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

LAMP结合NFS构建小型博客站点 
http://www.linuxidc.com/Linux/2015-08/121029.htm

一,安装apache2

如果没有的话 可能是selinux和防火墙没有做相应设置

 

最后安装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

#cd ../

# 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

#make && make install

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

wget

JPEG:jpeg-6b

改为SELINUX=disabled

服务器篇–之 LAMP安装手记

#cd../

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

vi /etc/sysconfig/iptables

freetype:freetype-2.3.9 

新建相应的目录和用户和用户组:

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

wget ftp://ftp.cn.debian.org/gentoo/distfiles/zlib-1.2.5.1.tar.gz

 

然后在关闭selinux

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

首先确保系统可以联网。设置IP地址以及虚拟机安装linux在此略过。本文采用CentOS
6.7
64位minimal版、php5.6.16、httpd-2.4.18、mysql-5.5.47版搭建lamp环境。默认设置软件下载目录/usr/local/src,软件安装目录/app/local/下,安装顺序是apache→mysql→php。

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

#cmake -DCMAKE_INSTALL_PREFIX=/app/local/mysql
-DMYSQL_DATADIR=/app/local/data -DSYSCONFDIR=/etc

这样,在运行级别345上httpd就可以自动启动了。

先配置一下httpd.conf
找到;ServerName www.example.com:80
改为ServerName localhost:80
#/app/local/apache/bin/apachectl -k start

重启Apache

#xz -d libpng-1.2.56.tar.xz

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

#make && make install

 

#cp /usr/local/src/php-5.6.12/php.ini-production
/app/local/php/etc/php.ini
#vi /app/local/php/etc/php.ini
找到;date.timezone
改为date.timezone=PRC
保存退出
配置apache解析php:
#vi /app/local/apache/conf/httpd.conf

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

解决办法:编辑 configure文件,查找 $RM “$cfgfile”
这个地方,用#注释掉,然后就可以了

  • 问题二

#chown -R www:www /app/local/apache/htdocs/

 

图片 1

chkconfig –level 345 httpd
on

#mkdir -p /usr/local/jpeg6/{bin,lib,include,man}

*# 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

#cd ../

注意:没有这几行,在使用chkconfig时会提示你:service
httpd does not support chkconfig。

图片 2

添加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”**

下面关于LAMP相关的内容你可能也喜欢

保存退出,现在就这么简单配置apache。

#./configure –prefix=/usr/local/apr

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

setenforce 0 #使配置立即生效

配置 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

#cd freetype-2.4.12

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

#cd apr-1.5.2

  • 安装 jpeg6 

#make && make install

五,安装 ZendOptimizer

#make && make install

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

在浏览器下输入ip地址查看apache是否成功启动

–enable-soap –with-xsl=/usr/local/libxslt –enable-xslt
让PHP支持SOAP, 上面这些一般用得少, 可以去掉
 

#service mysql start

在第三行后增加

图片 3

# cd /root

#./configure –prefix=/usr/local/libxml2

#tar jxvf php-5.6.12.tar.bz2

-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT

wget

wget

wget

#tar jxvf freetype-2.4.12.tar.bz2

#cd jpeg-9b/

#./configure

#cd ../

搜狐镜像:

#cd ../

#cd pcre-8.10

#./configure –prefix=/usr/local/jpeg6/ –enable-shared –enable-static

#tar zxvf apr-util-1.5.4.tar.gz

#make && make install

解决办法:编辑 configure文件,查找 $RM “$cfgfile”
这个地方,用#注释掉,然后就可以了

#make && make install

:wq#保存退出

useradd -g mysql mysql -s /bin/false

wget

CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
http://www.linuxidc.com/Linux/2014-12/111030.htm

#cd apr-util-1.5.4

Ubuntu 14.04 配置
LAMP+phpMyAdmin PHP(5.5.9)开发环境 
http://www.linuxidc.com/Linux/2014-10/107924.htm

#./configure –prefix=/usr/local/libxml2

#cd php-5.6.12

#./configure

#cd ../

#cd httpd-2.4.18

#cd libmcrypt-2.5.7

service iptables restart #重启防火墙使配置生效

equire all granted

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

#make && make install

#/app/local/apache/bin/apachectl  start

#cd ../

wget

#cd libpng-1.2.56

#make && make install

#tar zxvf autoconf-2.53.tar.gz

#make && make install

#tar zxvf libmcrypt-2.5.7.tar.gz

:wq保存退出

# cp /app/local/mysql/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf

#./configure –prefix=/app/local/php
–with-config-file-path=/app/local/php/etc
–with-apxs2=/app/local/apache/bin/apxs –with-mysql
–with-libxml-dir=/usr/local/libxml2 –with-png-dir=/usr/local/libpng
–with-jpeg-dir=/usr/local/jpeg6 –with-freetype-dir=/usr/local/freetype
–with-gd=/usr/local/gd2 –with-zlib-dir=/usr/local/zlib
–with-mcrypt=/usr/local/libmcrypt –with-mysqli
–with-xpm-dir=/usr/lib64 –enable-soap –enable-mbstring=all
–enable-sockets

#cd /app/local/mysql/

#./configure –prefix=/usr/local/gd2  –with-zlib=/usr/local/zlib
–with-jpeg=/usr/local/jpeg6 –with-png=/usr/local/libpng
–with-freetype=/usr/local/freetype/

vi /etc/sysconfig/selinux

#tar jxvf libgd-2.1.1.tar.bz2

安装Apache

#cd ../

如图所示

#cd mysql-5.5.47

#cd ../

#cp support-files/mysql.server /etc/init.d/mysql

#chown -R mysql:mysql /app/local/data

#tar zxvf zlib-1.2.8.tar.gz

<?php

#cd autoconf-2.53

保存退出后在浏览器输入ip地址/info.php后检测是否成功

#cd ../

首先安装相应的库文件:
yum -y install xz  libXpm-devel lua-devel libxslt-devel gcc
gcc-c++libjpeg libjpeg-devel glibc glibc-devel glib2 glib2-devel bzip2
bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs
e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl
openssl-devel openldap openldap-devel nss_ldap openldap-clients
openldap-servers

phpinfo();

wget

-y install wget

#cd zlib-1.2.8

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

Leave a Reply

网站地图xml地图