zoukankan      html  css  js  c++  java
  • Linux系统:第十章:服务器环境搭建

    将防火墙关闭并设置为开机不自动启动:

    systemctl stop firewalld.service

    systemctl disable firewalld.service

    Linux系统中JDK的安装与配置

    进入opt目录下 :cd /opt

    在opt目录下上传jdk文件 :jdk-8u152-linux-x64.tar.gz

    解压 :tar -zxvf jdk-8u152-linux-x64.tar.gz

    进入etc目录下:cd /etc

    备份:cp profile profile.bak

    修改:vim profile

    大写G,进入文件末尾,输入i进行修改模式,末尾添加以下配置:
     

    JAVA_HOME=/opt/jdk1.8.0_152
    
    PATH=$JAVA_HOME/bin:$PATH
    
    export JAVA_HOME PATH

    然后保存退出:按Esc+:wq

    执行当前连接刚刚配置的脚本文件使配置文件生效:source /etc/profile     或者reboot重启

    查看jdk版本:java -version

    java version "1.8.0_152"
    Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
    Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

    查看:path路径:echo $PATH

    /opt/jdk1.8.0_152/bin:/opt/jdk1.8.0_152/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

    查看:JAVA_HOME路径:echo $JAVA_HOME

    /opt/jdk1.8.0_152

    Tomcat安装与配置

    进入opt目录:cd /opt

    在opt目录下上传apache-tomcat-8.5.24.tar.gz

    解压: tar -zxvf apache-tomcat-8.5.24.tar.gz

    启动tomcat: /opt/apache-tomcat-8.5.24/bin/startup.sh

    如果报错进入logs目录查看:cd /opt/apache-tomcat-8.5.24/logs

    查看日志:less catalina.out

    MySQL的安装与配置

    进入opt目录:cd /opt

    在opt目录下上传MySQL-server-5.5.52-1.el6.x86_64.rpm和MySQL-client-5.5.52-1.el6.x86_64.rpm

    忽略依赖关系执行删除:rpm -e --nodeps mariadb-libs-1:5.5.56-2.el7.x86_64

    安装服务端:rpm -ivh /opt/MySQL-server-5.5.52-1.el6.x86_64.rpm

    安装客户端:rpm -ivh /opt/MySQL-client-5.5.52-1.el6.x86_64.rpm

    查看版本:mysqladmin --version

    mysqladmin  Ver 8.42 Distrib 5.5.52, for Linux on x86_64

    启动MySQL服务:systemctl start mysql.service

    查看服务状态:systemctl status mysql.service

    查看端口:netstat -anp|grep 3306

    查看mysql运行的进程:ps -ef|grep mysql|grep -v grep

    设置root用户和密码:mysqladmin -u root password

    New password:
    Confirm new password:

    登录mysql: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.5.52 MySQL Community Server (GPL)

    Copyright (c) 2000, 2016, 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>

    查看数据库:show databases;

    使用test数据库:user test;

    查看表:show tables;

    退出:exit;

    然后去windows的sqlYog连接,主机改为linux连接:192.168.134.100,用户名:root,密码:root

    测试连接不上,linux中查看防火墙:systemctl status firewalld.service

    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
       Active: inactive (dead)
         Docs: man:firewalld(1)
    
    8月 12 07:32:47 rich systemd[1]: Starting firewalld - dynamic firewall daemon...
    8月 12 07:32:47 rich systemd[1]: Started firewalld - dynamic firewall daemon.
    8月 12 07:32:47 rich firewalld[721]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
    8月 12 07:32:47 rich firewalld[721]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
    8月 12 07:32:47 rich firewalld[721]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
    8月 12 07:32:47 rich firewalld[721]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
    8月 12 07:32:47 rich firewalld[721]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
    8月 12 07:32:47 rich firewalld[721]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
    8月 12 09:30:57 rich systemd[1]: Stopping firewalld - dynamic firewall daemon...
    8月 12 09:30:59 rich systemd[1]: Stopped firewalld - dynamic firewall daemon.

    防火墙关了,没问题,应该是mysql授权问题

    登录mysql:mysql -u root -p

    查看数据库:show databases;

    使用mysql数据库:user mysql;

    查看表:show tables;

    查看用户表:select host,user,password from user;

    插入一条数据到用户表中(密码复制localhost的密码):insert into user(host,user,password) values('%','root','81F5E21E35407D884A6CD4A731AEBFB6AF209E1B');

    为root授权: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY'root' WITH GRANT OPTION;

    Query OK, 0 rows affected (0.00 sec)

    退出mysql:mysql exit;

    重启mysql服务:service mysql restart;或者systemctl restart mysql.service

    Shutting down MySQL... SUCCESS! 
    Starting MySQL.. SUCCESS! 

    去windows的sqlYog连接,连接成功!

     

     

     

  • 相关阅读:
    还需要做恰当的解读,此时你可能需要一些书:
    创业公司的架构演进史
    任务调度平台Cuckoo-Schedule
    ORACLE中死锁
    Action的模型绑定
    三次握手、四次握手、backlog
    Django框架
    扩展BootstrapTable的treegrid功能
    Identity Service
    Linux权限
  • 原文地址:https://www.cnblogs.com/javawxid/p/12811902.html
Copyright © 2011-2022 走看看