...
分类: LINUX
2010-03-22 17:39:58
1 装jdk
jdk-6u3-linux-i586.bin
#chmod u+x jdk-6u3-linux-i586.bin
#./jdk-6u3-linux-i586.bin
ln -s /usr/local/jdk1.6.0_03 /usr/local/jdk
ln -s /usr/local/jdk1.6.0_03 /jre /usr/local/jre
#vi /etc/profile
加入以下几行
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export CATALINA_HOME=/usr/local/tomcat
保存退出。
#source /etc/profile 很重要 刷新环境变量
java –version 查看jdk是否安装成功
2 httpd-2.2.6.tar.gz
#cp httpd-2.2.6.tar.gz /usr/local
#cd /usr/local
#tar zxvf httpd-2.2.6.tar.gz
#cd httpd-2.2.6
#./configure –prefix=/usr/local/apache --enable-module=so
#make
#make install
启动Apache,并测试。
# cd /usr/local/apache/bin
# ./apachectl start
打开浏览器,并在地址栏中输入主机的IP地址
apache-tomcat-6.0.14.tar.gz
#tar zxvf apache-tomcat-6.0.14.tar.gz
#cp –r apache-tomcat-6.0.14 /usr/local/tomcat
#/usr/local/tomcat/bin/startup.sh
打开 验证tomcat可以启动
整和apache和tomcat
tomcat-connectors-1.2.25-src.tar.gz
#tar zxvf tomcat-connectors-1.2.25-src.tar.gz
进行编译配置。大家一定要注意这几个参数中前三个是很重要的,必要时可以去相应的目录看看相关的文件是否存在。
#cd tomcat-connectors-1.2.25-src/native
# ./ buildconf.sh
#./configure --with-apxs=/usr/local/apache/bin/apxs --with-tomcat=/usr/local/tomcat --with-java-home=/usr/java/jdk --with-jni
# make
# make install
#ll /usr/local/apache/modules/mod_jk.so
mod_jk.so生成成功了。
3 tomcat apache 整合
编辑apache的配置文件:
#vi /usr/local/apache/conf/httpd.conf
在末尾添加以下几行
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /usr/local/apache/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# Send servlet for context /examples to worker named worker1
#JkMount /examples/*.jsp worker1
JkMount /servlet/* worker1
# Send JSPs for context /examples to worker named worker1
JkMount /*.jsp worker1
创建文件workers.proferties
#vi /usr/local/apache/conf/workers.porperties
添加如下内容:
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/jdk
ps=/
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.connection_pool_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.lbfactor=1
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
最后重新启动tomcat和apache,我们的安装就完成了
#/usr/local/tomcat/bin/shutdown.sh //关闭tomcat
#/usr/local/tomcat/bin/startup.sh //启动tomcat
#/usr/local/apache/bin/apachectl restart //重启apache
4 lamp安装
一、安装mysql
# groupadd mysql
# useradd -g mysql mysql
# cd /usr/local
# tar zvxf mysql-standard-5.0.27-linux-i386-glibc23.tar.gz
# ./configure --prefix=/usr/local/mysql
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# cp support-files/my-medium.cnf /etc/my.cnf //复制配置文件,当启动mysql时会读取配置
# vi /etc/my.cnf
查找 The Mysql server
[mysqld]
添加一行:set-variable = max_connections=150
保存并退出
# /usr/local/mysql/bin/safe_mysqld (or mysqld_safe) --user=mysql & //启动mysql
此时可以使用/usr/local/mysql/bin/mysqladmin version 查看Mysql DBMS版本和使用信息.
# /usr/local/mysql/bin/mysqladmin -uroot password xxxxx //为root访问设置密码
当计算机重新启动后mysql不会启动,如果想同时启动就添加下面的内容:
# vi /etc/rc.d/rc.local
添加:/usr/local/mysql/bin/safe_mysqld (or mysqld_safe)--user=mysql &
保存并退出
二、安装apache
# cd /usr/local
# tar -zxvf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max
# make
# make install
启动Apache服务: # /usr/local/apache/bin/apachectl start
关闭Apache服务: # /usr/local/apache/bin/apachectl stop
重启Apache服务: # /usr/local/apache/bin/apachectl restart
三、安装php
# cd /usr/local
# tar -jxvf php-5.2.0.tar.bz2
# cd php-5.2.0
# ./configure --prefix=/usr/local/php --with-mysqld=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
四、配置apache
编辑httpd.conf文件
# vi /usr/local/apache/conf/httpd.conf
在LoadModule处添加: LoadModule php5_module module/libphp5.so
在DirectoryIndex处添加: index.php
在AddType application处添加: AddType application/x-httpd-php .php .phtml
AddType applicatoin/x-httpd-php-source .phps
php 装好后注意查看selinux日志是否阻止读取php模块
httpd加入 AddType application/x-httpd-php .php
五、测试php模块的加载
# /usr/local/apache/bin/apachectl start //开启apache
在浏览器中输入:
浏览器中显示:It Works 表示apache开启www服务
在/apache/htdocs目录下建一个文件phpinfo.php
输入:
保存并退出
在浏览器中输入:
浏览器中显示一个关于apache和php安装的Web页,表示成功加载php模块。
5 数据库相关 phpmyadmin 和 jdbc
JDBC的安装
#tar -zxvf mysql-connector-java-3.2.0-alpha.tar.gz
#cd mysql-connector-java-3.2.0-alpha
#cp mysql-connector-java-3.2.0-alpha-bin.jar /usr/local/tomcat/common/lib
#tar xfv mssqlserver.tar
#tar xfv msjdbc.tar
#cd lib
# cp *.jar /usr/local/tomcat/common/lib
phpmyadmin
1 tar
2 mv to /usr/local/apache/htdocs
3 改个好打的名字
4 cd 进入phpmyadmin 目录
5 cp libraries/config.default.php config.inc.php
6 vi config.inc.php
$cfg['blowfish_secret']='' //主要作用是加密你的cookie 可以任意设置
$cfg['Servers'][$i]['controluser']='root'; mysql控制用户设置
$cfg['Servers'][$i]['controlpass']=";
$cfg['Servers'][$i]['auth_type']='cookie'; 验证方式
$cfg['Servers'][$i]['user']='root' mysql用户
$cfg['Servers'][$i]['password']=";