17692620657
13910745184
燕郊上门维修电脑 维修电脑电话:17692620657
您的位置:首页 > 新闻动态 > 企业新闻 >

新闻动态

联系我们

燕郊电脑维修公司

地址:燕郊天洋城广场
手机:13910745184

咨询热线17692620657

RHEL4.X下源码搭建LAMP服务器

发布时间:2019-05-07 21:17人气:

RHEL4.X下源码搭建LAMP服务器
 
首先,系统为干净的系统 未安装apache mysql php等程序
 
(1).安装gd库
 
tar zxvf gd-2.0.35.tar.gz
 
cd gd-2.0.35
 
./configure --prefix=/web/gd
 
必须显示png jpeg freetype 状态为yes 说明编译正确,否则需要查找问题
 
make
 
make install
 
 
(2).apache
 
./configure --prefix=/web/apache --with-ssl --enable-ssl --enable-so --enable-rewrite --disable-cgid --disable-cgi
 
将apache设置成开机自启动的两种方法:
 
a.在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache2/bin/apachectl start
这样每次重启以后apache也会随系统一起启动
 
b.或者将apache安装为系统服务
#cp /web/apache/bin/apachectl /etc/rc.d/init.d/httpd
然后vi /etc/rc.d/init.d/httpd添加(#!/bin/sh下面)
#chkconfig:2345 10 90
#description:Activates/Deactivates Apache Web Server
最后,运行chkconfig把Apache 添加到系统的启动服务组里面
#chkconfig --add httpd
#chkconfig httpd on
 
 
(3).mysql5
 
./configure --prefix=/web/mysql --with-comment=Source --with-server-suffix=-enterprise-gpl --with-mysqld-user=mysql --without-debug --with-socket-path=/myweb/mysql/var/mysql.sock --with-big-tables --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug --without-isam --enable-local-infile --with-readline --with-raid
 
make
 
make install
 
groupadd mysql
 
useradd -g mysql mysql
 
cd /web/mysql
 
chown -R mysql .  //修改用户
 
chgrp -R mysql .  //修改用户组
 
bin/mysql_install_db --user=mysql //安装基本库
 
chown -R root .
 
chown -R mysql var
 
cp share/mysql/my-medium.cnf /etc/my.cnf
 
cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
 
chmod 755 /etc/rc.d/init.d/mysqld
 
chkconfig --add mysqld
 
chkconfig --level 3 mysqld on
 
/etc/rc.d/init.d/mysqld start
 
bin/mysqladmin -u root password 123456
 
http://www.yyblog.com.cn/post/76.html
 
 
(4).安装php5
 
./configure --prefix=/web/php --with-apxs2=/web/apache/bin/apxs --with-zlib-dir --with-bz2 --with-libxml-dir --with-gd=/web/gd --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/web/mysql --with-config-file-path=/etc --with-iconv --disable-ipv6 --enable-static --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap --with-openssl --with-gettext --enable-ftp
 
make 
 
make install
 
cp php.ini-recommended /etc/php.ini
 
 
 
 
 
 
 
 
(5).整合apache与php
#vi /web/apache/conf/httpd.conf
找到DocumentRoot "/web/websit"
 
把它变成自己的服务目录
 
找到AddType application/x-gzip .gz .tgz在其下面加如下内容
AddType application/x-httpd-php .php
 
查找(设置WEB默认文件)
Directorylndex index.html
修改为
Directorylindex index.php index.html index.htm
 
找到这一段
#AllowOverride controls what directives may be placed in.htaccess files.
#Options Fileinfo AuthConfig Limit
#
AllowOverride none
更改为AllowOwerride all
允许appache rewrite
 
保存httpd.conf 退出
 
 
(6).zend安装
tar zxvf zend.tar.gz
 
cd zend
 
./install.sh
 
修改安装目录
 
指定php.ini的地址
 
指定apache 的apachectl的目录
 
重启apache显示安装成功
 
zend的作用主要是使php运行更加安全,无法提高php的速度更高。eaccelerator可以使效率更高
 
 
(7).eaccelerator-0.9.5.2.tar.bz2的安装
 
tar jxvf eaccelerator-0.9.5.2.tar.bz2
 
cd eaccelerator-0.9.5.2
 
export PHP_PREFIX="/web/php"  //加载php的安装目录
 
$PHP_PREFIX/bin/phpize        //显示php,zend的版本
 
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
 
make
 
make install
 
编译安装后我们会看到屏幕提示的eaccelerator.so所在的目录,php5.2X系列是在
/web/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so
 
/web/php/lib/php/extensions/no-debug-non-zts-20060613/
 
安装完毕,配置
 
在zend的安装目录下,打开php.ini
在文件最后,[zend]的下一行加入如下的代码
zend_extension="/web/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
 
然后
#mkdir /tmp/eaccelerator   //创建目录
#chmod 777 /tmp/eaccelerator //修改目录权限
 
注意:以上配置默认情况下,iptables已经开放80端口,selinux为允许模式,如果为强制模式,而网站代码不在apache中默认的位置,则需要设置web路径的上下文设置即用到chcon 命令

推荐资讯

17692620657