JDK+Tomcat+Zookeeper+DubboAdmin安装教程
JDK+Tomcat+Zookeeper+DubboAdmin安装教程
1. 安装内容:
JDK 1.8.131
Tomcat 7.0.77
Zookeeper 3.4.9
Dubbo admin 2.5.4-SNAPSHOT
2. 安装步骤:
2.1 JDK的安装
1. jdk安装
rpm包:
rpm -ivh /home/test/download/jdk-8u131-linux-x64.rpm
生成链接以便版本升级
ln -s jdk1.8.0_131 latest
ln -s latest default
2. 配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/java/default
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
3. 使配置生效
source /etc/profile
4. 测试jdk.
java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
2.2 Tomcat的安装
1. 解压缩
cd /home/test/
tar -zxvf /home/test/download/apache-tomcat-7.0.77.tar.gz
2. 启动Tomcat
cd /home/test/download/apache-tomcat-7.0.77/bin
./startup.sh
Using CATALINA_BASE: /home/test/apache-tomcat-7.0.77
Using CATALINA_HOME: /home/test/apache-tomcat-7.0.77
Using CATALINA_TMPDIR: /home/test/apache-tomcat-7.0.77/temp
Using JRE_HOME: /usr/java/default
Using CLASSPATH: /home/test/apache-tomcat-7.0.77/bin/bootstrap.jar:/home/test/apache-tomcat-7.0.77/bin/tomcat-juli.jar
Tomcat started.
3. 测试Tomcat:
在浏览器输入: http://ip:8080
出现tomcat的页面表示安装成功.
4. 停止Tomcat
./shutdown.sh
2.3 Zookeeper安装
解压
cd /home/test
tar -zxvf /home/test/download/zookeeper-3.4.9.tar.gz
配置zoo.cfg
vim /zookeeper-3.4.9/conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/test/zookeeper-3.4.9/data
dataLogDir=/home/test/zookeeper-3.4.9/log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
运行
./zookeeper-3.4.9/bin/zkServer.sh start
2.4 Dubboadmin的安装
修改端口为8090
vi server.xml
<Connector port="8080" protocol="HTTP/1.1"
改为
8090
删除tomcat ROOT文件夹 并新建空目录ROOT
cd /home/test/apache-tomcat-7.0.77/webapps
rm -rf ROOT
mkdir ROOT
解压dubboadmin war包到ROOT目录中
cd ROOT
jar -xvf /home/test/download/dubbo-admin-2.5.4-SNAPSHOT.war
修改dubbo配置
在ROOT/WEB-INF中修改dubbo.properties
重启tomcat
./bin/shutdown.sh
./bin/startup.sh
测试
在浏览器访问
一些出现的问题:
- 如果第一次启动tomcat有问题
请在JVM环境中解决
打开$JAVA_PATH/jre/lib/security/java.security
这个文件,找到下面的内容:
注意有时候默认是random,而不是urandom,记得加个u
securerandom.source=file:/dev/random
替换成
securerandom.source=file:/dev/./urandom
注意:在linux中部署web应用jar包时,如果启动特别慢,也可以按照上面方法进行修改
2.5 centos安装mysql
CentOS 7之后的版本yum的默认源中使用MariaDB替代原先MySQL,因此安装方式较为以往有一些改变:
下载mysql的源
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
安装yum库
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
安装MySQL
yum install -y mysql-community-server
启动MySQL服务
systemctl start mysqld.service
MySQL5.7加强了root用户的安全性,因此在第一次安装后会初始化一个随机密码,以下为查看初始随机密码的方式
grep 'temporary password' /var/log/mysqld.log
结果如下:
使用初始随机密码登录后MySQL会强制要求修改密码,否则无法正常使用,(密码必须包含小写、大写字母及特殊字符,当然也有其他方法不受此限制,再次不多做描述),修改方法如下:
SET PASSWORD = PASSWORD('your new password');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;
然后退出后即可用新密码登录。
远程连接授权:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;
开通端口(默认3306):
firewall-cmd --add-port=3306/tcp