主要针对Ubuntu8.04初始化环境进行的lamp安装.
说明:
这是对网上的资料进行了整理并实际操作成功后形成的文档.感谢网上提供相关资料的朋友!!
对不同版本的linux可能有所不同.最新的安装流程及方法请到以下网站交流:
http://www.xfocus.com.cn
1.系统环境:
安装时不要选择apache和mysql,避免冲突
如果选择了安装,可用aptitude等工具进行删除
2.用户与密码.
添加了mysql组及其用户mysql
mysql的root默认密码置为:chuiyun(注意修改)
3.文件下载
注:具体下载位置...要麻烦各位GOOGLE一下了.非常欢迎有时间的网友整理一份出来下载列表出来.
- apr-1.3.3.tar.gz
- libevent-1.4.7-stable.tar.gz
- mhash-0.9.9.tar.gz
- apr-util-1.3.4.tar.gz
- libiconv-1.12.tar.gz
- mysql-5.1.26-rc.tar.gz
- curl-7.19.0.tar.gz
- libmcrypt-2.5.8.tar.gz
- neon-0.28.3.tar.gz
- freetype-2.3.7.tar.gz
- libpng-1.2.31.tar.gz
- php-5.2.6.tar.gz
- httpd-2.2.9.tar.gz
- libxml2-2.7.1.tar.gz
- zlib-1.2.3.tar.gz
- jpegsrc.v6b.tar.gz
- mcrypt-2.6.7.tar.gz
4.执行命令
4.1执行命令之相关编译环境准备
- apt-get -y install g++ gcc make automake perl
- apt-get -y install manpages-dev
- apt-get -y install build-essential
- apt-get -y install libc6-dev libstdc++6-4.0-dev
- apt-get -y install autoconf automake1.9
- apt-get -y install binutils-doc cpp-doc gcc-doc glibc-doc
- apt-get -y install lrzsz
- apt-get -y install libncurses5-dev
- apt-get install ncurses-dev
4.2执行命令之相关安装包安装
- tar zxvf libiconv-1.12.tar.gz
- cd libiconv-1.12/
- ./configure -prefix=/usr/local
- make && make install
- cd ../
- tar zxvf freetype-2.3.7.tar.gz
- cd freetype-2.3.7/
- ./configure
- make && make install
- cd ../
- tar zxvf libpng-1.2.31.tar.gz
- cd libpng-1.2.31/
- ./configure
- make && make install
- cd ../
- tar zxvf jpegsrc.v6b.tar.gz
- cd jpeg-6b/
- ./configure -enable-static -enable-shared
- make && make install
- make install-lib
- cd ../
- tar zxvf libmcrypt-2.5.8.tar.gz
- cd libmcrypt-2.5.8/
- ./configure
- make && make install
- /sbin/ldconfig
- cd libltdl/
- ./configure -enable-ltdl-install
- make && make install
- cd ../../
- tar zxvf mhash-0.9.9.tar.gz
- cd mhash-0.9.9/
- ./configure
- make && make install
- cd ../
- cp /usr/local/lib/libmcrypt.* /usr/lib
- ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
- tar zxvf mcrypt-2.6.7.tar.gz
- cd mcrypt-2.6.7/
- ./configure
- make && make install
- cd ../
- tar zvxf apr-1.3.3.tar.gz
- cd apr-1.3.3
- ./configure -with-apr=/usr/local/apr/
- make && make install
- cd ..
- tar zvxf apr-util-1.3.4.tar.gz
- cd apr-util-1.3.4
- ./configure -prefix=/usr/local/apr-util -with-apr=/usr/local/apr
- make && make install
- cd ..
- tar zvxf libxml2-2.7.1.tar.gz
- cd libxml2-2.7.1
- ./configure
- make && make install
- cd ..
- tar zvxf neon-0.28.3.tar.gz
- cd neon-0.28.3
- ./configure -prefix=/usr/local/neon
- make && make install
- cd ..
- tar zvxf zlib-1.2.3.tar.gz
- cd zlib-1.2.3
- ./configure --prefix=/usr/local/zlib
- make && make install
- cd ..
- tar zvxf curl-7.19.0.tar.gz
- cd curl-7.19.0
- ./configure --prefix=/usr/local/curl
- make && make install
4.2执行命令之Apache+mysql+php安装
- cd ..
- tar zvxf httpd-2.2.9.tar.gz
- cd httpd-2.2.9
- ./configure --prefix=/usr/local/apache2 --enable-expires --enable-proxy --enable-deflate --enable-rewrite --enable-headers --enable-dav --enable-so --enable-modules=all --enable-mods-shared=all --enable-rule=SHARED_CORE --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-z=/usr/local/zlib
- make && make install
- chmod 775 /usr/local/apache2/bin/*
- cd ..
- tar zvxf mysql-5.1.26-rc.tar.gz
- cd mysql-5.1.26-rc
- ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-unix-socket-path=/tmp/mysql.sock --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all -with-pthread -enable-thread-safe-client -without-debug
- make && make install
- groupadd mysql
- useradd -g mysql mysql
- cp support-files/my-medium.cnf /etc/mysql/my.cnf
- chown -R mysql .
- chgrp -R mysql .
- scripts/mysql_install_db --user=mysql
- /usr/local/mysql/bin/mysqld_safe --user=mysql
- /usr/local/mysql/bin/mysqladmin -uroot password chuiyun
- apt-get -y install libxslt1-dev
- cd ..
- tar zvxf php-5.2.6.tar.gz
- cd php-5.2.6
- ./configure -prefix=/usr/local/php5 -with-apxs2=/usr/local/apache2/bin/apxs -with-config-file-path=/etc -disable-short-tags -with-iconv-dir=/usr/local -with-freetype-dir -with-jpeg-dir -with-png-dir -with-zlib -with-libxml-dir -enable-xml -disable-debug -disable-rpath -enable-discard-path -enable-safe-mode -enable-bcmath -enable-shmop -enable-sysvsem -enable-inline-optimization -with-curl -with-curlwrappers -enable-mbregex -enable-mbstring -with-mcrypt -enable-ftp -enable-exif -enable-sockets -enable-soap -with-xmlrpc -enable-calendar -with-gettext -with-mhash -with-mysql=mysqlnd -with-mysqli=mysqlnd -with-xsl -with-kerberos -disable-safe-mode -with-zlib=/usr/local/zlib -with-curl=/usr/local/curl -with-mysql=/usr/local/mysql -with-mysqli=/usr/local/mysql/bin/mysql_config --with-xsl=/usr/local/include/libxml2 -with-pdo-mysql=/usr/local/mysql/bin/mysql_config -enable-pdo
- make && make install
- cp php.ini-dist /etc/php.ini
5.配置
vim /etc/php.ini
- extension=php_pdo.dll
- extension=php_pdo_mysql.dll
vim /usr/local/apache2/conf/httpd.conf
- LoadModule php5_module modules/libphp5.so
- AddType application/x-httpd-php .php
- AllowOverride All
*加入自动启动.
vim /etc/rc.local
- /usr/local/mysql/bin/mysqld_safe --user=mysql
- /usr/local/apache2/bin/apachectl start
允许mysql远程登陆
- mysql -u root -pchuiyun
- mysql>use mysql;
- mysql>update user set host='%' where host='localhost';