阿里云服务器 Centos 6.5 32位配置javaweb环境

1、远程连接工具:Xshell,ftp连接:Xftp,mysql远程连接:Navicat premium

2、安装rzsz。

yum update -y

yum list lrzsz*

yum install rzsz* -y


3、安装JDK。

yum list java*

yum install java-1.7.0-openjdk* -y


4、安装mysql。

yum list mysql*

yum install mysql-server* -y

#启动mysql

/ect/init.d/mysqld start

#重新启动mysql

/ect/init.d/mysqld start


#设置mysql开机自动启动

chkconfig mysqld on

#远程连接mysql

刚开始是连不上的,需要进入mysql更改user表里root用户的host字段,具体操作如下:

#进入mysql命令

mysql -u root

select host,user from user;

#更改root用户对应的host为“%”

update user set host = '%' where user = 'root' and host='localhost';

重新启动mysql即可通过naivicat premium进行远程连接。


5、安装tomcat

首先从官网下载tomcat linux版本的软件包


下载完之后重命名为tomcat通过ftp软件上传到 /usr/local目录下,通过命令进入local目录

#解压软件包

tar zvxf  tomcat.tar.gz

5.1修改配置文件

vim server.xml

  1. <Service name="Catalina">  
  2. lt;Executor name="tomcatThreadPool" namePrefix="catalina-exec-"  
  3.       maxThreads="250" minSpareThreads="20"/>  
  4.   <Connector port="80" protocol="HTTP/1.1"  
  5.              connectionTimeout="20000"  
  6.              redirectPort="8443"   
  7.         compression="on"  
  8.         compressionMinSize="2048"  
  9.         noCompressionUserAgents="gozilla,traviata"  
  10.         compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,application/json,application/javascript,application/x-javascript"  
  11.         />  
  12.   <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" executor="tomcatThreadPool"/>  
  13.   <Engine name="Catalina" defaultHost="www.renfufei.com">  
  14.     <Realm className="org.apache.catalina.realm.UserDatabaseRealm"  
  15.            resourceName="UserDatabase"/>  
  16.     <Host name="www.renfufei.com"  appBase="webapps"  
  17.           unpackWARs="true" autoDeploy="true"  
  18.           xmlValidation="false" xmlNamespaceAware="false">  
  19.     <Alias>localhost</Alias>  
  20.     <Alias>renfufei.com</Alias>  
  21.     <Alias>renfufei.cn</Alias>  
  22.     <Alias>www.renfufei.cn</Alias>  
  23.     <Context docBase="/renfufei/upload"  path="/upload" />  
  24.     <Context docBase="/renfufei/myapp"  path="" />  
  25.     </Host>  
  26.   </Engine>  
  27. </Service> 

#设置tomcat自动启动

修改 /etc/rc.d/rc.local 文件:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. vim /etc/rc.d/rc.local  
在里面增加启动Tomcat的脚本,然后保存. 最终结果如下所示:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@xxx bin]# cat /etc/rc.d/rc.local   
  2. #!/bin/sh  
  3. #  
  4. # This script will be executed *after* all the other init scripts.  
  5. # You can put your own initialization stuff in here if you don't  
  6. # want to do the full Sys V style init stuff.  
  7.   
  8. touch /var/lock/subsys/local  
  9.   
  10. # start tomcat  
  11. /usr/local/tomcat/bin/startup.sh  

#启动tomcat

./startup.sh

#关闭tomcat

./startup.sh

启动tomcat之后,我们可以通过服务器ip访问,测试是否配置成功。












  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值