• ubuntu JavaWeb环境搭建



    JVM
    ====================================
    将下载的文件解压到/home/lb/java/jvm目录下
    sudo tar zxvf jdk-8u20-linux-i586.tar.gz -C /home/lb/java/jvm

    添加环境变量:
    sudo gedit /etc/profile

    JAVA_HOME=/home/lb/java/jvm/jdk1.8.0_20
    PATH=$JAVA_HOME/bin:$PATH
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export JAVA_HOME
    export PATH
    export CLASSPATH

    让配置文件生效

    .  /etc/profile


    tomcat
    ====================================
    sudo tar zxvf apache-tomcat-7.0.61.tar.gz -C /home/lb/java/tomcat

    配置环境变量:
    sudo gedit /etc/profile
    export CATALINA_HOME=/home/lb/java/tomcat/tomcat7
    export CLASSPATH=.:$JAVA_HOME/lib:$CATALINA_HOME/lib
    export PATH=$PATH:$CATALINA_HOME/bin

    source /etc/profile 没有错误,就是设置成功
    catalina.sh 查看权限
    chmod +x *.sh 给tomcat/bin下面的sh赋予权限
    chmod +x logs 给tomcat/logs赋予权限


    打开tomcat: ./startup.sh
    关闭tomcat: ./shutdown.sh
    查看日志文件:tail -f catalina.out
    查看最后200行日志文件:tail -n 200 catalina.out
    退出查看日志文件:Ctrl+c

    当前目录./
    上一级目录../
    当前用户目录 cd ~


    mysql
    ====================================
    在线安装:sudo apt-get install mysql-server

    本地登录:mysql -u root -p

    远程登录:mysql -h ip -u root -p

    浏览数据库:show databases;

    查看当前数据库:select database();

    查看当前用户:select user();

    切换数据库:use mysql;

    浏览表:show tables;

    网上安装或者二进制安装的可以直接使用如下命令启动和停止mysql:
    /etc/init.d/mysql start|stop|restart

    查看字符集:show variables like 'character%';

    设置远程访问权限:
    use mysql;
    update user set host = '%' where user = 'root';
    select host, user from user;
    flush privileges;

    开放端口号:
    解决方法:修改/etc/mysql/my.cnf文件。打开文件,找到下面内容:
    bind-address = 127.0.0.1
    把上面这一行注释掉或者把127.0.0.1换成合适的IP,建议注释掉。
    重新启动后,重新使用netstat检测:
    检测监听:netstat -an | grep 3306


    eclipse
    ====================================
    sudo tar zxvf eclipse-jee-luna-SR1-linux-gtk.tar.gz -C /home/lb/java/eclipse

     

     

  • 相关阅读:
    Java初试
    could not insert new action connection could not find any information for the class named
    GIT 从入门到放弃大整理
    'XCTest/XCTest.h' file not found
    The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
    后台数据为空因此程序闪退
    UISearchController Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior
    AFNetworking request failed unacceptable content type text/html
    Xcode找不到模拟器
    如何查看设备的 UDID
  • 原文地址:https://www.cnblogs.com/e-mc/p/4525551.html
Copyright © 2020-2023  润新知