linux下编译安装LAMP

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33


yum -yinstallgcc gcc-c++ makeautoconf  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \

libxml2 libxml2-devel zlib zlib-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 patchunzip vim-enhanced  libtool-ltdl-devel libtool

wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make

makeinstall

cd ../

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxvf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure

make

makeinstall

cd ../

wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz

tar zxvf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9

./configure

make

makeinstall

cd ../

ldconfig

wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz

tar zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8

./configure

make

makeinstall

cd ../


安装Apache2.22:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

wget http://labs.renren.com/apache-mirror/httpd/httpd-2.2.22.tar.gz

tar zxvf httpd-2.2.22.tar.gz

cd httpd-2.2.22

#./configure --prefix=/usr/local/httpd --enable-so  --enable-mods-shared=most

#动态编译大部分常用模块

./configure --prefix=/usr/local/httpd  \

--sysconfdir=/etc/httpd  \

--enable-so \

--enable-ssl  \

--enable-rewrite \

--enable-expires \

--enable-headers \

--enable-deflate \

--with-mpm=worker

make

makeinstall

cp/usr/local/httpd/bin/apachectl  /etc/init.d/httpd

chmod 755  /etc/init.d/httpd

sed-i'1a # chkconfig: 345 85 15'/etc/init.d/httpd

/etc/init.d/httpd start

chkconfig --level 3 httpd on

cd ../


安装Mysql5.1.63:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

wget http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.63.tar.gz

tar zxvf mysql-5.1.63.tar.gz

cd mysql-5.1.63

./configure --prefix=/usr/local/mysql  \

--without-debug \

--with-unix-socket-path=/tmp/mysql.sock  \

--with-mysqld-ldflags=-all-static  \

--with-charset=utf8 \

--with-extra-charsets=gbk,gb2312  \

--with-big-tables \

--with-readline \

--enable-local-infile \

--enable-assembler \

--enable-thread-safe-client

make

makeinstall

cp support-files/my-medium.cnf /etc/my.cnf

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

chmod 755  /etc/init.d/mysqld

chkconfig --level 3 mysqld on

useradd -s/sbin/nologin -M mysql

/usr/local/mysql/bin/mysql_install_db  --user=mysql

ln-s/usr/local/mysql/bin/mysql /usr/bin/mysql

ln-s/usr/local/mysql/bin/mysqldump /usr/bin/mysqldump

ln-s/usr/local/mysql/bin/myisamchk /usr/bin/myisamchk

/etc/init.d/mysqld  start

/usr/local/mysql/bin/mysqladmin  -u root password "password"

cd ../


安装PHP5.3.13:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

wget http://cn.php.net/distributions/php-5.3.13.tar.gz

tar zxvf php-5.3.13.tar.gz

cd php-5.3.13

./configure --prefix=/usr/local/php  \

--with-apxs2=/usr/local/httpd/bin/apxs \

--with-mysql=/usr/local/mysql \

--with-mysqli=/usr/local/mysql/bin/mysql_config \

--disable-debug \

--with-iconv-dir \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir \

--with-mcrypt \

--with-gd \

--with-openssl \

--with-mhash \

--with-xmlrpc \

--with-curl \

--enable-inline-optimization \

--enable-xml \

--enable-mbstring \

--enable-gd-native-ttf \

--enable-sockets \

--enable-zip

makeZEND_EXTRA_LIBS='-liconv'

makeinstall

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

ln-s/usr/local/php/bin/php /usr/bin/php

ln-s/usr/local/php/bin/phpize /usr/bin/phpize

cd ../


配置Apache支持PHP程序:

1

2

3

4

5

6

cat>>/etc/httpd/httpd.conf  <<EOF

AddType application/x-httpd-php .php

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

EOF

sed-i's/index.html/index.html index.php/g'/etc/httpd/httpd.conf

/etc/init.d/httpd  restart


测试PHP:

1

2

3

4

5

cat>>/usr/local/httpd/htdocs/phpinfo.php <<EOF

<?php  

phpinfo();  

?>

EOF


你可能感兴趣的:(LAMP的编译安装)