Php安装
Php版本:
PHP Version 5.3.6
安装包名称:php-5.3.6.tar.gz
编译PHP前安装GD库相关套件【点此下载】
[root@localhost LAMP]# tar zxvf zlib-1.2.5.tar.gz
[root@localhost zlib-1.2.5]#cd zlib-1.2.5
[root@localhost zlib-1.2.5]#./configure --prefix=/usr/local/zlib/
[root@localhost zlib-1.2.5]#make
[root@localhost zlib-1.2.5]#make install
[root@localhost LAMP]#tar zxvf freetype-2.4.3.tar.gz
[root@localhost freetype-2.4.3]#cd freetype-2.4.3
[root@localhost freetype-2.4.3]#./configure --prefix=/usr/local/freetype
[root@localhost freetype-2.4.3]#make
[root@localhost freetype-2.4.3]#make install
[root@localhost LAMP]#tar zxvf libpng-1.5.2.tar.gz
[root@localhost LAMP]#cd libpng-1.5.2
[root@localhost libpng-1.5.2]#./configure –prefix=/usr/local/libpng
[root@localhost libpng-1.5.2]#make
[root@localhost libpng-1.5.2]#make install
[root@localhost LAMP]#tar -zxvf jpegsrc.v8c.tar.gz
[root@localhost LAMP]#cd jpeg-8c/
[root@localhost jpeg-8c]#mkdir -p /usr/local/jpeg/bin
[root@localhost jpeg-8c]#mkdir -p /usr/local/jpeg/lib
[root@localhost jpeg-8c]#mkdir -p /usr/local/jpeg/include
[root@localhost jpeg-8c]#mkdir -p /usr/local/jpeg/man/man1
[root@localhost jpeg-8c]#./configure --prefix=/usr/local/jpeg--enable-shared --enable-static
[root@localhost jpeg-8c]#make
[root@localhost jpeg-8c]#make install
[root@localhost LAMP]#tar zxvf gd-2.0.33.tar.gz
[root@localhost LAMP]#cd gd-2.0.33
[root@localhostgd-2.0.33] 修改当前目录下的gd_png.c
vigd_png.c
进入该文件,找到“png.h”改成“/usr/local/libpng/include/png.h”)
[root@localhost gd-2.0.33]#./configure --prefix=/usr/local/gd--with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng
[root@localhost gd-2.0.33]#make
[root@localhost gd-2.0.33]#make install
安装libxml2
[root@localhost LAMP]# tar –zxvf libxml2-2.7.2.tar.gz
[root@localhost LAMP]#cd libxml2-2.7.2
[root@localhost libxml2-2.7.2]# ./configure –prefix=/usr/local/libxml
[root@localhost libxml2-2.7.2]# make
[root@localhost libxml2-2.7.2]# make install
安装PHP
[root@localhost LAMP]#tar zxvfphp-5.3.6.tar.gz
[root@localhost LAMP]#cd php-5.3.6
[root@localhost php-5.3.6]#cd /root/LAMP/php-5.3.6/ext/gd/libgd
[root@localhost libgd]#vi gd_compat.c
[root@localhost libgd]# cd /root/LAMP/php-5.3.6
[root@localhost php-5.3.6]# ./configure--prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs--with-gd=/usr/local/gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-zlib --with-freetype-dir=/usr/local/freetype--enable-magic-quotes --with-mysql=/software/mysql--with-mysql-sock=/tmp/mysql.sock --with-iconv --enable-mbstring --enable-ftp--with-config-file-path=/usr/local/php/etc --with-pear=/usr/local/php/pear--enable-sockets --with-libxml-dir=/usr/local/libxml/
[root@localhost php-5.3.6]#cd/LAMP/php-5.3.6/
[root@localhost php-5.3.6]#make
[root@localhost php-5.3.6]#make install
[root@localhost php-5.3.6]#cpphp.ini-development /usr/local/php/etc/php.ini 【cp php-x.x.x/php.ini-dist /opt/php/etc/php.ini 新版的 php.ini-development相当于旧版本的php.ini-dist】
[root@localhost LAMP]#vimphp.ini
修改配置文件vim /usr/local/php/etc/php.ini:
register_globals = On
然后编写php测试页info.php:内容如下:
<?php
phpinfo();
?>
查看/usr/local/apache/conf/httpd.conf文件,看是否存在语句(如果安装的Php5):
LoadModule php5_module modules/libphp5.so
如果存在,即说明apache已经成功加载了php模块;
【重启apache服务】
# apachectl restart
将info.php放置到/usr/local/apache/htdocs 目录下;
# chmod 755 info.php
在浏览器中能在该页面中看到php的信息则说明安装成功!
注:启用了SELinux的FC或RedHat会提示权限问题并导致Php无法正常工作,禁用SELinux后重启系统即可解决问题。
Tomcat安装
tomcat版本:
ApacheTomcat/5.5.9
安装包名称:jakarta-tomcat-5.5.9.tar.gz
点此下载:【apr、aprutil、libtool、jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz】
安装tomcat
[root@localhost LAMP]#tar zxvf jakarta-tomcat-5.5.9.tar.gz
[root@localhost LAMP]#cd jakarta-tomcat-5.5.9
[root@localhost LAMP]#mkdir -p/usr/local/tomcat/
[root@localhost LAMP]#cp -rf * /usr/local/tomcat/【拷贝所有解压出来的文件到/usr/local/tomcat/】
[root@localhost LAMP]#cd /usr/local/tomcat/bin
[root@localhost bin]#./startup.sh 【启动tomcat】
[root@localhost bin]#./shutdown.sh 【停止tomcat】
安装apr、aprutil、libtool
安装apr
[root@localhost LAMP]#tar zxvf apr-1.4.5.tar.gz
[root@localhost LAMP]#cd apr-1.4.5
[root@localhost apr-1.4.5]#./configure --prefix=/usr/local/apr【最好指定安装目录】
[root@localhost apr-1.4.5]#make
[root@localhost apr-1.4.5]#make install
安装aprutil
[root@localhost LAMP]# tar zxvf apr-util-1.3.12.tar.gz
[root@localhost LAMP]#cd apr-util-1.3.12
[root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/aprutil--with-apr=/usr/local/apr【最好指定安装目录】
[root@localhost apr-util-1.3.12]# make
[root@localhost apr-util-1.3.12]# make install
安装完apr和aprutil后
[root@localhost apr-util-1.3.12]# ln-s/usr/local/apr/lib/libapr-1.so.0.4.5 /usr/local/apache/lib/libapr-1.so
[root@localhost apr-util-1.3.12]# ln-s/usr/local/apr/lib/libapr-1.so.0.4.5 /usr/local/apache/lib/libapr-1.so.0
[root@localhost apr-util-1.3.12]# ln-s/usr/local/aprutil/lib/libaprutil-1.so.0.3.12/usr/local/apache/lib/libaprutil-1.so
[root@localhost apr-util-1.3.12]# ln-s/usr/local/aprutil/lib/libaprutil-1.so.0.3.12/usr/local/apache/lib/libaprutil-1.so.0
安装libtool
[root@localhost LAMP]#tar zxvf libtool-2.4.tar.gz
[root@localhost LAMP]#cd libtool-2.4
[root@localhost libtool-2.4]#./configure --prefix=/usr/local/libtool
[root@localhost libtool-2.4]#make
[root@localhost libtool-2.4]#make install
[root@localhost libtool-2.4]#cd /usr/local/apache/build/
[root@localhost build]# rm -rf libtool【删除旧版本的libtool】
[root@localhost build]# ln-s /usr/local/libtool/bin/libtool /usr/local/apache/build/libtool
安装jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
[root@localhost LAMP]#tar zxvfjakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
[root@localhost LAMP]#cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/
[root@localhost native2]#./configure--with-apxs2=/usr/local/apache/bin/apxs 【注意apxs的路径】
[root@localhost native2]# make【一定记得make,否则找不到build/jk2/mod_jk2.so囧 我当时就忘了。】
[root@localhost native2]cd../build/jk2/apache2/
[root@localhost native2]/usr/local/apache/bin/apxs-n jk2 -i mod_jk2.so 【将mod_jk2.so添加到apache2的modules中】
[root@localhost native2]cd /usr/local/apache/modules/
[root@localhost modules]chmod755 mod_jk2.so
上面就完成了Tomcat和Connectors的安装.
接下来进行与Apache的整合
[root@localhost LAMP]#cd /usr/local/apache/conf/
[root@localhost conf]#vimhttpd.conf
加入LoadModulejk2_modulemodules/mod_jk2.so
然后在这个目录新建一文件workers2.properties
[root@localhost conf]#vim workers2.properties
[channel.socket:localhost:8009]
port=8009
host=localhost
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/examples/*jsp]
worker=ajp13:localhost:8009
[root@localhost conf]#cd /usr/local/tomcat/conf/
[root@localhost conf]#vim server.xml
找到其中的<Host>中的<Contest>项,修改相关参数如下,保存退出;
<Contextpath=""docBase="/opt/apache/htdocs"debug="0"reloadable="true"crossContext="true"/>
[root@localhost conf]# /usr/local/tomcat/bin/startup.sh 【启动tomcat】
[root@localhost conf]# /usr/local/apache/bin/apachectl restart【重启apache】
[root@localhost conf]# /etc/init.d/mysqld start 【启动mysql】
整合完毕
以下内容参考:
Mysql 设置数据库密码
[root@localhost conf]#/etc/init.d/mysqld start
[root@localhost conf]#mysqladmin -u rootpassword"7710405"
[root@localhost conf]#mysql –u root –p
输入密码回车进入mysql
mysql 新建数据库
CREATE DATABASE databasename;
Mysql 继承权限
GRANT ALL PRIVILEGES ON databasename.* TO wordpresSUSErname@hostnameIDENTIFIED BY password;
删除数据库
Drop database databasename
遇到了 SQLException:accessdenied for @'localhost' (using password:no)
grant all privileges on *.* tojoe@localhost identified by '1';
grant all privileges on databasename.* to beimingluntan@identified by '1';
GRANT ALL PRIVILEGES ON beimingluntan.* TO 'beimingluntan'@'localhost' IDENTIFIED BY 'beiminglunadmin##'WITH GRANT OPTION
flush privileges;【刷新数据库】
附:
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
权限1,权限2,…权限n对应
select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库���称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%'表示从任何地址连接。
连接口令’不能为空,否则创建失败。
mysql>grantselect,insert,update,delete,create,drop onvtdc.employee to joe@10.163.225.87identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。
mysql>grant all privilegeson vtdc.* to joe@10.163.225.87identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
mysql>grant allprivileges on *.* to joe@10.163.225.87identified by ‘123′;
给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
mysql>grant allprivileges on *.* to joe@localhost identified by‘123′;
给本机用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
安装discuz【安装过程可参考discuz论坛】
把安装包上传上去【upload文件夹然后改权限chmod 777 使文件可以访问,访问install目录开始安装】
[root@localhost conf]#cd /usr/local/apache/htdocs/luntan/upload
[root@localhost upload]#chmod –R 777 *
[root@localhost upload]#cp config_global_default.php config_global.php【提示找不到config_global.php和config_ucenter.php】
[root@localhost upload]#cp config_ucenter_default.php config_ucenter.php
安装WordPress【安装过程可参考WP论坛】
注意需要手动建立数据库【参考mysql命令】