安装环境

JDK

设置JAVA_HOME、JRE_HOME、CLASSPATH:

1
2
3
4
5
export JAVA_HOME=/home/katherine/Java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=.:${JAVA_HOME}/bin:${JRE_HOME}/bin:$HOME/bin:/usr/local/bin:$PATH

Intellij IDEA

Eclipse

eclipse-inst-linux64.tar.gz
解压:
tar -zxvf eclipse-inst-linux64.tar.gz
执行installer:
./eclipse-isntall
选择版本

Tomcat

1.下载
https://tomcat.apache.org/
Download->Tomcat7/8/9->Core->tar.gz
2.安装
解压到执行目录

1
2
$ tar -zxvf apache-tomcat-8.5.35.tar.gz
$ mv apache-tomcat-8.5.35 ~/Software

设置环境变量:

1
$ vim ~/.zshrc

设置CATALINA_HOME:

1
export CATALINA_HOME=${K_HOME}/Software/apache-tomcat-8.5.35

运行Tomcat:

1
2
3
4
5
6
7
8
$ cd ~/Software/apache-tomcat-8.5.35/bin
$ ./startup.sh
Using CATALINA_BASE: /home/katherine/Software/apache-tomcat-8.5.35
Using CATALINA_HOME: /home/katherine/Software/apache-tomcat-8.5.35
Using CATALINA_TMPDIR: /home/katherine/Software/apache-tomcat-8.5.35/temp
Using JRE_HOME: /home/katherine/Java/jdk1.8.0_181/jre
Using CLASSPATH: /home/katherine/Software/apache-tomcat-8.5.35/bin/bootstrap.jar:/home/katherine/Software/apache-tomcat-8.5.35/bin/tomcat-juli.jar
Tomcat started.

浏览器打开http://localhost:8080/
关闭Tomcat:

1
2
3
4
5
6
7
$ cd ~/Software/apache-tomcat-8.5.35/bin
$ ./shutdown.sh
Using CATALINA_BASE: /home/katherine/Software/apache-tomcat-8.5.35
Using CATALINA_HOME: /home/katherine/Software/apache-tomcat-8.5.35
Using CATALINA_TMPDIR: /home/katherine/Software/apache-tomcat-8.5.35/temp
Using JRE_HOME: /home/katherine/Java/jdk1.8.0_181/jre
Using CLASSPATH: /home/katherine/Software/apache-tomcat-8.5.35/bin/bootstrap.jar:/home/katherine/Software/apache-tomcat-8.5.35/bin/tomcat-juli.jar

Maven

The installation of Apache Maven is a simple process of extracting the archive and adding the bin folder with the mvn command to the PATH.
Maven的安装很简单,就是解压后将bin文件夹的目录添加到PATH中:

1
2
3
$ tar -zxvf apache-maven-3.6.0-bin.tar.gz
$ mv apache-maven-3.6.0 ~/Software
$ vim ~/.zshrc

向.zshrc中添加:

1
export MAVEN_HOME=${K_HOME}/Software/apache-maven-3.6.0

确认安装成功:

1
2
3
4
5
6
7
$ source ~/.zshrc
$ mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: /home/katherine/Software/apache-maven-3.6.0
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /home/katherine/Java/jdk1.8.0_181/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-42-generic", arch: "amd64", family: "unix"

MySQL

首先执行下面三条命令:

1
2
3
$ sudo apt-get install mysql-server
$ sudo apt install mysql-client
$ sudo apt install libmysqlclient-dev

安装成功后可以通过下面的命令测试是否安装成功:

1
$ sudo netstat -tap | grep mysql

出现如下信息证明安装成功:

可以通过如下命令进入mysql服务:

1
$ mysql -uroot -p你的密码

现在设置mysql允许远程访问,首先编辑文件/etc/mysql/mysql.conf.d/mysqld.cnf:

1
$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

注释掉 bind-address = 127.0.0.1 一句:
保存退出,然后进入mysql服务,执行授权命令:
grant all on . to root@’%’ identified by ‘你的密码’ with grant option;
flush privileges;

然后执行quit命令退出mysql服务,执行如下命令重启mysql:
service mysql restart

配置环境

Intellij搭建SpringMVC环境

Intellij搭建SpringMVC环境

Intellij中配置Maven项目(Spring+SpringMVC+Mybatis)

1
2+sql
3
IntelliJ IDEA创建Spring SpringMVC MyBatis整合Maven项目,并提交至Github

Intellij中配置Maven项目(SpringBoot)

1