需求:使用Tomcat部署一个Java应用(zrlog博客)。
添加一个虚拟主机
[root@dl-001 src]# vim /usr/local/tomcat/conf/server.xml //添加以下配置
<Host name="www.123.cn" appBase=""
unpackWARs= "true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/data/wwwroot/123.cn/" debug="0" reloadable="true" crossContext="true"/>
</Host>
下载zrlog-1.7.1,并cp到指定目录
[root@dl-001 src]# wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war
[root@dl-001 src]# ls /usr/local/tomcat/webapps/
docs examples host-manager manager ROOT
[root@dl-001 src]# ls
zrlog-1.7.1-baaecb9-release.war
[root@dl-001 src]# cp zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/
[root@dl-001 src]# ls /usr/local/tomcat/webapps/ //查看可以看出多了一个目录,自动解压了
docs host-manager ROOT zrlog-1.7.1-baaecb9-release.war
examples manager zrlog-1.7.1-baaecb9-release
修改zrlog的名字
[root@dl-001 webapps]# mv zrlog-1.7.1-baaecb9-release zrlog //为了防止再次自动解压,修改名字即可。
[root@dl-001 webapps]# ls
docs host-manager ROOT zrlog-1.7.1-baaecb9-release
examples manager zrlog zrlog-1.7.1-baaecb9-release.war
使用浏览器访问zrlog
说明:如上图需要使用mysql用户
查看Mysql是否启动
[root@dl-001 webapps]# ps aux |grep mysql
root 1430 0.0 0.1 115392 1484 ? S 10:40 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/dl-001.pid
mysql 1775 0.0 44.5 1038596 449452 ? Sl 10:40 0:19 /usr/local/mysql/bin/mysqd --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/dl-001.err --pid-file=/data/mysql/dl-001.pid --socket=/tmp/mysql.sock
root 3625 0.0 0.0 112680 972 pts/0 R+ 19:37 0:00 grep --color=auto mysql
创建zrlog相关数据库和用户
[root@dl-001 webapps]# mysql -uroot -p'mysqldl991124' //进入mysql
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.35 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> create database zrlog; //创建zrlog数据库;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on zrlog.* to 'zrlog'@'127.0.0.1' identified by 'mysqldl991124'; //创建用户
Query OK, 0 rows affected (0.13 sec)
mysql> quit
Bye
查看创建的用户是否正确
[root@dl-001 webapps]# mysql -uzrlog -h127.0.0.1 -p'mysqldl991124' //正确
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.35 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.
在浏览器上填写信息
说明:填写完之后,点击下一步
说明:填写密码和标题,之后点击下一步
说明:可以点击查看
说明:此时搭建的博客就可以写帖子了!!!