LAMP环境配置全程笔记(原创)

Linux

如有疏漏或不当之处欢迎指正,我的E-Mail是jasonwei06@hotmail.com,谢谢!

//——————————安装环境——————————
//Linux版本:Red Hat Enterprise Linux 5 Update4
//Apache版本:Apache 2.0.63
//MySQL版本:MySQL 5.1.43
//PHP版本:PHP 5.2.13
//——————————安装Apache——————————
#tar zxvf httpd-2.0.63.tar.gz
#cd httpd-2.0.63
#./configure –prefix=/usr/local/apache2 –enable-so –enable-rewrite
#make
#make install

//配置Apache随系统自动启动
//第一步:编辑/etc/rc.d/rc.local文件
#vi /etc/rc.d/rc.local
//第二步:在rc.local中加入Apache的启动命令/usr/local/apache2/bin/apachectl start
//最后,保存rc.local,并重新启动Linux系统,测试Apache是否正常随系统启动。
//——————————安装MySQL——————————
#tar zxvf mysql-5.1.43.tar.gz
#cd mysql-5.1.43
#./configure –prefix=/usr/local/mysql –with-charset=gbk –with-extra-charset=all –with-named-curses-libs=/usr/lib/libncurses.so.5
#make WITH_CHARSET=gbk WITH_XCHARSET=all
#make install

//建立MySQL的用户组和用户名
#groupadd mysql
#useradd -g mysql mysql

//配置MySQL的用户访问权限
#cd /usr/local
#chown -R mysql mysql
#chgrp -R mysql mysql

//安装系统数据库
#/usr/local/mysql/bin/mysql_install_db –user=mysql

//配置MySQL随系统自动启动-方法1(推荐)
//将 mysql-5.1.43/support-files/mysql.server 拷贝并重命名为 /etc/rc.d/init.d/mysqld
//将 mysql-5.1.43/support-files/my-medium.cnf 拷贝并重命名为 /etc/my.cnf
//然后执行下列命令
#chmod +x /etc/rc.d/init.d/mysqld
#chkconfig –add mysqld
#chkconfig –level 35 mysqld on
#service mysqld start

//配置MySQL随系统自动启动-方法2
//编辑rc.local文件
#vi /etc/rc.d/rc.local
//并写入命令/usr/local/mysql/bin/mysqld_safe –user=mysql &
//保存并重新linux

//为MySQL的管理员帐号root设置密码(须在mysql进程运行状态下)
#cd /usr/local/mysql/bin
#mysqladmin -u root password ‘xxxxxxxx’;

//创建一个用于远程管理的mysql账号
#cd /usr/local/mysql/bin
#mysql -h 127.0.0.1 -u root -p
mysql>grant all on *.* to admin@’%’ Identified by ‘xxxxxx’;
//——————————安装PHP——————————
//安装前确认是否已经安装libxml2,如尚未安装可从RHEL5光盘server目录下找到对应的rpm包进行安装
#tar zxvf php-5.2.13.tar.gz
#cd php-5.2.13
#./configure
–prefix=/usr/local/php/
–with-apxs2=/usr/local/apache2/bin/apxs
–with-mysql=/usr/local/mysql/
–with-pdo-mysql=/usr/local/mysql/
–with-gd=/usr/lib/ //或–with-gd
–with-zlib=/usr/lib/ //或–with-zlib
–with-png-dir=/usr/lib/ //可不加
–with-freetype-dir=/usr/lib/ //可不加

#make
#make install
#cp ./php.ini-dist /usr/local/php/lib/php.ini

//问题1:启动Apache时如遇到报错:……libphp5.so: undefined symbol: sqlite3ExprDelete
//解决:需要重新编译PHP,并在configure前执行make clean

//问题2:启动Apache时如遇到报错:……libphp5.so: cannot restore segment prot after reloc: Permission denied
//解决:这是由于SELinux引起的,需要执行命令#chcon -t texrel_shlib_t /usr/local/apache2/modules/libphp5.so

//配置Apache的httpd.conf文件
LoadModule php5_module        modules/libphp5.so
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php

阳光部落原创,更多内容请访问 http://www.sunbloger.com/

相关内容:

发表评论