解决方案:
mkdir /usr/local/java
cd /usr/local/java
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" \
https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
tar -xzvf jdk-8u201-linux-x64.tar.gz
cd /etc
cp profile profile.2019.03.09
vim profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_201
export PATH=/usr/local/java/jdk1.8.0_201/bin:$PATH
export CLASSPATH=.
source profile
javac -version
输出结果为:javac 1.8.0_201
echo $PATH
输出结果为:/usr/local/java/jdk1.8.0_201/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
which javac
输出结果为:/usr/local/java/jdk1.8.0_201/bin/javac
which java
输出结果为:/usr/local/java/jdk1.8.0_201/bin/java
reboot
cd /usr/local/java
vim HelloWorld.java
内容如下:
public class HelloWorld{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
more HelloWorld.java
javac HelloWorld.java
java HelloWorld
cd /usr/local/java
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.93/bin/apache-tomcat-7.0.93.zip
yum -y install unzip
unzip apache-tomcat-7.0.93.zip
cd /usr/local/java/apache-tomcat-7.0.93/bin
chmod +x *.sh
./startup.sh
ps -A|grep java
结果输出为: 3372 pts/0 00:00:02 java
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
./shutdown.sh
yum -y install mariadb-server mariadb
另外,卸载MariaDB数据库命令为:
yum remove mariadb
systemctl start mariadb.service
ps -A|grep mysql
netstat -ln | grep 3306
mysql -u root -p
show variables like 'char%';
输出结果为:(数据库默认编码为拉丁文)
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
exit
cd /etc
cp my.cnf my.cnf.2019.03.09
vim my.cnf
在[mysqld]和[mysqld_safe]之间添加以下内容:
character_set_server=utf8
cd ..
cd root
systemctl restart mariadb.service
show variables like 'char%';
输出结果为:
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
exit
systemctl stop mariadb.service
systemctl start mariadb.service
mysql -u root -p
第一次不用密码直接登录
USE mysql;
YourPasswordHere改为你要设置的密码
UPDATE user SET password=PASSWORD('YourPasswordHere') WHERE User='root' AND Host = 'localhost';
FLUSH PRIVILEGES;
exit
mysql -u root -p
输入你刚才设置的新密码登录即可,至此mysql数据库已经安装完毕!祝你好运~
d:
创建mysql文件夹(专门存放SQL文件)
mkdir mysql
进入mysql文件夹
cd mysql
mysqldump -uroot -p jsd1810db > jsd1810db.sql
输入数据库登录密码
Enter password: ********
导出成功!
D:\mysql>
进入E盘(PuTTY所在的磁盘)
e:
进入PuTTY文件夹
cd E:\PuTTY
将jsd1810db.sql上传到Linux服务器的根目录下
pscp D:\mysql\jsd1810db.sql root@47.101.171.255:/root/
输入密码登录即可开始上传...
root@47.101.171.255's password:
jsd1810db.sql | 3 kB | 3.5 kB/s | ETA: 00:00:00 | 100%
恭喜你!上传成功!
E:\PuTTY>
create database jsd1810db;
use jsd1810db;
source jsd1810db.sql;
select*from t_user;
E:\PuTTY>cd ..
E:\>mkdir myweb
E:\>cd myweb
E:\myweb>
返回E盘(PuTTY所在的磁盘)
cd ..
进入PuTTY文件夹
cd E:\PuTTY
将jsd1810db.sql上传到Linux服务器的根目录下
pscp E:\myweb\SSM-UMS.war root@47.101.171.255:/root/
输入密码登录即可开始上传...
root@47.101.171.255's password:
SSM-UMS.war | 11918 kB | 5959.1 kB/s | ETA: 00:00:00 | 100%
恭喜你!上传成功!
E:\PuTTY>
cp SSM-UMS.war /usr/local/java/apache-tomcat-7.0.93/webapps
进入Tomcat的bin目录
cd /usr/local/java/apache-tomcat-7.0.93/bin
检查Tomcat
ps -A|grep java
如果发现Tomcat正在运行,则关闭Tomcat
./shutdown.sh
启动Tomcat
./startup.sh
http://生产环境ip:8080/应用名(项目名称)/请求路径
开发环境:本地IP:PORT,即
http://127.1.0.0:8080/SSM-UMS/addUser.html
生成环境:服务器IP:PORT,即
http://47.101.171.255:8080/SSM-UMS/addUser.html
cat /usr/local/java/apache-tomcat-7.0.93/logs/catalina.out
2019/3/9 20:08:52 已解决!