1.安装jdk1.8

官网下载地址:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

选择操作系统和对应的文件进行下载

直接下载tar.gz版本,不用安装,直接解压就可以

下载完以后,解压到/usr/local目录

[root@bogon hcb]# tar zxvf jdk-8u211-linux-x64.tar.gz -C /usr/local

配置环境变量

输入 vi /etc/profile 在文件最后输入

export JAVA_HOME=/usr/local/jdk1.8.0_211
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

让配置的文件生效 ,以及测试jdk是否安装正确

[root@localhost hcb]# source /etc/profile
[root@localhost hcb]# java -version
java version "1.8.0_211"

2.安装tomcat

官方网内打不开了。 直接通过镜像下载

https://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.5.42/bin/

同样解压安装就可以

tar zxvf apache-tomcat-8.5.42.tar.gz -C /usr/local
  1. 建立一个tomcat的快捷方式
ln -s apache-tomcat-8.5.42 tomcat
  1. 启动:
[root@bogon tomcat]# pwd
/usr/local/tomcat
[root@bogon tomcat]# ./bin/startup.sh 

3.添加防火墙例外,并重启

[root@bogon tomcat]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@bogon tomcat]# firewall-cmd --reload

4.物理机输入ip地址测试

3.安装Mysql

因为centos 7 默认源mariadb替换了mysql

所以要把mysql先添加到源上

  1. 下载mysql源安装包

    如果 Centos 系统版本大于7,默认源使用 mariadb 替换掉了 MySQL, 如果仍要安装 MySQL,只能采取源码安装。
  2. 安装mysql源

    yum localinstall mysql57-community-release-el7-8.noarch.rpm
  3. 检查mysql的源是否安装成功

    yum repolist enabled | grep “mysql.-community.”
  4. 安装Mysql

    yum install mysql-community-server
  5. 启动Mysql

    systemctl start mysqld
  6. 查看默认的root密码

    [root@bogon hcb]# grep 'temporary password' /var/log/mysqld.log 
    2019-06-18T05:11:11.189330Z 1 [Note] A temporary password is generated for root@localhost: k(VPiD:wg7lh
  7. 修改root密码

提示;ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

这是表示 你的新密码安全强度不够。增强密码强度就可以,注意区分大小写

[root@bogon hcb]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.26

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xdafdafdsaf2123231';
  
  1. 如何关闭密码策略

    vi /etc/my.cnf 中最后添加 下面一行。表示 关闭密码策略
    validate_password=off
  2. 重启mysql后生效

    systemctl restart mysqld
  3. mysql设定开机启动

    [root@bogon hcb]# systemctl enable mysqld
    [root@bogon hcb]# systemctl daemon-reload
systemctl 是centos7中用于控制系统服务的。以 前版本是service xxx start|stop

daemon 是linux的守护进程 ,用于后台长期不间断运行的程序


参考:https://blog.csdn.net/yuanlaijike/article/details/78877830


本文由 hcb 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论