您的位置:首页 > 运维架构 > Apache

As4 下 lamp配置(linux + apache + mysql + php)

2008-07-24 14:14 295 查看
操作系统:Red Hat Enterprise Linux AS release 4 (Nahant Update 3)2.6.9-34.EL
软件版本:httpd-2.2.3.tar.gz
mysql-5.0.18.tar.gz
php-5.0.4.tar.gz

1安装mysql
shell#tar xzvf mysql-5.0.15.tar.gz
#解开安装包

shell#cd mysql-5.0.1
shell#./configrue --prefix=/usr/local/mysql
shell# make && make install
shell#make install
#进入安装目录,设置安装路径.编译并安装

shell#groupadd mysql
shell#useradd -g mysql mysql
#新建名为mysql的组,并新建名为mysql的用户,并且默认属于mysql组

shell#chgrp -R mysql /usr/local/mysql
#改变/usr/local/mysql及下属文件与目录的属组

shell#cp support-files/my-large.cnf /etc/my.cnf
#copymy-large.cnf到 /etc中,替换原有的my.cnf

shell#scripts/mysql_install_db
#建立初始数据

shell#chown -R mysql:mysql /usr/local/mysql/var
#更改var及下面的文件目录的属组与属主

shell#cp support-files/mysql.server /etc/init.d/mysqld
#copymysql.server到init.d目录中并重命名为mysqld,启动文件

shell#chmod 755 /etc/init.d/mysqld
#设置启动文件的权限有为755

shell#chkconfig --add mysqld
shell#chkconfig mysqld on
#把此服务添加到系统启动中,add为添加至/etc/rc.d/init.d中,on默认在3/5级别服务默认启动

shell#/etc/init.d/mysqld start
shell#/usr/local/mysql/bin/mysqld_safe &
启动myhsql

shell#/usr/local/mysql/bin/mysqladmin -u root password 123
默认root用户密码为空,设置密码为123

shell#/usr/local/mysql/bin/mysql -u root -p
#输入上面设置的123后.以root身份登陆

shell#./mysqladmin -u root -p password 456
#修改mysql root用户密码为456,在提示框中要输入原密码,123

mysql> grant select on test.* to 'ttt' @'%' identified by'ttt' with grant option;
#添加一个名称为ttt,密码为ttt的mysql账户,对test数据库有修改权限

2安装apache-2.2.3
shell#tar xzvf httpd-2.2.3.tar.gz
shell#cd httpd-2.2.3
shell#./configure --prefix=/usr/local/apache --enable-so
shell#make && make install
#解包设置安装信息编译安装

shell#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
#把服务cp至启动文件中

shell#chmod 755 /etc/init.d/httpd
#设置服务权限

3安装php
shell#tar xvzf php-5.0.4.tar.gz
shell#cd php-5.0.4
shell#./configure --with-mysql=/usr/local/mysql --with- apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php
shell#make && make instal
#解包设置安装信息编译安装

shell#echo AddType application/x-httpd-php .php >> /usr/local/apache/conf/httpd.conf
shell#echo AddType application/x-httpd-php .sulpx >> /usr/local/apache/conf/httpd.conf
shell#echo AddType application/x-httpd-php-source .phps >> /usr/local/apache/conf/httpd.conf
shell#echo DirectoryIndex index.php index.html index.htm index.html.var >> /usr/local/apache/conf/httpd.conf
#在http.conf中加入对php的支持

shell#/usr/local/apache/bin/apachectl start
#启动http

测试,在/usr/local/apache/htdocs 下建一文件名为test.php,内容为:<? phpinfo(); ?>,然后在打开IE输入本机IP地址查看,如显示php页面,则建立成功

网上文档:
#tar xzvf libpng-1.2.8-config.tar.gz
#tar xzvf freetype-2.1.9.tar.gz
#tar xzvf zlib-1.2.2.tar.gz
#tar xzvf gd-2.0.33.tar.gz
#tar xzvf httpd-2.0.54.tar.gz
#tar xzvf php-5.0.4.tar.gz
#tar xzvf mysql-5.0.15.tar.gz

#########default setup/change my.cnf for onlyone please
cd mysql-5.0.18
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=gbk,gb2312,big5 && make && make install
groupadd mysql
useradd -g mysql mysql
chgrp -R mysql /usr/local/mysql
cp support-files/my-large.cnf /etc/my.cnf
scripts/mysql_install_db
chown -R mysql:mysql /usr/local/mysql/var
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
/usr/local/mysql/bin/mysqld_safe &
-----------------------------

chkconfig --add mysqld
chkconfig mysqld on
------------------------------
#########support soft setup
cd /root/install/libpng-1.2.8-config
./configure && make && make install
cd /root/install/freetype-2.1.9
./configure --prefix=/usr/local/freetype-2.1.9 && make && make install
cd /root/install/zlib-1.2.2
./configure --prefix=/usr/local/zlib-1.2.2 && make && make install
cd /root/install/jpeg-6b
cp -R /root/install/jpeg-6b /usr/local/
mkdir -p /usr/local/man/man1
./configure --enable-shared --enable-static && make && make install
cd /root/install/gd-2.0.33
./configure --prefix=/usr/local/gd-2.0.33 --with-freetype=/usr/local/freetype-2.1.9 && make && make install

#########apache setup
cd /root/install/httpd-2.2.3
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite && make && make install
#rm -f /etc/init.d/httpd
#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
#chmod 755 /etc/init.d/httpd
#########php setup
cd /root/install/php-5.0.4
./configure --with-mysql=/usr/local/mysql --enable-trans-sid --enable-track-vars --with-png-dir=/usr/local/bin --with-gd=/usr/local/gd-2.0.33 --with-jpeg-dir=/usr/local/jpeg-6b --with-extension_dir=/usr/local/lib/extension --with-freetype-dir=/usr/local/freetype-2.1.9 --with-zlib-dir=/usr/local/zlib-1.2.2 --with-apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-force-cgi-redirect --disable-cgi --with-gettext --with-gdbm && make && make install
sed -e 's/variables_order = "EGPCS"/variables_order = "ECPGS"/g' -e 's/register_globals = Off/register_globals = On/g' php.ini-dist > /usr/local/php/bin/php.ini
echo AddType application/x-httpd-php .php >> /usr/local/apache/conf/httpd.conf
echo AddType application/x-httpd-php .sulpx >> /usr/local/apache/conf/httpd.conf
echo AddType application/x-httpd-php-source .phps >> /usr/local/apache/conf/httpd.conf
echo DirectoryIndex index.php index.html index.htm index.html.var >> /usr/local/apache/conf/httpd.conf
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start

./configure --with-mysql=/usr/local/mysql --enable-trans-sid --enable-track-vars --with-png-dir=/usr/local/libpng-1.2.5 --with-gd=/usr/local/gd-2.0.33 --with-jpeg-dir=/usr/local/jpeg-6b --with-extension_dir=/usr/local/lib/extension --with-freetype-dir=/usr/local/freetype-2.1.9 --with-zlib-dir=/usr/local/zlib-1.2.2 --with-apxs2=/usr/local/apache/bin/apxs --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-force-cgi-redirect --disable-cgi --with-gettext --with-gdbm && make && make install
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: