Linux——Java配置

Linux常用命令

pwd ——查看当前路径(print working directory(的缩写))

ls ——列出一个目录包含的文件及子目录

ls -a ——列出一个目录包含的文件及子目录(包括隐藏文件)

ls /usr ——列出指定目录包含的文件及子目录

image-20210731021413801

cd ——更改当前工作目录

image-20210731020618638

选项和参数

命令名经常会带有一个或多 个用来更正命令行为的选项,更进一步,选项后面会带有一个或多个参数,这些参数是命令作 用的对象。

command -options arguments

许多命令也允许把多个短选项串在一起使用

$ ls -lt
$ ls -lt --reverse

路径问题

绝对路径

绝对路径开始于根目录,紧跟着目录树的一个个分支,一直到达所期望的目录或文件。

/usr/ bin

相对路径

相对路径开始于工作目录,为了做到这个(用相 对路径表示),我们在文件系统树中用一对特殊符号来表示相对位置

这对特殊符号是 “.” (点) 和 “…” (点点)。

符号 “.” 指的是工作目录,

符号”…” 指的是工作目录的父目录

Ububtu防火墙

 sudo ufw enable
 sudo ufw disable 
 sudo ufw status  查看状态
 sudo ufw default deny 
 作用:开启了防火墙并随系统启动同时关闭所有外部对本机的访问(本机访问外部正常)。

JAVA安装配置——ububtu

FTP导入JDK文件

image-20210731154839392

解压缩

tar -zxvf jdk-8u301-linux-x64.tar.gz
image-20210731155000785

移动到创建的指定目录/usr/local/jdk8/

mkdir /usr/local/jdk8
mv jdk1.8.0_301/ /usr/local/jdk8/

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

vim /etc/profile

在文件的最后面设置环境变量

# 设置环境变量
# JDK
JAVA_HOME=/usr/local/jdk8/jdk1.8.0_301
CLASSPATH=.
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

刷新环境变量,让文件生效

source /etc/profile

查看当前已经配置的环境变量

echo $PATH

image-20210731160652780

查看JAVA版本

java -version

image-20210731160833065

Tomcat安装配置

解压缩

tar -zxvf apache-tomcat-8.5.69.tar.gz

进入bin目录

image-20210731161722614

启动Tomcat

sh startup.sh 
image-20210731161904112

验证一下

端口是否通

image-20210731162449432

成功!

image-20210731162647977

MySQL安装配置

解压缩

tar -zxvf mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz 
sudo apt-get install mysql-server
sudo apt install mysql-client
sudo apt install libmysqlclient-dev

验证安装成功
sudo netstat -tap | grep mysql
进入mysql,初始默认没有密码
mysql -u root -p

show databses;
image-20210731171232386

数据库初始化操作

为了确保数据库的安全性和正常运转,对数据库进行初始化操作。这个初始化操作涉及下面5个步骤。
(1)安装验证密码插件。
(2)设置root管理员在数据库中的专有密码。
(3)随后删除匿名账户,并使用root管理员从远程登录数据库,以确保数据库上运行的业务的安全性。
(4)删除默认的测试数据库,取消测试数据库的一系列访问权限。
(5)刷新授权列表,让初始化的设定立即生效。

对于上述数据库初始化的操作步骤,在下面的输出信息旁边做了简单注释。

root@ubuntu-virtual-machine:~# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin? #要安装验证密码插件吗?

Press y|Y for Yes, any other key for No: N # 这里我选择N
Please set the password for root here.

New password: #输入要为root管理员设置的数据库密码

Re-enter new password: #再次输入密码

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y #删除匿名账户
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N #禁止root管理员从远程登录,这里我没有禁止

... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y #删除test数据库并取消对它的访问权限
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y #刷新授权表,让初始化后的设定立即生效
Success.

All done!

检查Mysql服务状态

systemctl status mysql
image-20210731172252547

配置远程访问

配置mys

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

vim /etc/mysql/mysql.conf.d/mysqld.cnf

注释掉bind-address = 127.0.0.1

image-20210731170143399 image-20210731170157053
对于8.0以前的远程访问控制

GRANT ALL PRIVILEGES ON . TO ‘root’ @ ‘%’ IDENTIFIED BY ‘密码’ WITHHGRANT OPTION;

8.0以后
create user root@'%' identified by 'Aa123456@';
grant all privileges on *.* to root@'%' with grant option;
flush privileges;
image-20210731183056670

Mysql密码安全程度

SHOW VARIABLES LIKE 'validate_password%';
image-20210731182413850

qhzeng/markdown/raw/master/image/image-20210731183056670.png" alt=“image-20210731183056670” style=“zoom: 67%;” />

Mysql密码安全程度

SHOW VARIABLES LIKE 'validate_password%';
image-20210731182413850
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值