9.2 1.systemctl stop firewalld.service systemctl disable firewalld.service (关闭防火墙设置开机不自启)
2.hostnamectl set-homename tomcat (改主机名)
3.安装JDK和Tomcat包并放到/usr/local/src下,并且解压
Tar zxvf jdk/tomcat 路径
4.创建/usr/local/jdk1.8和/usr/local/tomcat目录
mkdir /usr/local/jdk1.8 和 /usr/local/tomcat
5.移动解压后俩个包下的所有文件,到相应的目录下 mv jdk/* /usr/local/jdk1.8
mv ape/* /usr/local/tomcat
6.配置环境变量
/etc/profile中 添加以下
JAVA_HOME=/usr/local/jdk1.8/ JAVA_BIN=/usr/local/jdk1.8/bin JRE_HOME=/usr/local/jdk1.8/jre PATH=$PATH:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/jre/bin CLASSPATH=/usr/local/jdk1.8/jre/lib:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib/charsets.jar
Source /etc/profile
7.检查jdk安装情况
Java -version
8.启动tomcat
/usr/local/tomcat/bin/startup.sh
9.测试
Netstat -lnpt | grep java
浏览器登录
配置监听端口80 编辑server.xml 中 修改 “8080”改为“80”
停止、启动 服务
/usr/local/tomcat/bin/shutdown.sh /usr/local/tomcat/bin/startup.sh
浏览器访问:192.168.100.40
配置Tomcat虚拟主机 下载一个zrlog
Yum -y install wget
wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war
将war包拷贝到/usr/local/tomcat/webapps/下
cp zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/
mv zrlog-1.7.1-baaecb9-release zrlog
用浏览器访问192.168.100.40/zrlog
首先安装数据库服务,创建zrlog数据库和zrlog用户 yum -y install mariadb mariadb-server systemctl start mariadb mysql_secure_installation create database zrlog; grant all on zrlog.* to ‘zrlog’@127.0.0.1 identified by ‘123123’;
检查用户是否能登录数据库
mysql -uzrlog -h127.0.0.1 -p123123
show databases;
网页中填写信息
主从同步 俩台虚拟机
1.修改主机名
hostnamectl set-hostname mysql1/mysql2
logout
2.两个节点关闭防火墙firewalld及SELinux服务
setenforce 0
systemctl stop firewalld
两个节点配置/etc/hosts192.168.200.40 mysql1 192.168.200.50 mysql2
配置YUM源并安装数据库服务yum install -y mariadb mariadb-server systemctl start mariadb systemctl enable mariadb
初始化数据库mysql_secure_installation 并设置密码
配置mysql1主节点cat /etc/my.cnf
[mysqld] log_bin = mysql-bin #记录操作日志 binlog_ignore_db = mysql #不同步mysql系统数据库 server_id = 40
重启数据库服务,并进入数据库systemctl restart mariadb
mysql -uroot -p123123
从节点同步主节点数据库的权限。grant all privileges on . to root@’%’ identified by “123123”;
grant replication slave on . to ‘user’@‘mysql2’ identified by ‘000000’;
同上配置mysql2节点的数据库配置文件 把id改为50
9.在从节点mysql2上登录MariaDB数据库
systemctl restart mariadb
mysql -uroot -p123123
开启从节点服务start slave;
show slave status\G
看到Slave_IO_Running和Slave_SQL_Running的状态都是Yes,配置数据库主从集群成功。
最后验证数据库主从服务
主节点创建库,在创建表。插入数据,完成后查看表数据