设为首页 收藏本站
查看: 813|回复: 0

[经验分享] centos 5.2中安装LAMP

[复制链接]

尚未签到

发表于 2016-5-10 12:25:00 | 显示全部楼层 |阅读模式
  wget至以下目录:/tmp

----------------------
网站如下:
http://www.apache.org
http://www.php.net
http://www.mysql.com

http://www.shanghuo.net/?action=show&id=241
http://blog.iyunv.com/u/249/showart_1842843.html
版本:
httpd-2.2.11.tar.gz
php-5.2.9.tar.gz
mysql-5.1.31.tar.gz
ZendOptimizer-3.3.3
phpMyAdmin-3.1.3.tar.gz



apache:
wget http://apache.freelamp.com/httpd/httpd-2.2.11.tar.gz
php :wget http://cn2.php.net/get/php-5.2.9.tar.gz/from/cn.php.net/mirror
mysql:wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.31.tar.gz/from/http://mysql.easynet.be/

Zend Optimizer v3.3:
wget http://downloads.phpchina.com/zend/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

phpmyadmin:
wget http://nchc.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-3.1.3-all-languages.tar.gz

proftpd:
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++

1、mysql
#wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.31.tar.gz/from/http://mysql.easynet.be/
#tar -zxvf mysql-5.1.31.tar.gz
#cd mysql-5.1.31
#./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=all --enable-assembler --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
#make;make install
#groupadd mysql
#useradd -g mysql mysql
#cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
#sed -i 's/skip-federated/#skip-federated/g' /etc/my.cnf
#/usr/local/mysql/bin/mysql_install_db --user=mysql
#chmod +w /usr/local/mysql
#chown -R mysql /usr/local/mysql/var
#chgrp -R mysql /usr/local/mysql/.
#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
#chmod 755 /etc/init.d/mysql
#chkconfig --level 345 mysql on
#service mysql start

# /usr/local/mysql/bin/mysqladmin -u root -p password
设置root密码,但出错:mysql“Access denied for user 'root'@'localhost'”
解决:

#/etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &;
#mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

mysql>

加入环境变量:

export PATH=$PATH:/usr/local/mysql/bin //临时修改的

若要永久生效
#echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile //永久修改的
#source /etc/profile

2、apache
#tar -zxf httpd-2.2.11.tar.gz
#cd httpd-2.2.11
#./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite
#make; make install
安装完后
# vi /usr/local/apache/conf/httpd.conf
找到 prefork.c 下的
MaxClients 150
改为
ServerLimit 2000
MaxClients 1000
apache默认工作在prefork.c模式下,并发进程为150,超过后就无法访问,150是远远不够的,所以这里按自己网站的需求改, 如1000
由于apache默认最大并发进程是 256 所以要先设置 ServerLimit 2000 将服务器可设的最大并发数设为2000, 然后再设置最大并发数 MaxClients 1000

找到 #ServerName www.example.com:80 在其下设置 ServerName 如下
ServerName www.mysite.com
基中 www.mysite.com 为你网站名,也可用IP代替
找到 DocumentRoot "/usr/local/apache/htdocs"
设置你的 WEB 服务器的根目录 如
DocumentRoot "/myweb"
找到 DirectoryIndex index.html index.html.var 改为
DirectoryIndex index.html index.php index.htm
找到 ForceLanguagePriority Prefer Fallback 在其下加上
AddDefaultCharset gb2312
改完后保存(vi 的用法请查 Linux vi 命令)
用下面命令启动WEB服务器
# /usr/local/apache/bin/apachectl start
查看自己的站点是否正常 http://www.mysite.com 也可用IP
用 # /usr/local/apache/bin/apachectl stop 可停止服务

此时在浏览器中试试,可能无法访问,这是因为防火墙默认设置全部禁止访问的原因,运行lokkit设置就OK了~

如何更改了目录:则:加上这一句

Order allow ,deny
Allow from all


3、PHP
安装GD库(让PHP支持GIF,PNG,JPEG)
首先下载 jpeg6,libpng,freetype 并安装模块
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.9.tar.gz
wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

安装 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 /tmp
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install

安装libpng
# cd /tmp
# tar -zxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scrīpts/makefile.std makefile
# make; make install

安装 freetype
# cd /root/soft
# tar -zxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# ./configure --prefix=/usr/local/freetype
# make;make install

安装最新的GD库
# cd /tmp
# tar -zxf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
# make; make install

由于php5需libxml2的支持, 所以先下载并安装libxml2
# cd /tmp
# wget http://ftp.gnome.org/pub/gnome/sources/libxml2/2.6/libxml2-2.6.30.tar.gz
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure --prefix=/usr/local/libxml2
# make; make install

安装 libxslt
# cd /tmp
# wget http://ftp.gnome.org/pub/gnome/sources/libxslt/1.1/libxslt-1.1.22.tar.gz
# tar -zxf libxslt-1.1.22.tar.gz
# cd libxslt-1.1.22
# ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
# make; make install

终于要安装PHP了:
# tar -zxf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --enable-ftp --with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib --with-xsl=/usr/local/libxslt --enable-xslt --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/lib --with-png --with-freetype-dir=/usr/local/freetype --enable-mbstring
# make
# make install

其中./configure 后的
--prefix=/usr/local/php5
--with-apxs2=/usr/local/apache/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
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项

配置 httpd.conf 让apache支持PHP
# vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps在你Web目录里建一内容为 PHP文件, 输入URL地址查看PHP配置是否正确

安装 phpmyadmin
下载
# tar zxvf phpMyAdmin-2.11.2-all-languages.tar.gz
# mv phpMyAdmin-2.11.2-all-languages /usr/local/httpd/htdocs/phpmyadmin
# cd /usr/local/httpd/htdocs/phpmyadmin
# cp ./libraries/config.default.php ./config.inc.php
#vi config.inc.php
$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin';
$cfg['Servers'][$i]['auth_type'] = 'http';

安装zend:
# tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# cd ZendOptimizer-3.2.2-linux-glibc21
# ./install.sh


OK,成功~!

转载:http://lifestylezhu.blogspot.com/2009/03/mysql.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-215192-1-1.html 上篇帖子: centos中安装openoffice 3.1 final 下篇帖子: CentOS笔记:svn命令行使用说明
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表