发布于 5年前

CentOS/RHEL 上安装 Tomcat 服务器

说明

Apache Tomcat 见 http://tomcat.apache.org/

第一步 确定你安装了 JAVA

java --version

第二步 从官方下载 apache tomcat

下载链接 http://tomcat.apache.org/download-70.cgi , 选择 tar.gz 的链接

    cd /opt
    wget http://apache.techartifact.com/mirror/tomcat/tomcat-7/v7.0.37/bin/apache-tomcat-7.0.37.tar.gz

第三步 解压压缩包

    tar xzf apache-tomcat-7.0.37.tar.gz

第四步 开启 tomcat 服务器

    cd /opt/apache-tomcat-7.0.37
    ./bin/startup.sh

输出

    Using CATALINA_BASE:   /opt/apache-tomcat-7.0.37
    Using CATALINA_HOME:   /opt/apache-tomcat-7.0.37
    Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.37/temp
    Using JRE_HOME:        /usr
    Using CLASSPATH:       /opt/apache-tomcat-7.0.37/bin/bootstrap.jar:/opt/apache-tomcat-7.0.37/bin/tomcat-juli.jar

第五步 访问测试下, 默认的 tomcat 端口是 8080

    # curl http://127.0.0.1:8080

第六步 设置用户帐号

编辑 conf/tomcat-users.xml 文件

    # user manager can access only manager section.
    < role rolename="manager-gui" />
    < user username="manager" password="manager password" roles="manager-gui" />
    # user admin can access manager and admin section both.
    < role rolename="admin-gui" />
    < user username="admin" password="admin password" roles="manager-gui,admin-gui" />
©2020 edoou.com   京ICP备16001874号-3