LAMP配置文档
LAMP搭建及其组件配置
平台是:linux as4 + httpd-2.2.6 + mysql-5.0.27 + php-5.2.6组件是:phpmyadmin-3.1.3+ZendOptimizer-3.2.81.Mysql的安装tar zxvf mysql-5.0.27.tar.gz进入mysql解压的源码文件目录./configure --prefix=/usr/local/mysql #设置mysql的安装路径./configure --with-charset=gbk --with-collation=gbk_chinese_ci--with-extra-charsets=none #加入gbk字符集make && make install #编译,进行安装。
配置mysql:groupadd mysql #添加mysql组useradd -g mysql mysql #添加mysql用户并加入到mysql组cd /usr/local/mysql/ #切换到cd /usr/local/mysql/目录下chown -R mysql . #改变当前目录下的所有者为mysql用户chgrp -R mysql . #改变当前目录下的mysql用户的文件为mysql组cd /usr/local/src/mysql-5.0.27/support-files #在源码mysql目录的support-files下cp f /etc/f #拷贝文件到/etc/覆盖f 文件cd /usr/local/mysql/bin #改变目录到/usr/local/mysql/bin./mysql_install_db --user=mysql #以mysql身份初始化数据库cd /usr/local/mysql #改变目录到/usr/local/mysqlchown -R mysql:mysql var #改变var目录所属mysql用户到mysql组chmod 755 var #改变var目录权限cd /usr/local/mysql/bin #改变目录到/usr/local/mysql/bin./mysqld_safe --user=mysql & #以mysql用户启动库生成套接字netstat -ant | grep 3306 #查看mysql是否启动,mysql用的是3306端口cd /usr/local/src/mysql-5.0.27/support-files/ #改变目录cp mysql.server /etc/init.d/mysqld #拷贝文件用于开机自动启动chmod 755 /etc/init.d/mysqld #给mysqld权限chkconfig --add mysqld #添加mysqld服务到系统chkconfig mysqld on #打开myslqd服务service mysqld restart #启动mysql服务测试mysql:cd /usr/local/mysql/bin #改变目录到cd /usr/local/mysql/bin mysql #登陆mysqlshow databases; #查看数据库表2.Apache的安装# tar xvzf httpd-2.2.6.tar.gz# cd httpd-2.2.6# ./configure --enable-dav --enable-so --enable-mods-shared=all--enable-module=rewrite --prefix=/usr/local/apache2# make && make install#ln -s /usr/local/apache2/bin/apachectl /sbin/apachectl编辑配置文件httpd.conf# vi /usr/local/apache2/conf/httpd.conf修改内容:ServerName :80为ServerName localhost:80或者Apache服务器的IP安装完成并修改后,启动apache进程:/usr/local/apache2/bin/apachectl start(或者在/usr/local/apache2/bin/下,用./httpd –k start),然后打开浏览器http://localhost/,如果有测试页"It works!"出现,则证明已经安装成功。
LAMP服务标准配置文档
LAMP安装文档万志华一.环境:linux(安装时要禁止防火墙和SELINUX,不装任何服务不必要的服务)二.版本:apache-2.2.4以上 mysql-5.0.27以上 php-5.2.6以上版本三.所需软件源代码包:假设以下软件包都在/usr/local/src目录下:httpd-2.2.4.tar.gz mysql-5.0.27.tar.gz php-5.2.1.tar.bz2freetype-2.3.2.tar.gz gd-2.0.34.tar.gz jpegsrc.v6b.tar.gzlibpng-1.2.8.tar.bz2 libxml2-2.6.24.tar.bz2 zlib-1.2.2.tar.gztidy-cvs_20070326.tar.bz2四.安装顺序:apache -> mysql -> freetype -> jpegsrc.v6b -> libpng -> libxml -> zlib -> gd -> php ( freetype,jpegsrc.v6b,libxml,zlib,libpng 的安装顺序不限)约定目录:/usr/local/src 软件源代码包存放位置/usr/local/software_name 源码包编译安装位置五.安装过程:1 . apache首先安装apache的相关包apr-util-1.2.7.tar.gz和apr-1.2.7.tar.gz#tar xvfz apr-1.2.7.tar.gz#cd apr-1.2.7#./configure --prefix=/usr/local/apr-httpd#make#make install然后#tar xvfz apr-util-1.2.7.tar.gz#cd apr-util-1.2.7#./configure --prefix=/usr/local/apr-util-httpd --with-apr=/usr/local/apr-http d#make#make install# cd /usr/local/src# tar xzvf http-2.2.4.tar.gz# cd http-2.2.4./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd --enable-so --enable-module=so --enable-deflate --enable-mods-shared=all --enable-modules=all --enable-shared=max --enable-rewrite --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --disable-userdir --with-mpm=workerMpm worker方式####################################./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd --enable-so --enable-module=so --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-suexec --enable-mods-shared=all --enable-modules=all --enable-shared=max --enable-rewrite --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --enable-vhost-alias --enable-speling --disable-userdir --with-mpm=preforkMpm prefork 方式# make# make install# /usr/local/apache2/bin/apachectl start将apache服务器配置为系统服务:# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd# cd /etc/rc3.d# ln -s /etc/init.d/httpd S85httpd# ln -s /etc/init.d/httpd K85httpd以后启动就可以用service方式,例如service httpd start (stop,restart)如果没有抱错,直接出现提示符,到IE下打localhost,若出现It Works! 说明apache 启动成功.2. mysql (可以完全静态编译,可以用官方二进制编译好的版本)这里以二进制版本安装为例:# tar xzvf mysql-5.0.37-linux-i686-glibc23.tar.gz# ln -s mysql-5.0.37-linux-i686-glibc23 mysql# cd mysql# groupadd mysql#useradd -g mysql mysql#scripts/mysql_install_db --user=mysql#chown -R root .#chown -R mysql data#chgrp -R mysql .#bin/mysqld_safe --user=mysql &#cp support-files/f /etc/f#cp support-files/mysql.server /etc/rc.d/init.d/mysqld#chkconfig --add mysqld#/etc/rc.d/init.d/mysqld start (启动mysql)#/etc/rc.d/init.d/mysqld stop (停止mysql服务)#/etc/rc.d/init.d/mysqld restart(重启mysql服务器)#/usr/local/mysql/bin/mysqladmin –uroot password 'passwd' (修改本mysql的root改密码)3 .安装相关底层库ffmpegzipimagemagiccurl(1)libxml# cd /usr/local/src# tar xjvf libxml2-2.6.24.tar.bz2# cd libxml2-2.6.24# ./configure --prefix=/usr/local/libxml2# make# make install(2)jpeg6先建立相关目录# mkdir /usr/local/jpeg6# mkdir /usr/local/jpeg6/bin# mkdir /usr/local/jpeg6/lib# mkdir /usr/local/jpeg6/include# mkdir /usr/local/jpeg6/man# mkdir /usr/local/jpeg6/man/man1# cd /usr/local/src# tar vzxf jpegsrc.v6b.tar.gz# cd jpeg-6b# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static # make# make install(3)freetype# cd /usr/local/src# tar zvxf freetype-2.3.2.tar.gz# cd freetype-2.3.2# ./configure --prefix=/usr/local/freetype# make# make install(4)zlib# cd /usr/local/src# tar zvxf zlib-1.2.2.tar.gz# cd zlib-1.2.2# ./configure --prefix=/usr/local/zlib# make# make install(5) libpng# cd /usr/local/src# tar zjvf libpng-1.2.8.tar.bz2# cd libpng-1.2.8# cp scripts/makefile.std makefile# make# make install(6)gd# cd /usr/local/src# tar xzvf gd-2.0.34.tar.gz# cd gd-2.0.34# ./configure --prefix=/usr/local/gd2 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6 --with-libxml=/usr/local/libxml2# make# make install(7)tidy#tar -jxvf tidy-cvs_20070326.tar.bz2#cd tidy-cvs_20070326#./configure --prefix=/usr/local/libtidy/#make#make install4安装php# cd /usr/local/src# tar xvjf php-5.2.6.tar.bz2# cd php-5.2.1【CLI方式编译安装】:#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-inline-optimization --with-config-file-path=/usr/local/php/lib/ --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-freetype-dir=/usr/local/freetype/ --with-zlib-dir=/usr/local/zlib/ --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --disable-ipv6 --enable-static --enable-sockets --enable-soap --enable-gd-native-ttf --with-ttf --enable-static --enable-mbstring --with-tidy=/usr/local/libtidy --with-iconv-dir=/usr/local/libiconv --with-mcrypt=/usr/local/libmcrypt --with-png-dir --enable-zip --with-curl=/usr/local/curl#make#make install#cp php.ini-dist /usr/local/php/lib/php.ini【FCGI方式编译】./configure --prefix=/usr/local/php --enable-fastcgi --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php/lib/ --disable-debug --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-freetype-dir=/usr/local/freetype/ --with-zlib-dir=/usr/local/zlib/ --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir --enable-mbstring --with-ttf --with-xml --enable-ftp --with-freetype --enable-force-cgi-redirect --enable-mbstring --with-iconv --enable-sockets --with-curlwrappers --disable-ipv6 --enable-static --enable-sockets --enable-soap--enable-gd-native-ttf --with-tidy=/usr/local/libtidy装完php重启apache和mysql 看是否运行正常,若无报错信息。
配置LAMP全过程
配置LAMP全过程需要准备:操作系统:Centos 5.5mkdir /opt/installd 以上文件下载到这个新建的文件夹里df –h 查看系统空间localevi /etc/sysconfig/i18n 设定:LANG=”en_US”cat /proc/cpuinfo 查询系统信息yum install -y libtool ncurses ncurses-devel gcc gcc-c++ libxml2-devel openssl-devel curl-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel libmhash libmhash-devel libjpeg libjpeg-devel pcre-develfree –m 查看硬盘空间wcat /etc/redhat-release 查看系统版本uname –a 查看内核cd /opt/installdtar -zxf mysql-5.0.82sp1.tar.gzcd mysql-5.0.82sp1vi sql/{"max_connections", OPT_MAX_CONNECTIONS,"The number of simultaneous clients allowed.", (gptr*) &max_connections,(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,0},修改为{"max_connections", OPT_MAX_CONNECTIONS,"The number of simultaneous clients allowed.", (gptr*) &max_connections,(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 1000, 1, 16384, 0, 1,0},groupadd mysql -g 27mkdir -p /opt/mysqluseradd mysql -u 27 -g mysql -M -s /sbin/nologin -r -d /opt/mysqlchown mysql:mysql /opt/mysqlvi /etc/passwdvi /etc/group./configure --prefix=/usr/local/mysql5 --with-server-suffix=-source --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc --with-mysqld-user=mysql --localstatedir=/opt/mysql --mandir=/usr/share/man --with-unix-socket-path=/tmp/mysql.sock --without-debug --with-low-memory--with-big-tables --with-PACKAGE=yes --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-extra-charsets=all --with-charset=utf8 --with-collation=utf8_general_cimakemake installmysql_install_dbcd support-files/cp mysql.server /etc/init.d/mysqlchmod 755 /etc/init.d/mysqlchkconfig --level 2345 mysql onchown mysql.mysql /opt/mysql/ -Rlsfree -mcp f /etc/fvi /etc/f修改方法:log-bin=mysql-bin 修改成#log-bin=mysql-bin#skip-networking 修改成skip-networking# Uncomment the following if you are using InnoDB tables#innodb_data_home_dir = /opt/mysql/#innodb_data_file_path = ibdata1:10M:autoextend#innodb_log_group_home_dir = /opt/mysql/#innodb_log_arch_dir = /opt/mysql/# You can set .._buffer_pool_size up to 50 - 80 %# of RAM but beware of setting memory usage too high#innodb_buffer_pool_size = 16M#innodb_additional_mem_pool_size = 2M# Set .._log_file_size to 25 % of buffer pool size#innodb_log_file_size = 5M#innodb_log_buffer_size = 8M#innodb_flush_log_at_trx_commit = 1#innodb_lock_wait_timeout = 50修改成:# Uncomment the following if you are using InnoDB tablesinnodb_data_home_dir = /opt/mysql/innodb_data_file_path = ibdata1:10M:autoextendinnodb_log_group_home_dir = /opt/mysql/innodb_log_arch_dir = /opt/mysql/# You can set .._buffer_pool_size up to 50 - 80 %# of RAM but beware of setting memory usage too highinnodb_buffer_pool_size = 16Minnodb_additional_mem_pool_size = 2M# Set .._log_file_size to 25 % of buffer pool sizeinnodb_log_file_size = 5Minnodb_log_buffer_size = 8Minnodb_flush_log_at_trx_commit = 1innodb_lock_wait_timeout = 50max_allowed_packet = 16M 修改成max_allowed_packet = 32Msort_buffer_size = 512K 修改成sort_buffer_size = 2Mnet_buffer_length = 8K 修改成net_buffer_length = 32Kread_buffer_size = 256K 修改成read_buffer_size = 512Kservice mysql restartmysqlshow databases;quitmysqladmin password 10086vi ~/f[client]user="root"pass="10086"cd libiconv-1.13.1./configuremakemake installcd php-5.2.13./configure --with-layout=GNU --prefix=/usr/local/php5 --enable-force-cgi-redirect --enable-fastcgi --enable-discard-path --with-config-file-path=/usr/local/php5/lib --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-kerberos --with-openssl --with-mcrypt --with-mhash --with-mysql=/usr/local/mysql5 --with-mysql-sock=/tmp/mysql.sock --with-mysqli=/usr/local/bin/mysql_config --with-pdo-mysql=/usr/local --with-pear --with-png-dir=/usr/local/lib --with-zlib --enable-zip --enable-gd-native-ttf --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --enable-mbstring --with-xmlrpc --disable-ipv6makemake installls/usr/local/php5/bin/php -i | grep php.inicp php.ini-recommended /usr/local/php5/lib/php.inivi /usr/local/php5/lib/php.inierror_reporting = E_ALL 修改为error_reporting = E_ALL & ~E_NOTICEdisplay_errors = Off 修改为display_errors = On;error_log = filename 修改为error_log = error_logcd ../httpd-2.2.15./configure --enable-expires --enable-headers --enable-info --enable-logio --enable-proxy --enable-rewrite --enable-so --enable-ssl --enable-unique-id --enable-vhost-alias --enable-suexec --prefix=/usr/local/apache --with-included-apr --with-ssl=/usr --with-suexec-caller=nobody --with-suexec-docroot=/ --with-suexec-gidmin=500 --with-suexec-logfile=/usr/local/apache/logs/suexec_log --with-suexec-uidmin=500 --with-suexec-userdir=public_htmlmakemake installlscp build/rpm/httpd.init /etc/init.d/httpdchmod 755 /etc/init.d/httpdvi /etc/init.d/httpd/usr/local/apache/bin/httpdhttpd=${HTTPD-/usr/sbin/httpd} 修改为httpd=${HTTPD-/usr/local/apache/bin/httpd}CONFFILE=/etc/httpd/conf/httpd.conf 修改为CONFFILE=/usr/local/apache/conf/httpd.confchkconfig --level 2345 httpd onservice httpd restartcurl -I http://localhost/yum install apr apr-devel /*安装apr才能安装suphp*/cd ../suphp-0.7.1ls./configure --with-apxs=/usr/local/apache/bin/apxs --with-min-uid=500 --with-min-gid=500 --with-apache-user=nobody --prefix=/usr/local/suphp --disable-checkpath --with-setid-mode=paranoid --sysconfdir=/etc --with-apr=/usr/bin/apr-1-configmakemake installmkdir /opt/webgroupadd webapps /*添加用户组webapps*/useradd webapps –g webapps –d /opt/web /*添加用户webapps*/cd /usr/local/apache/confvi /usr/local/apache/conf/httpd.conf<Directory />Options FollowSymLinksAllowOverride NoneOrder deny,allowDeny from all</Directory>复制个新的,并修改为:<Directory /opt/web>Options FollowSymLinksAllowOverride AllOrder deny,allowAllow from all</Directory>DocumentRoot "/usr/local/apache/htdocs" 修改为DocumentRoot "/opt/web/default" <Directory "/usr/local/apache/htdocs"> 修改为<Directory "/opt/web/default">mkdir -p /opt/web/defaultvi httpd.confUser daemon 修改为:User nobodyGroup daemon 修改为:Group nobodykillall -9 httpd;service httpd restartvi httpd.conf#Include conf/extra/httpd-vhosts.conf 修改为Include conf/extra/httpd-vhosts.conf #Include conf/extra/httpd-info.conf 修改为Include conf/extra/httpd-info.conf#Include conf/extra/httpd-mpm.conf 修改为Include conf/extra/httpd-mpm.confcd extra/vi httpd-default.confKeepAlive On 修改为KeepAlive OffServerTokens Full 修改为ServerTokens OSServerSignature On 修改为ServerSignature Offvi httpd-info.confAllow from 修改为Allow from 127.0.0.1#ExtendedStatus On 修改为ExtendedStatus Onvi httpd-mpm.conf<IfModule mpm_prefork_module>StartServers 5MinSpareServers 5MaxSpareServers 10MaxClients 150MaxRequestsPerChild 0</IfModule>修改为:<IfModule mpm_prefork_module>StartServers 5MinSpareServers 5MaxSpareServers 10MaxClients 1500MaxRequestsPerChild 0</IfModule>vi httpd-vhosts.conf<VirtualHost *:80>ServerAdmin webmaster@DocumentRoot "/usr/local/apache/docs/"ServerName ServerAlias ErrorLog "logs/-error_log"CustomLog "logs/-access_log" common </VirtualHost>修改为:<VirtualHost *:80>ServerAdmin newphp@DocumentRoot /opt/web/defaultServerName ServerAlias ErrorLog "logs/-error_log"CustomLog "logs/-access_log" common </VirtualHost>mkdir -p /domlogsvi httpd-vhosts.conf<VirtualHost *:80>ServerAdmin newphp@DocumentRoot /opt/web/defaultServerName localhostServerAlias ErrorLog /domlogs/localhost.errorCustomLog /domlogs/localhost combin</VirtualHost>Include conf/vhost/*.conf /*在此文件内容下添加这句代码*/mkdir ../vhostservice httpd configtestvi /etc/hostsvi ../httpd.confServerAdmin newphp@#ServerName :80修改成ServerName localhost:80 DirectoryIndex index.html 修改为DirectoryIndex index.html index.phpcd /opt/installd/tar -zxf cronolog-1.6.2.tar.gzcd cronolog-1.6.2./configuremakemake installwhereis cronolog/usr/local/sbin/cronologcd /usr/local/apache/conf/extra/vi httpd-vhosts.confCustomLog /domlogs/localhost combined 修改CustomLog "|/usr/local/sbin/cronolog /domlogs/localhost.%Y%m%d" combinedvi httpd-mpm.conf<IfModule mpm_prefork_module>StartServers 5MinSpareServers 5MaxSpareServers 10MaxClients 150MaxRequestsPerChild 0</IfModule>修改为:<IfModule mpm_prefork_module>StartServers 5MinSpareServers 5MaxSpareServers 30MaxClients 256MaxRequestsPerChild 10000</IfModule>vi /etc/suphp.conf /* 新建suphp.conf */添加代码:[global];Path to logfilelogfile=/var/log/suphp.log;Loglevelloglevel=warn;User Apache is running aswebserver_user=nobody;Path all scripts have to be indocroot=/; Security optionsallow_file_group_writeable=falseallow_file_others_writeable=falseallow_directory_group_writeable=falseallow_directory_others_writeable=false;Check wheter script is within DOCUMENT_ROOT check_vhost_docroot=false;Send minor error messages to browsererrors_to_browser=false;PATH environment variableenv_path=/bin:/usr/bin;Umask to set, specify in octal notationumask=0022;Minimum UIDmin_uid=500;Minimum GIDmin_gid=500[handlers];Handler for php-scriptsx-httpd-php5="php:/usr/local/php5/bin/php-cgi";Handler for CGI-scriptsx-suphp-cgi="execute:!self"ls -l /usr/local/apache/modules/vi /usr/local/apache/conf/httpd.conf在# Example:# LoadModule foo_module modules/mod_foo.so#下面添加:LoadModule suphp_module modules/mod_suphp.so<IfModule mod_suphp.c><FilesMatch ".(php|php5)$">AddHandler x-httpd-php5 .php .php5</FilesMatch><Location />suPHP_Engine onsuPHP_ConfigPath /usr/local/php5/lib/suPHP_AddHandler x-httpd-php5</Location>killall -9 httpd;service httpd restartcd /usr/local/apache/confvi extra/httpd-vhosts.conf<VirtualHost *:80>ServerAdmin newphp@DocumentRoot /opt/web/defaultServerName localhostErrorLog /domlogs/localhost.errorCustomLog "|/usr/local/sbin/cronolog /domlogs/localhost.%Y%m%d" combined <Directory /opt/web/default>Options +Includes -IndexessuPHP_Engine ONsuPHP_UserGroup webapps webapps</Directory></VirtualHost>cd /opt/web/defaultchmod 711 ..echo "Apache runing" > index.htmlcurl -s http://localhost/*测试Apache运行成功*/cd –wget /iProber.php -O index.phpchown webapps.webapps . -Rchown webapps.webapps /opt/web –R文件夹755,文件644chmod 755 /opt/web -Rcd /opt/installd/cd ZendOptimizer-3.3.3-linux-glibc23-i386 /*安装zend开始*/./install/usr/local/php5/lib /*填写安装位置*//*在选择Apache选择NO*/ls -l /usr/local/php5/lib/php.iniunlink /usr/local/php5/lib/php.inicp /usr/local/Zend/etc/php.ini /usr/local/php5/lib/php.ini /*安装zend结束*/ mysqladmin -u root password "密码"curl -I http://localhost/cd /domlogs/。
LAMP配置教程(修订版)
LAMP配置教程主编:张瑞祥荣誉出品目录第一章:1.1走进LAMP的世界‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥ 1 1.2 安装前准备 ‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥ 1 第二章:2.1 linux安装与配置‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥ 1 2.2 Apache安装与配置‥‥‥‥‥‥‥‥‥‥‥‥‥‥ 5 2.3 MYSQL安装与配置‥‥‥‥‥‥‥‥‥‥‥‥‥‥ 6 2.4 PHP 安装与配置‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥‥ 71.1走进LAMP的世界LAMP是一个缩写,是指一组通常一起使用来运行动态网站或者服务器的自由软件。
本教程LAMP指:linux+apache+mysql+php。
LAMP环境是现在主流PHP的环境,虽然PHP在windows里面也能使用apache或者iis 搭建起运行环境,但是有些PHP函数的调用或者部分功能,由于windows系统中运行而不能实现。
所以对于有一定经验PHP开发人员或服务器管理员。
有必要学习怎么自主搭建LAMP环境。
1.2 安装前准备今天我们就来一步步的实现LAMP的搭建,我们使用的系统是Redhat linux 9。
由于Redhat linux 9自带的Apache、Mysql、libxml2和PHP的版本太老了,有些比较新的PHP的程序不能安装或正常运行。
我们全部使用外带包。
安装必备软件包:软件名称: 官方网站:httpd-2.2.8.tar.gz /Libxml2-2.7.1.tar.gz 使用搜索引擎直接搜索该版本下载Mysql-5.0.91.tar.gz /PHP-5.2.5.tar.gz /2.1 linux安装与配置Redhat linux 9使用图形化界面安装还是比较简单的。
无论是从光盘安装,还是从硬盘安装,我们都可以方便地进入正式的安装过程。
让我们来看看安装过程中几个重要的地方。
1.选择系统默认语言RedHat支持世界上几乎所有国家的语言,这里只要在简体中文前面打上钩,并将系统默认语言选择为简体中文,那么在安装过程结束,系统启动后,整个操作系统的界面都将是简体中文的了,用户不用做任何额外的中文化操作和设置。
lamp安装文档
Lamp安装文档1.安装顺序路径和版本(具体配置因内核版本而异)1.mysql /usr/local/mysql mysql-5.1.46.tar.gz2.apache /usr/local/apache2 httpd-2.2.11.tar.gz3.zlib /usr/local/zlib zlib-1.2.5.tar.gz4.libpng libpng-1.4.2.tar.gz5.freetype /usr/local/freetype freetype-2.3.9.tar.bz26.jpeg8 /usr/local/jpeg8 jpegsrc.v8a.tar.gz7.autoconf /usr autoconf-2.61.tar.gz8.gd2 /usr/local/gd2 gd-2.0.35.tar.bz29.curl /usr/local/curl curl-7.20.1.tar.gz10.libxml2 /usr/local/libxml2 libxml2-2.6.30.tar.gz11.libxslt /usr/local/libxslt libxslt-1.1.22.tar.gz12.php /usr/local/php php-5.2.13.tar.gz13.zend /usr/local/zend ZendOptimizer-3.3.0-linux-glibc23-i386.tar.gz注意:php5.0以后的版本要求libxml2 在2.6.0版本以上Zlib 在 1.0.9版本以上默认将这些包放入/usr/local/src中,一下安装都是默认用户在改目录下的操作2.开始安装安装mysql1.创建mysql组和mysql用户# groupadd mysql# useradd –g mysql –M –s /sbin/nologin mysql //-M不创建用户主目录,-s 用户不能登录系统2.# tar zxvf mysql-5.1.46.tar.gz // gunzip < mysql-VERSION.tar.gz | tar -xvf若是.tar.bz2 tar jxvf xxx.tar.bz2 解压bz2包bunzip2 xxx.tar.bz2-3.# cd mysql-5.1.464.# ./configure --prefix=/usr/local/mysql--localstatedir=/usr/local/mysql/data //指定数据库data和日志的存储目录//默认为prefix/var--enable-assembler //允许使用汇编模式(优化性能)--with-mysqld-user=mysql // 指定mysql的运行用户--with-pthread //强制使用标准接口的线程库--with-extra-charsets=all--with-mysqld-ldflags=-all-static //服务器使用静态链接库(优化新能)--with-client-ldflags=-all-static //客户端使用静态链接库(优化性能)--with-comment //注释复杂的环境--with-big-tables //在32位平台下支持4G的表--with-max-indexes=64 // 单表设定索引的最大数目,默认64--enable-static //建立静态链接库默认yes//使用的时候要注意,很可能引起错误--with-unix-socket-path=/usr/local/mysql/mysql.sock //指定mysql的mysql.sock 默认安装/tmp 在f中可以指定--with-server-suffix=xx //添加值到版本字符串中5.# make6.# make install7.# cp support-files/f /etc/f //拷贝配置文件到/etc8.# bin/mysql_install_db --user=mysql //生成初始化授权表9.# chown –R root:mysql . //更改当前目录下的所有文件的用户组为mysql ,用户为root10.# chown –R mysql data //数据的拥有者改为mysql11.# /usr/local/mysql/bin/mysqld_safe –user=mysql & //后台启动服务用mysql用户Can't connect to local MySQL server through socket '/tmp/mysql.sock'如果出现该提示,说明mysql服务没有正常启动,因为mysql服务启动的话,会自动生成mysql.sock文件# killall mysql 杀死进程#ps –aux | grepmysql 查看当前mysql的运行进程,在启动的时候要将所有已经存在的进程杀死才能正常启动服务。
lamp技术文档
lamp技术文档第一步:准备好lamp技术所需要的软件包mysqlhttpdphpzend optimizer第二步:将以上下载后的包通过传输工具传到服务器里去(/usr/local/src我们这里放到此目录)第三步:安装编译mysql httpd php zend1.安装mysql#groupadd mysql#useradd -g mysql mysql#cd /usr/local/src/#tar -zxvf mysql-版本号.tar.gz#cd mysql-版本号#./configure --prefix=/usr/local/mysql#make#make install#cp support-files/f /etc/f#cd /usr/local/mysql#bin/mysql_install_db --user=mysql#chown -R root .#chown -R mysql var#chown -R mysql .#bin/mysqld_safe --user=mysql &以上就是编译安装mysql测试mysql是否已经安装成功#cd /usr/local/mysql/bin#./mysql如果出现mysql>那说明已经成功安装mysql2.安装apache和php#cd /usr/local/src/#tar -zxvf httpd-版本号-.tar.gz#cd httpd-版本号#./configure --prefix=/usr/local/apache –enable-rewrite --enable-so --with-expat=builtin(注:此选项是64位操作系统才加)#make#make install#cd /usr/local/src/#tar -zxvf php-版本号.tar.gz#cd php-版本号.tar.gz#./configure --with-apxs2=/usr/local/apache/bin/apxs--with-mysql=/usr/local/mysql --with-gd --with-zlib--with-freetype-dir --with-jpeg-dir --with-png-dir--enable-mbstring=all#make#make install#cp php.ini-dist /usr/local/lib/php.ini#cd /usr/local/apache/conf/#vi httpd.confAddType application/x-httpd-php .php .phtmlAddType application/x-httpd-php-source .phps加入此两行在directory模块中添加 index.php index.htm用:wq命令保存退出最后重启apache#cd /usr/local/apache/bin#./apachectl start第三步:安装zend#cd /usr/local/src#tar -zxvf zend-版本号.tar.gz#cd zend-版本号#./install默认确定即可!至少环境配置已经完成!用echo “/usr/local/apache/bin/apachectl start&” >>/ect/rc.localecho “/usr/local/mysql/bin/mysqld_safe --user=mysql &” >>/ect/rc.local命令使apache、mysql开机自动启动;。
LAMP搭建
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动
重启服务, systemctl restart httpd.service
输入localhost
出现test123之后代表已经安装上去了。
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
#停止firewall服务
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
#安装
yum install iptables-services
#编辑防火墙配置文件
vi /etc/sysconfig/iptables
# yum install mysql-community-server
安装完成后重启mysql, systemctl restarat mysqld.service
初入安装 root用户没有密码:
[root@linuxidc-web linuxidc]# mysql -u root
#设置msyql密码为 123456
mysql> set password for 'root'@'localhost' =password('123456');
LAMP配置详解
LAMP配置详解,具体配置过程LAMP配置详解,具体配置过程声明:本教程经过在RedHat Linux 9上测试通过(使用VM虚拟机装的linux系统)首先请下载软件包,共有9个,包括库文件,分别为:mysql_5.0.41-linux-i686.tar.gz zlib-1.2.3.tar.gz httpd-2.2.6.tar.gz libpng-1.2.8.tar.gz freetype-2.1.10.tar.gz jpegsrc.v6b.tar.gzlibxml2-2.6.11.tar.gz gd-2.0.33.tar.gz php-5.2.4.tar.gz共计9个源码包,请将下载的文件到到/root/soft目录下(soft文件夹自己建立)然后在shell或终端下输入:cd soft************************************************注意:‘//’为注释或解释,不在命令范围1、安装mysql:#tar zxvf mysql-5.0.41-linux-i686.tar.gz//等待解压#mv mysql-5.0.41-linux-i686 /usr/local/mysql#groupadd mysql#useradd -d /usr/local/mysql/data -s /sbin/nologin -g mysql mysql#cd /usr/local/mysql#./scripts/mysql_install_db --user=mysql#chown -R root .#chown -R mysql data#chown -R mysql .#./bin/mysqld_safe --user=mysql &#cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld#chmod 700 /etc/rc.d/init.d/mysqld#chkconfig --add mysqld//测试安装#/usr/local/mysql/bin/mysqladmin ping//会显示mysql alive#/usr/local/mysql/bin/mysqladmin version//会显示mysql版本#/usr/local/mysql/bin/mysql//会进入mysql命令提示符,可输入select 1+1;进行简单测试//添加root密码#/usr/local/mysql/bin/mysqladmin -uroot -p2、安装zlib-1.2.3#tar zxvf zlib-1.2.3.tar.gz#cd zlib-1.2.3#./configure --prefix=/usr/local/zlib#make#make install3、安装Apache#tar zxvf httpd-2.2.6.tar.gz#cd httpd-2.2.6#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib#make#make install//设置linux启动时同时启动apache服务#echo "/usr/local/apache/bin/apachect1 start" >> /etc/rc.d/rc.local4、安装libpng-1.2.8#tar zxvf libpng-1.2.8.tar.gz#cd libpng-1.2.8#cp scripts/makefile.linux makefile#make#make install5、安装freetype#tar -zvxf freetype-2.1.10.tar.gz#cd freetype-2.1.10#mkdir -p /usr/local/freetype#./configure --prefix=/usr/local/freetype#make;make install6、安装jpegsrc.v6b//先建立目录#mkdir -p /usr/local/jpeg6#mkdir -p /usr/local/jpeg6/bin#mkdir -p /usr/local/jpeg6/include#mkdir -p /usr/local/jpeg6/man#mkdir -p /usr/local/jpeg6man1#mkdir -p /usr/local/jpeg6/man/man1//开始安装#tar zxvf jpegsrc.v6b.tar.gz#./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static#make#make install#make install-lib7、安装libxml2#tar -zxvf libxml2-2.6.11.tar.gz#cd libxml2-2.6.11#mkdir -p /usr/local/libxml2#./configure --prefix=/usr/local/libxml2#make#make install#cp xml2-config /usr/bin//提示请按‘Y’进行确认8、安装gd库#tar -zvxf gd-2.0.33.tar.gz#mkdir -p /usr/local/gd2#cd gd-2.0.33#./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype/#make;make install9、安装php#tar zvxf php-5.2.4.tar.gz#mkdir -p /usr/local/php#cd php-5.2.4#./configure --prefix=/usr/local/php \>--with-apxs2=/usr/local/apache/bin/apxs \>--with-mysql-dir=/usr/local/mysql \>--with-xml=/sur/local/libxml2 \>--with-png=/usr/local/lib \>--with-jpeg-dir=/usr/local/jpeg6 \>--with-zlib=/usr/local/zlib \>--with-freetype=/usr/local/freetype \>--with-gd=/usr/local/gd \>--with-mysql-dir=/usr/local/mysql/bin/mysql_config \>--enable-track-vars \>--enable-soap \>--enable-mbstring=all \#make#make install#cp php.ini-dist /usr/local/php/lib/php.ini//使用vi修改httpd.conf#vi /etc/httpd/httpd.conf找到"#AddType application/x-gzip.gz.tgz"在下边加入一行:AddType application/x-httpd-php .php保存退出启动apache服务在/usr/local/apache/bin目录下输入命令:./httpd -k start到此,lamp已配置完成,可在/usr/local/apache/htdocs目录下放置php测试文件如test.php内容包含:<?phpphpinfo();?>然后在浏览器输入地址:http://localhost/test.php若显示下图,则表明配置成功这里有个问题,apache并没随系统一起启动如果提示不能连接到localhost时,请在shell里进入目录#cd /usr/local/apache/bin#./httpd -k start来启动apache,然后进行测试。
LAMP部署文档
nginx的编译安装和目录框架大致介绍,配置文件如下
server
{
listen 80;
server_name A;
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 && make && make install
4.3 # tar -zxvf libpng-1.2.8-config.tar.gz
# cd libpng-1.2.8-config
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
log_format www_s136_com '$remote_addr - $remote_user [$time_local] $request '
# make && make install
编译安装遇到的错误
1.1 configure时会报错 configure: error: mod_so can not be built as a shared DSO 去掉最后的--enable-mods=so就过去了
1.2 configure过后会有关于 mode_fcgid的错误需要安装 mod_fcgid-2.3.6.tar.gz
# cd httpd-2.2.0
# ./configure --prefix=/tool/apache2/ --enable-mods-shared='actions alias asis auth-basic authn-default authn-file authz-default authz-groupfile authz-host authz-user autoindex cgi cgid dir env include log-config mime negotiation proxy proxy-http rewrite setenvif deflate status info ssl so' --with-mpm=worker
LAMP环境配置
LAMP环境配置LAMP环境配置(已调试通过--nibull)Win2003+Apache2.2.4+MySQL5.0+PHP5.2+PHPMyAdmin+ZendStudio5.5软件版本信息:Windows Server 2003 Standard Edition sp1mysql-5.0.27-win32.zipapache_2.2.4-win32-x86-no_ssl.msiphp-5.2.0-Win32.zipphpMyAdmin-2.10.1ZendStudio-5_5_0.exe安装与配置详解:注意事项:安装过程,任何目录和文件名都不要使用空格,不要使用D:\Program Files 而要使用D:\ProgramFiles以上程序安装目录为D:\WebServerWeb站点物理目录为E:\webroot一。
安装Apache把Apache安装到D:\WebServer\Apache2目录;安装时可选8080端口,安装之后用http://localhost:8080/检测安装是否成功。
1.如果Apache不能启动,遇到133行的错误,则在D:\WebServer\Apache2.2\conf目录下;找到httpd.conf文件第133 行,查看ServerAdmin 后面有无admin@Digital,没有则加上。
格式为ServerAdmin admin@Digital2.如果Apache不能启动,右下角的图标提示:No services installed,是由于服务没有安装。
解决办法是:找到安装路径是:D:\webserver\Apache Software Foundation\Apache2.21).打开cmd定位到:D:\webserver\Apache Software Foundation\Apache2.2\bin2).输入httpd.exe -k install -n apache23).再输入net start apache2之后我们看见了成功的信息,如果之前有配置PHP5的话,就会在状态栏中出现PHP的版本信息。
LAMP 服务器安装配置
[编辑] 一.安装
首先,如果您花费一点时间熟悉一下常用的命令 会非常有帮助!
安装LAMP并没有那么神秘。 一步一步来。这比windows下面那麻烦的配置 简单多了!
[编辑] 1.安装LAMP
在新立得软件包管理器中选择 编辑--使用任务分组标记软件包
然后把下面两句的路径 改为/var/www/phpmyadmin(因为我已经配置好环境,所以忘记了phpmyadmin中默认配置怎么写的。。反正就是在第三行和第四行的两句.如果我没记错的话 应该是下面这样)
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
最后编辑php.ini
sudo gedit /etc/php5/apache2/php.ini
再最后面添加两行:
extension = pdo.so
extension = pdo_mysql.so
[编辑] GD库的安装
sudo apt-get install php5-gd
sudo gedit /etc/php5/apache2/php.ini
在extension下面加上
extension=php5-mcrypt.so
保存,重启apache2
n
[编辑] 二.配置
1>apache 的配置文件路径 /etc/apache2/apache2.conf
[编辑] 至此 LAMP环境配置成功,试一下 phpinfo(); 吧!
LAMP并没有那么神秘!除去下载的时间,整个配置过程决不会花费您五分钟。
lamp安装与配置
[root@localhost ~]# cd /media/RHEL_5.5\ i386\ DVD/Server/一安装APACHE[root@localhost Server]# ls http*httpd-2.2.3-43.el5.i386.rpm httpd-manual-2.2.3-43.el5.i386.rpmhttpd-devel-2.2.3-43.el5.i386.rpm[root@localhost Server]# rpm -ivh httpd-2.2.3-43.el5.i386.rpmwarning: httpd-2.2.3-43.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies:libapr-1.so.0 is needed by httpd-2.2.3-43.el5.i386libaprutil-1.so.0 is needed by httpd-2.2.3-43.el5.i386[root@localhost Server]# ls apr*apr-1.2.7-11.el5_3.1.i386.rpm apr-util-devel-1.2.7-11.el5.i386.rpmapr-devel-1.2.7-11.el5_3.1.i386.rpm apr-util-docs-1.2.7-11.el5.i386.rpmapr-docs-1.2.7-11.el5_3.1.i386.rpm apr-util-mysql-1.2.7-11.el5.i386.rpmapr-util-1.2.7-11.el5.i386.rpm[root@localhost Server]# rpm -ivh apr-1.2.7-11.el5_3.1.i386.rpmwarning: apr-1.2.7-11.el5_3.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:apr ########################################### [100%] [root@localhost Server]# rpm -ivh apr-util-1.2.7-11.el5.i386.rpmwarning: apr-util-1.2.7-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies:libpq.so.4 is needed by apr-util-1.2.7-11.el5.i386[root@localhost Server]# ls *p*q*[root@localhost Server]# rpm -ivh postgresql-libs-8.1.18-2.el5_4.1.i386.rpmwarning: postgresql-libs-8.1.18-2.el5_4.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:postgresql-libs ########################################### [100%] [root@localhost Server]# rpm -ivh apr-util-1.2.7-11.el5.i386.rpmwarning: apr-util-1.2.7-11.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:apr-util ########################################### [100%][root@localhost Server]# rpm -ivh httpd-2.2.3-43.el5.i386.rpmwarning: httpd-2.2.3-43.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:httpd ########################################### [100%]二安装MYSQL和MYSQL-SERVER1 mysql[root@localhost Server]# rpm -ivh mysql-5.0.77-4.el5_4.2.i386.rpmwarning: mysql-5.0.77-4.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies:perl(DBI) is needed by mysql-5.0.77-4.el5_4.2.i386[root@localhost Server]# ls *DBI*perl-DBI-1.52-2.el5.i386.rpm[root@localhost Server]# rpm -ivh perl-DBI-1.52-2.el5.i386.rpmwarning: perl-DBI-1.52-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:perl-DBI ########################################### [100%] [root@localhost Server]# rpm -ivh mysql-5.0.77-4.el5_4.2.i386.rpmwarning: mysql-5.0.77-4.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:mysql ########################################### [100%]2 mysql-server[root@localhost Server]# rpm -ivh mysql-server-5.0.77-4.el5_4.2.i386.rpmwarning: mysql-server-5.0.77-4.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186error: Failed dependencies:perl-DBD-MySQL is needed by mysql-server-5.0.77-4.el5_4.2.i386[root@localhost Server]# rpm -ivh perl-DBD-MySQL-3.0007-2.el5.i386.rpmwarning: perl-DBD-MySQL-3.0007-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:perl-DBD-MySQL ########################################### [100%] [root@localhost Server]# rpm -ivh mysql-server-5.0.77-4.el5_4.2.i386.rpmwarning: mysql-server-5.0.77-4.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:mysql-server ########################################### [100%]三安装php[root@localhost Server]# ls php*php-5.1.6-27.el5.i386.rpm php-mysql-5.1.6-27.el5.i386.rpmphp-bcmath-5.1.6-27.el5.i386.rpm php-ncurses-5.1.6-27.el5.i386.rpmphp-cli-5.1.6-27.el5.i386.rpm php-odbc-5.1.6-27.el5.i386.rpmphp-common-5.1.6-27.el5.i386.rpm php-pdo-5.1.6-27.el5.i386.rpmphp-dba-5.1.6-27.el5.i386.rpm php-pear-1.4.9-6.el5.noarch.rpmphp-devel-5.1.6-27.el5.i386.rpm php-pgsql-5.1.6-27.el5.i386.rpmphp-gd-5.1.6-27.el5.i386.rpm php-snmp-5.1.6-27.el5.i386.rpmphp-imap-5.1.6-27.el5.i386.rpm php-soap-5.1.6-27.el5.i386.rpmphp-ldap-5.1.6-27.el5.i386.rpm php-xml-5.1.6-27.el5.i386.rpmphp-mbstring-5.1.6-27.el5.i386.rpm php-xmlrpc-5.1.6-27.el5.i386.rpm[root@localhost Server]# rpm -ivh php-5.1.6-27.el5.i386.rpmwarning: php-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies:libgmp.so.3 is needed by php-5.1.6-27.el5.i386php-cli = 5.1.6-27.el5 is needed by php-5.1.6-27.el5.i386php-common = 5.1.6-27.el5 is needed by php-5.1.6-27.el5.i386[root@localhost Server]# rpm -ivh php-common-5.1.6-27.el5.i386.rpmwarning: php-common-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing... ########################################### [100%] 1:php-common ########################################### [100%] [root@localhost Server]# rpm -ivh php-cli-5.1.6-27.el5.i386.rpmwarning: php-cli-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies:libgmp.so.3 is needed by php-cli-5.1.6-27.el5.i386[root@localhost Server]# rpm -ivh gmp-gmp-4.1.4-10.el5.i386.rpm gmp-devel-4.1.4-10.el5.i386.rpm[root@localhost Server]# rpm -ivh gmp-4.1.4-10.el5.i386.rpmwarning: gmp-4.1.4-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:gmp ########################################### [100%] [root@localhost Server]# rpm -ivh php-cli-5.1.6-27.el5.i386.rpmwarning: php-cli-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:php-cli ########################################### [100%]安装PHP-MYSQL[root@localhost Server]# rpm -ivh php-mysql-5.1.6-27.el5.i386.rpmwarning: php-mysql-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies:php-pdo is needed by php-mysql-5.1.6-27.el5.i386[root@localhost Server]# rpm -ivh php-pdo-5.1.6-27.el5.i386.rpmwarning: php-pdo-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:php-pdo ########################################### [100%] [root@localhost Server]# rpm -ivh php-mysql-5.1.6-27.el5.i386.rpmwarning: php-mysql-5.1.6-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:php-mysql ########################################### [100%]。
LAMP设置文档
Linux+apache +mysql +php设置文档一.配置mysql1.进入m y s q l源码目录:c d/u s r/t o o l s2.执行g r o u p a d d m y s q l3.执行u s e r a d d-g m y s q l m y s q l4.执行t a r-z x v f m y s q l-5.0.22.t a r.g z5.执行c d m y s q l-5.0.226.执行./c o n f i g u r e--p r e f i x=/s e r v e r/m y s q l--w i t h-c h a r s e t=g b k --w i t h-e x t r a-c h a r s e t s=a l l7.m a k e8.m a k e i n s t a l l9.c p s u p p o r t-f i l e s/m y-m e d i u m.c n f/e t c/m y.c n f或者c p/o p t/m y s q l/s h a r e/m y s q l/m y-m ed i u m.c n f/e t c/m y.c n f10../s c r i p t s/m y s q l_i n s t a l l_d b--u s e r=m y s q l//初试化表并且规定用m y s q l用户来访问。
初始化表以后就开始给m y s q l和r o o t用户设定访问权限11.执行c p s u p p o r t-f i l e s/m y s q l.s e r v e r/e t c/r c.d/i n i t.d/m y s q l d12.执行c h m o d700/e t c/r c.d/i n i t.d/m y s q l d13.执行c h k c o n f i g--a d d m y s q l d14.进入m y s q l安装目录.c d/s e r v e r/m y s q l15.设置用户权限#c h o w n-R r o o t.#c h o w n-R m y s q l v a r#c h o w n-R m y s q l v a r/.#c h g r p-R m y s q l.#c h k c o n f i g--a d d m y s q l d#s e r v i c e m y s q l d s t a r t#n e t s t a t-a t l n查看m y s q l端口3306是否打开,如果打开说明安装成功更改r o o t用户密码【注:可选该操作】#./b i n/m y s q l a d m i n-u r o o t p a s s w o r d'n e w p a s s w d'16.操作m y s q l基本命令u s e库名;切换库名c r e a t e t a b l e表名(字段设定列表);创建表c r e a t ed a t a b a s e库名;创建数据库二.安装、配置apache先安装a p a c h e服务器H t t p d-2.0.59.t a r解压安装:[/u s r/l o c a l/s r c]#t a r x z v f h t t p d-2.0.59.t a r[/u s r/l o c a l/s r c]#c d h t t p d-2.0.59编译前的配置,并指定a p a c h e的安装路径#./c o n f i g u r e--p r e f i x=/s e r v e r/a p a c h e--e n a b l e-s o --e n a b l e-r e w r i t e编译[/u s r/l o c a l/s r c/h t t p d-2.0.59]#m a k e安装[/u s r/l o c a l/s r c/h t t p d-2.0.59]#m a k e i n s t a l l修改配置文件#v i/e t c/r c.l o c a l添加:/s e r v e r/a p a c h e/b i n/a p a c h e c t l s t a r t//让系统系统时自动启动a p a c h e服务#v i/s e r v e r/a p a c h e/c o n f/h t t p d.c o n f//编辑主配置文件将#S e r v e r N a m e修改为S e r v e r N a m e(服务器的i p地址或域名)并把该行内容前的#号去掉保存退出#/s e r v e r/a p a c h e/b i n/a p a c h e c t l s t a r t//运行a p a c h e验证安装:在W i n d o w s主机进行验证,(注:之前在L i n u x主机上已经做好了D N S S e r v e r,所以可以在W i n d o w s主机上把D N S服务器的地址设置成为L i n u x主机的I P 地址,并打开I E输入h t t p://w w w.c a t.c o m进行验证。
002.LAMP环境简明手册
Contents第1章LAMP服务器安装 (4)1.1 Linux服务器的安装 (4)1.2 LAMP软件包安装 (6)1.2.1 Apache安装 (7)1.2.2 Mysql安装 (8)1.2.3 PHP安装 (9)1.2.4 其它需要安装的软件包 (10)1.3 LAMP源代码安装 (12)第2章LAMP开发环境搭建 (13)2.1 Windows下php环境搭建 (13)2.2 开发工具 (14)2.2.1 源码编辑器notepad++ (14)2.2.1 远程登录工具putty (15)2.2.1 文件传输工具WinSCP (16)2.2.1 文件比较工具Beyond Compare (16)2.2.1 版本管理工具TortoiseSVN (17)2.3 Zend Studio集成开发环境 (18)第3章Apache配置 (19)3.1 Apache配置目录结构 (19)3.2 虚拟主机配置 (19)3.3 https的设置 (21)附录1 WEB服务器的选择 (22)第1章LAMP服务器安装本教程介绍的是在虚拟机下搭建LAMP环境,采用的虚拟机软件是VMware Player,它是VMware公司提供的一个免费软件,可以自由在VMware网站上下载。
虚拟机模拟出一个单独的计算机环境,在虚拟机下运行一个操作系统,几乎跟在真实的计算机下没有任何区别。
早期版本的VMware Player不能新建虚拟机,需要最新的版本才行,本教程采用的VMware Player的版本为3.0.0(/products/player/)。
1.1 Linux服务器的安装本教程采用的Linux版本为Ubuntu 9.10 Server版本,光盘镜像文件下载地址:/releases/karmic/ubuntu-9.10-server-i386.iso下载后可以刻成光盘,在VMware下,可以直接使用光盘镜像文件安装。
LAMP文档
大纲:一、系统安装二、编译安装基本环境三、配置虚拟主机及基本性能调优四、基本安全设置五、附录及相关介绍一、系统约定二、系统环境部署及调整1. 检查系统是否正常(责任编辑:zehoa)# more /var/log/messages (检查有无系统内核级错误信息)# dmesg (检查硬件设备是否有错误信息)# ifconfig (检查网卡设置是否正确)# ping (检查网# more /var/log/messages(检查有无系统内核级错误信息)# dmesg (检查硬件设备是否有错误信息)# ifconfig(检查网卡设置是否正确)# ping (检查网络是否正常)2. 关闭不需要的服务# ntsysv以下仅列出需要启动的服务,未列出的服务一律关闭:crond crond是Unix下的一个传统程序,该程序周期地运行用户调度的任务。
比起传统的Unix版本,Vixie版本添加了不少属性,而且更安全,配置更简单仅当服务器CPU为S.M.P架构或支持双核心、HT技术时,才需开启,否则关闭microcode_ctl 可以编码以及发送新的微代码到kernel以更新Intel IA32系列处理器mysql 一个快速高效可靠的轻型SQL数据库引擎network 激活/关闭启动时的各个网络接口网络。
random 保存和恢复系统的高质量随机数生成器,这些随机数是系统一些随机行为提供的。
sendmail邮件服务器sshd是 OpenSSH守护进程。
用于在不可信网络上提供安全的连接通道。
Syslog syslog是操作系统提供的一种机制,守护程序通常使用这种机制将各种信息写到各个系统日志文件。
通常应该启动该服务3. 对TCP/IP网络参数进行调整,加强抗SYN Flood能力# echo 'net.ipv4.tcp_syncookies = 1' >> /etc/sysctl.conf# sysctl -p4. 配置yum,导入 CentOS RPM-GPG-KEY#rpm--import /centos/RPM-GPG-KEY-CentOS-5 Or rpm –import /etc/pki/rpm-gpg/ RPM-GPG-KEY-CentOS-5# yum list | tee /etc/yum.list5. 重新启动系统# init 66. 使用 yum 程序安装所需开发包(以下为标准的 RPM 包名称)#yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devellibpng-devel libtiff-devel freetype-devel libXpm-develgettext-devel pam-devel kernel7. 定时校正服务器时钟,定时与中国国家授时中心授时服务器同步# crontab -e加入一行:15 3 * * * /usr/sbin/ntpdate 210.72.145.44 > /dev/null 2>&18. 源码编译安装所需包(Source)(1) GD2gd库是php处理图形的扩展库,gd库提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
主要软件包,
1. httpd-2.2.6.tar.gz
2. mysql-5.0.45-linux-i686-glibc23.tar.gz ( 这个版本是已编译好的压缩包,解压后稍做配置即可使用 )
用浏览器查看 http://localhost, 得到 it works ,说明 apache 已经配置成功了 .
# /usr/local/apache2/bin/apachectl -k stop // 停止 apache
五:安装 php5 , php5 必须有 libxml2 支持 !
>--enable-soap --with-xsl=/usr/local/libxslt
# make
# make install
# cp php.ini-dist /usr/local/php5/php.ini (别忘记了呵呵)
六:重新配置 apache2 让他支持 php
# ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
# make
# make install
# /usr/local/apache2/bin/apachectl -k start // 启动 apahce
# mkdir -p /usr/local/jpeg6/man/man1
# cd /root/Software/
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg6
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
4. libpng-(version).tar.gz ---> /pub/png/libpng.html
5. zlib-1.2.3.tar.gz --->
把以上所有软件包下载到: /root/Software/ 目录下 .
# cp /usr/local/mysql/support-files/f /etc/f
添加 mysql 用户及用户组
# groupadd mysql
# useradd -g mysql mysql
修改 mysql 目录权限
# chown -R root /usr/local/mysql
# make
# make install
b.libpng 包 ( 支持 PNG)
# cd /root/Software/
# tar -zvxf libpng-(version).tar.gz
# cd libpng-(version)
# ./configure --prefix=/usr/local/libpng
>--enable-trace-vars --with-mysql=/usr/local/mysql \
>--enable-mbstring=all --with-curl=/usr/local/curl --enable-mbregex \
>--with-config-file-path=/usr/local/php5 --enable-ftp \
GD 库所需要软件包(有人说 PHP 源码包里自带了 GD2.0.28 和 zlib ,只要安装 GD 的三个支持包: jpg,png 和 freetype ,但是我们还是下载)
1. gd-(version).tar.gz ---> /Main_Page or /releases/
# make
# make install
e. 安装 Curl 库
# cd /root/Software/
# tar -zxf curl-(version).tar.gz
# mkdir -p /usr/local/curl
# ./configure --prefix=/usr/local/curl
>--with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6 \
>--with-zlib-dir=/usr/local/zlib \
>--with-png-dir=/usr/local/libpng \
>--with-freetype-dir=/usr/local/freetype -\
# make
# make install
b. 安装 libxslt ( 可选安装,你可以不安装 )
# cd /root/Software/
# tar -zvxf libxslt-(version).tar.gz
# mkdir -p /usr/local/libxslt
3. php-5.2.5.tar.gz
安装 php 所需的软件包(其中 libxml2 是安装 php5 必须的 . )
1. libxml2-(version).tar.gz ---> /pub/GNOME/sources/libxm2
# /usr/local/mysql/bin/mysqladmin -u root -p password "123456"
三:安装 GD 库 ( 让 PHP 支持 GIF,PNG,JPEG)
a. 安装 jpeg6 建立目录:
# mkdir -p /usr/local/jpeg6
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
生成 mysql 系统数据库
# /usr/local/mysql/scripts/mysql_install_db --user=mysql& // 启动 mysql 服务
# make
# make install
四:安装 apache2
# cd /roo/Software/
# tar -zvxf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
ቤተ መጻሕፍቲ ባይዱ
# mkdir -p /usr/local/apache2
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
如出现 Starting mysqld daemon with databases from /usr/local/mysql/data 代表正常启动 mysql 服务了 .
按 Ctrl + C 跳出修改 mysql 的 root 密码
# make
#> make install
c. 安装 freetype
# cd /root/Software/
# tar -zvxf freetype-(version).tar.gz
# cd freetype-(version)
# mkdir -p /usr/local/freetype
# cd /root/Software/
# tar -zvxf php-(version).tar.gz
# mkdir -p /usr/local/php5
# cd php-(version)
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs \
2. freetype-(version).tar.gz ---> /projects/freetype
3. jpegsrc.v6b.tar.gz ---> /files/jpegsrc.v6b.tar.gz
# 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/gd2
# cd gd-(version)
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-zlib-dir=/usr/local/zlib --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make
# make install
d. 安装 zlib
# cd /root/Software/
# tar -zxvf zlib-1.2.3.tar.gz
# cd zlib.1.2.3
a. 安装 libxml2
# cd /root/Software/
# tar -zvxf libxml2-(version).tar.gz
# cd libxml2-(version)
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2