最全Linux下安装JAVAEE环境

安装jdk

解压

  1. 通过xftp6上传到/usr/local下
  2. 解压tar -zxvf jdk-8u261-linux-x64.tar.gz
  3. mv jdk/jdk 1.8.0_261 jdk 【重命名】

配置环境变量

  1. 配置环境变量的配置文件vim/etc/profile

在最后加入下面两行

export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
  1. source /etc/profile [让新的环境变量生效]

测试安装成功

img

安装Tomcat

https://blog.csdn.net/qq_21077715/article/details/85541685?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164822106616781685320435%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=164822106616781685320435&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduend~default-2-85541685.142v5pc_search_result_control_group,143v6control&utm_term=linux%E4%B8%8B%E5%AE%89%E8%A3%85tomcat&spm=1018.2226.3001.4187

解压

通过xftp6上传到/usr/local下
解压tar -zxvf apache-tomcat-8.5.59.tar.gz
mv apache-tomcat-8.5.59/ tomcat 【重命名】

本地测试启动

cd tomcat/
bin/startup.sh

在linux火狐中访问localhost:8080,测试成功

最全Linux下安装JAVAEE环境_第1张图片

打开防火墙,远程测试成功

查询端口是否打开 firewall-cmd --permanent --query-port=8080/tcp
打开8080端口 firewall-cmd --permanent --add-port=8080/tcp
刷新 firewall-cmd --reload

最全Linux下安装JAVAEE环境_第2张图片

安装Mysql8

https://blog.csdn.net/atongmu2017/article/details/90610444?ops_request_misc=&request_id=&biz_id=102&utm_term=linux%E5%AE%89%E8%A3%85mysql8.0&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-7-90610444.nonecase&spm=1018.2226.3001.4187

官网

https://dev.mysql.com/downloads/mysql/

最全Linux下安装JAVAEE环境_第3张图片

img

解压

通过xftp6上传到/usr/local下
解压tar -xvf mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz
mv mysql-8.0.28-linux-glibc2.12-x86_64 mysql 【重命名】

创建用户和组并授权

一般习惯将用户和组命名为mysql,也可以是其他的

cd /usr/local/  
groupadd mysql  #增加组
useradd -r -g mysql mysql #增加用户并加入mysql组

cd mysql/  #注意:进入mysql文件下授权所有的文件
chown -R mysql:mysql ./ #把mysql文件夹所有文件所有者变为mysql组的mysql用户

修改用户密码

passwd mysql   #修改mysql用户密码

123456

最全Linux下安装JAVAEE环境_第4张图片

在/usr/local/mysql目录下,创建data文件夹

mkdir data

初始化数据库

会自动生成随机密码,先记住

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

JhBxd#nI<7Yj

修改/usr/local/mysql当前目录得用户

chown -R root:root ./
chown -R mysql:mysql data

最全Linux下安装JAVAEE环境_第5张图片

生成my.cnf文件

cd support-files/
touch my-default.cnf
chmod 777 ./my-default.cnf 
cd ../
cp support-files/my-default.cnf /etc/my.cnf 

配置my.cnf

vim /etc/my.cnf

到虚拟机打开终端复制

[mysqld]
 
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
 
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
 
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /tmp/mysql.sock
log-error = /usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mysql.pid
tmpdir = /tmp
port = 3306
#lower_case_table_names = 1
# server_id = .....
# socket = .....
#lower_case_table_names = 1
max_allowed_packet=32M
default-authentication-plugin = mysql_native_password
#lower_case_file_system = on
#lower_case_table_names = 1
log_bin_trust_function_creators = ON
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

如果后期mysql运行报错,可以直接到log-error = /usr/local/mysql/data/error.log

目录下直接查看错误日志

命令:cat /usr/local/mysql/data/error.log

设置开机自启动

cd support-files/
cp mysql.server /etc/init.d/mysql 
chmod +x /etc/init.d/mysql

注册服务

chkconfig --add mysql
chkconfig --list mysql

最全Linux下安装JAVAEE环境_第6张图片

配置路径

vim /etc/ld.so.conf
 
添加如下内容:
/usr/local/mysql/lib

配置环境变量

vim /etc/profile
添加如下内容:
#MYSQL ENVIRONMENT
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib
source /etc/profile

登录 修改密码

cd /usr/local/mysql/bin
mysql -uroot -p
这里输入之前生成的密码
alter user 'root'@'localhost' identified by '123456'; 修改密码
exit后用新密码重新连接

最全Linux下安装JAVAEE环境_第7张图片

开启远程连接

# mysql -uroot -p #进入数据库
> use mysql;#进入数据库
> select host, user, authentication_string, plugin from user;#查看用户信息
> GRANT ALL ON *.* TO 'root'@'%';#授权root用户可以远程登陆
> flush privileges;#立即生效
> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';#修改root用户密码
> FLUSH PRIVILEGES;#立即生效
> exit;#退出
# service mysql restart#重启mysql服务

注意:GRANT ALL ON . TO ‘root’@‘%’;报错解决

update user set host='%' where user='root'; #修改host
GRANT ALL ON *.* TO 'root'@'%';
GRANT ALL ON *.* TO 'root'@'%'; #连续输入两次 解决

最全Linux下安装JAVAEE环境_第8张图片

使用sqlyog远程连接

先打开3306端口

查询端口是否打开 firewall-cmd --permanent --query-port=3306/tcp
打开3306端口 firewall-cmd --permanent --add-port=3306/tcp
刷新 firewall-cmd --reload

最全Linux下安装JAVAEE环境_第9张图片

连接成功

连接不上使用下面的方法

https://www.cnblogs.com/zhangxiaoxia/p/13043508.html

安装Mysql5

参考hsp的教程

韩顺平教育–centos安装mysql5.7.docx

安装Idea

  1. 下载地址: https://www.jetbrains.com/idea/download/Hsection=windows
  2. 解压缩到/opt
  3. mv 到 /usr/local/idea
  4. 启动idea bin目录下.idea.sh【在虚拟机里操作】

你可能感兴趣的:(技术类,linux,java-ee,tomcat)