`

vps 安装:centos+jdk+tomcat+apache+jk+mysql

 
阅读更多

vps 安装:centos+jdk+tomcat+apache+jk+mysql

 

一、检查安装前需要的环境,如:gcc...等编译工具

 

gcc -v

 

如果没有则通过yum去安装相关软件。

 

yum -y install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libtool* zlib-devel libxml2-devel libjpeg-devel libpng-devel libtiff-devel fontconfig-devel freetype-devel libXpm-devel gettext-devel curl curl-devel pam-devel e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

 

二、下载需要的软件:
#vi wget.txt

  1. http://apache.mirror.phpchina.com/httpd/httpd-2.2.11.tar.gz
  2. http://www.java.net/download/jdk6/6u10/promoted/b28/binaries/jdk-6u10-rc-bin-b28-linux-i586-21_jul_2008-rpm.bin
  3. http://apache.mirror.phpchina.com/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
  4. http://labs.xiaonei.com/apache-mirror/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz

注:如果要添加其它软件,则就把软件的下载地址添加上去即可。上面的链接可能会无效了,请找合适自己的链接

 

执行命令:

[root@localhost software]# wget -i wget.txt

 

1.1 安装jdk

包:jdk-6u37-linux-x64-rpm.bin

当前文件执行命令:

[root@localhost software]# chmod u+x jdk-6u37-linux-x64-rpm.bin
[root@localhost software]# ./jdk-6u37-linux-x64-rpm.bin

Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u37-linux-amd64.rpm
inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Installing JavaDB
Preparing... ########################################### [100%]
1:sun-javadb-common ########################################### [ 17%]
2:sun-javadb-core ########################################### [ 33%]
3:sun-javadb-client ########################################### [ 50%]
4:sun-javadb-demo ########################################### [ 67%]
5:sun-javadb-docs ########################################### [ 83%]
6:sun-javadb-javadoc ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....


Done.

 

安装完成,配置环境变量

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

#PATH=$PATH:$HOME/bin

#export PAT

JAVA_HOME=/usr/java/jdk1.6.0_37
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar

PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/sbin

export PATH JAVA_HOME CLASSPATH
unset USERNAME

 

 

1.2 安装apache httpd

 

包:httpd-2.2.23.tar

[root@localhost software]# tar zxvf httpd-2.2.23.tar

 

[root@localhost software]# cd httpd-2.2.23

 

[root@localhost software]# vi init.sh

./configure \
"--prefix=/usr/local/apache2" \
"--with-included-apr" \
"--enable-so" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--disable-userdir"
make
make install
echo '/usr/local/apache2/bin/httpd -k start ' >> /etc/rc.local

 

 

[root@localhost software]# sh init.sh

 

.....省略安装过程.......

 

1.3 安装tomcat

包:apache-tomcat-6.0.36.tar

 

[root@localhost software]# tar zxff apache-tomcat-6.0.36.tar

进入目录,并把内容copy到新建的目录 /usr/local/tomcat

 

 

将tomcat加入自启动

vi /etc/rc.d/rc.local

/usr/local/tomcat6/bin/catalina.sh start

 

1.4 安装JK

[root@localhost software]# tar zvxf tomcat-connectors-1.2.28-src.tar.gz
[root@localhost software]# cd tomcat-connectors-1.2.28-src/native/
[root@localhost software]# ./configure --with-apxs=/usr/local/apache2/bin/apxs && make && make install
到apache的modules下面看看有没有mod_jk.so模块

 

》》》 mysql 安装说明:

centos 安装 mysql-server

直接yum install mysql-server

然后启动 /etc/rc.d/ini.d/mysqld start 启动一下就OK了

修改密码:
mysqladmin -u root password lijian
lijian为新密码。

重启 mysql 命令:
/etc/init.d/mysqld restart

 

如果连接mysql 出现 host ... is not allowed to connect to this MySql server
说明权限有问题,执行以下授权即可。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'lijian' WITH GRANT OPTION;

 

 

 

问题集:

1 访问出现403

原因是apache配置问题:

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>

根据配置文件提示,此设置 是用于修改Apache对所有目录的访问权限的,如果任意修改,可能会带来安全隐患的!那我们来看看到底是什么在作祟,让我们无法访问网页的吧!
Deny from all 有点英文基础的都可以看的出来,这里是关键:拒绝所有!
将Deny改为Allow试试!(因为可能会存在大小写敏感的问题,所以推荐用首字母大写,有兴趣的可以自己尝试小写!)一下通过了,但是这样配置的话服务 器安全性会...
于是我继续往下看配置文件!


发现了以下内容
#
# This should be changed to whatever you set DocumentRoot to.
#
以上这行注释的意思:无论你的服务 器根目录设置 为什么,你都必须保证此处配置保持一致!

以下为引用的内容:
<Directory "默认目录">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

再将以上的"默认目录"设置 为"目标目录",(当然已经将对所有权限访问的设置 修改为拒绝了!)刷新一下页面,OK,通过了!

 

2

可能会出错这个错误“httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName“

vi /usr/loacl/apache2/conf/httpd.conf

编辑配置文件

将#ServerName www.example.com:80 改成ServerName localhost:80

错误就没有了

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics