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
"--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
错误就没有了