设为首页 收藏本站
查看: 780|回复: 0

[经验分享] vps 安装:centos+jdk+tomcat+apache+jk+mysql

[复制链接]

尚未签到

发表于 2016-5-12 09:10:17 | 显示全部楼层 |阅读模式
  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

  • http://apache.mirror.phpchina.com/httpd/httpd-2.2.11.tar.gz
  • http://www.java.net/download/jdk6/6u10/promoted/b28/binaries/jdk-6u10-rc-bin-b28-linux-i586-21_jul_2008-rpm.bin
  • http://apache.mirror.phpchina.com/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
  • http://labs.xiaonei.com/apache-mirror/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz
  注:如果要添加其它软件,则就把软件的下载地址添加上去即可。上面的链接可能会无效了,请找合适自己的链接
  
  执行命令:


  [iyunv@localhost software]# wget -i wget.txt
  
  1.1 安装jdk
  包:jdk-6u37-linux-x64-rpm.bin
  当前文件执行命令:
  [iyunv@localhost software]# chmod u+x jdk-6u37-linux-x64-rpm.bin
[iyunv@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
  [iyunv@localhost software]# tar zxvf httpd-2.2.23.tar
  
  [iyunv@localhost software]# cd httpd-2.2.23
  
  [iyunv@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
  
  
  [iyunv@localhost software]# sh init.sh
  
  .....省略安装过程.......
  
  1.3 安装tomcat
  包:apache-tomcat-6.0.36.tar
  
  [iyunv@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
  [iyunv@localhost software]# tar zvxf tomcat-connectors-1.2.28-src.tar.gz
[iyunv@localhost software]# cd tomcat-connectors-1.2.28-src/native/
[iyunv@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
  错误就没有了

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-215848-1-1.html 上篇帖子: centos/apache 安装memcache及其php扩展 及memcache API 下篇帖子: 搭建 CentOS 6 服务器(3)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表