Quickly build a JavaWeb environment JDKtomcatmysql on Alibaba Cloud server

Original link http://www.360doc.com/content/14/0815/13/13228794_402127062.shtml

 There are many wonderful tutorials on the Alibaba Cloud Forum, but most of the web environments built are in the PHP environment. As a novice in Java, I will write some JSP programs when I have time, but it is indeed the first to build a Java Web environment on the Linux environment. Second, I have been through all the ups and downs~~~~~ After finishing it, I specially wrote a simple tutorial to help friends who want to use Java Web projects on Alibaba Cloud servers.     First of all, I highly praise Alibaba Cloud's services. The installation and reset of the operating system, as well as many important functions can be completed with one click. If there is something you don't understand, send an email to the customer service, and the answer is also very detailed, so you don't have to worry at all. Will be stumped by what operation.
 
 

 First you have to install SSH on your computer and learn to use it (there are many good SSH video tutorials on the forums, just take a few minutes to watch them). 1. (Optional operation) Install the operation panel vpsmate     First of all, it is recommended for friends who are new to liunx to install an operation panel. There are two advantages: 1. Many commands can be realized by clicking the mouse on the web interface; 2. When you go out , the server suddenly has a problem, and you may not be able to find the machine with SSH installed. At this time, use the panel to simply operate it, and it is impossible to restart the service directly through the panel.     Speaking of panels, I recommend vpsmate to everyone. This is the champion work of the Alibaba Cloud Developers Competition. It is naturally a very suitable server for Alibaba Cloud. It can easily install, uninstall, and monitor many software on the server with one click, and it occupies very little memory. When not in use, it occupies almost no memory. The installation process is very simple, please refer to this tutorial on the vpsmate official website: http://www.vpsmate.org/install 2. Installing the mysql database database should be an indispensable software in web applications, of course, you can also choose to install the oracle Class, the operation is similar.     If you did not choose the first step, please refer to this post to complete the installation of mysql: http://www.blogjava.net/amigoxie/archive/2013/02/22/395605.html     If you completed the first step You can log in to your vpsmate panel, and then click Service Management --> Database Service --> MYSQL Installation Service to complete the installation operation with one click.     During the installation process, some packages may not be found, and the error "Software source ius installation failed!" appears. You can follow this post to solve this problem according to your own operating system version:
     
 

     
 
 
 
 
    
 
 
 

http://www.mirrtalk.net/?p=472 
     
3、安装JDK/JRE 
    其实安装JRE应该就够了,不过我比较喜欢折腾服务器,以后可能会在这个服务器上搞点别的,所以直接安装了JDK. 
    两个命令即可完成: 
 
wget http://download.oracle.com/otn-pub/java/jdk/7u40-b43/jdk-7u40-linux-x64.rpm?AuthParam=1380464207_43e07da0c7f873c59a3441c9966cb8e9 
rpm -ivh *.rpm 
 
 
    安装完后要设置一下环境变量在 /etc/profile中加入如下内容(可以使用vi进行编辑profile,也可以下载下来编辑完再上传): 
 
 
JAVA_HOME=/usr/java/jdk1.7.0_40 
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib  
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin  
export PATH CLASSPATH JAVA_HOME 
 
 
4、安装tomcat 
    同样是两个命令即可完成: 
 
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz 
tar -zxvf apa* 
 
 
    完成后,把tomcat文件夹copy到一个你喜欢的位置,比如我喜欢放在/usr/local下面: 
cp -r tomcat /usr/local 
 
 
 
 
------------------------------------------------------ 
 
 
至此,Java Web环境就搭建完成啦~~~,把你的web项目上传到webapp文件夹下,然后bin目录下运行./startup.sh,就可以访问你的网站啦。 
 
 
(后续还有绑定域名、设置tomcat开机启动等操作,有兴趣的同学自行百度/google哈) 
 
 
另:Mysql可能会存在编码问题,导致where条件中含有中文时查询不到结果,可以按这个帖子来解决http://bbs.csdn.net/topics/390021367

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325764509&siteId=291194637