服务器访问地址:
Ip:192.168.2.110 账号 root 密码:ahies@0823
本次软件环境版本配置以及路径:
jdk:/usr/java/jdk1.8.0_151
mysql:/home/mysql56(mysql5.6版本) 账号:root 密码:rabbit123@
rabbitmq:账号 luke 密码 luke http://192.168.2.110:15672/
zookeeper:版本 3.4.6 路径:/usr/local/services/zookeeper/zookeeper-3.4.6(单机,未配置zookeeper集群)
redis:端口6369 路径:/home/redis-4.0.6
node.js 6.12.0
需要安装的环境目录:
一、基础环境
Sun JDK 1.8.0_77(需先检查linux是否已经安装openjdk,如果安装,需要先卸载)
2、MySQl 5.6
用户名:root
密码:rabbit123@
3、rabbitmq
用户名luke 密码luke
4、zookeeper 3.4.6
5、redis
端口:6369
6、node.js 6.12.0
二、配置安装
1、jdk配置
2、mysql安装(本次为离线安装)
步骤一:解压
(1), tar -zxvfmysql-5.6.38-linux-glibc2.12-x86_64.tar.gz 解压后更改名称为mysql56,如:/home/mysql56
步骤二: vi /etc/my.cnf
[mysqld]
basedir=/home/mysql56
datadir=/home/mysql56/data
socket=/tmp/mysql.sock
lower_case_table_names=1
user=root
#default-character-set=utf8
character-set-server=utf8
# Disabling symbolic-links isrecommended to prevent assorted security risks
symbolic-links=0
[client]
default-character-set=utf8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
步骤三:初始化数据库
Mysql5.6
/home/mysql56/scripts/mysql_install_db--basedir=/home/mysql56 --datadir=/home/mysql56/data --user=root
步骤四:复制启动服务文件:
cp /home/mysql56/support-files/mysql.server/etc/init.d/mysql
步骤五:
改密码
setpassword=password('rabbit123@');
赋权
grant all privileges on *.* to'root'@'%' identified by 'rabbit123@';
刷新权限
flush privileges;
3. rabbitmq安装配置:
(1)下载安装包 https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
(2)rpm -Uvherlang-solutions-1.0-1.noarch.rpm
(3)yuminstall epel-release
(4)yuminstall erlang
(5)下载 http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.6/rabbitmq-server-3.6.6-1.el7.noarch.rpm
(6)yuminstall rabbitmq-server-3.6.6-1.el7.noarch.rpm
完成后启动服务:
service rabbitmq-serverstart
可以查看服务状态:
service rabbitmq-serverstatus
rabbitmq-plugins enablerabbitmq_management
curl http://192.168.2.110:15672
打开15672端口
11、iptables -IINPUT -p tcp --dport 15672 -j ACCEPT
打开5672端口
12、iptables -IINPUT -p tcp --dport 5672 -j ACCEPT
13、13、rabbitmqctl add_user luke luke
14、rabbitmqctlset_user_tags luke administrator
15、cd/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.6/plugins
16、下载地址:https://dl.bintray.com/rabbitmq/community-plugins/rabbitmq_delayed_message_exchange-0.0.1.ez放到当前目录中
17、rabbitmq-pluginsenable rabbitmq_delayed_message_exchange
赋予vhost权限
rabbitmqctlset_permissions -p "/" luke ".*" ".*"".*"
三、Zookeeper安装
1. 创建 /usr/local/services/zookeeper 文件夹:
mkdir -p /usr/local/services/zookeeperer
2. 进入到 /usr/local/services/zookeeper 目录中:
cd /usr/local/services/zookeeper
3. 下载 zookeeper-3.4.6.tar.gz:并解压
4. 进入到 /usr/local/services/zookeeper/zookeeper-3.4.6/conf 目录中:
cd zookeeper-3.4.9/conf/
5. 复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:
cp zoo_sample.cfg zoo.cfg
6. 用 vim 打开 zoo.cfg 文件并修改其内容为如下:
# The number of milliseconds of each tick
# zookeeper 定义的基准时间间隔,单位:毫秒
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=/tmp/zookeeper
# 数据文件夹
dataDir=/usr/local/services/zookeeper/zookeeper-3.4.9/data
# 日志文件夹
dataLogDir=/usr/local/services/zookeeper/zookeeper-3.4.9/logs
# the port at which the clients will connect
# 客户端访问 zookeeper 的端口号
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
7. 保存并关闭 zoo.cfg 文件
8. 进入到 /usr/local/services/zookeeper/zookeeper-3.4.6/bin 目录中:
cd ../bin/
9. 用 vim 打开 /etc/ 目录下的配置文件 profile:
vim /etc/profile
并在其尾部追加如下内容:
# idea - zookeeper-3.4.6config start
export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.9/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
# idea - zookeeper-3.4.6 config start - 2016-09-08
10. 使 /etc/ 目录下的 profile 文件即可生效:
source /etc/profile
11. 启动 zookeeper 服务:
zkServer.sh start
如打印如下信息则表明启动成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
12. 查询 zookeeper 状态:
zkServer.sh status
13. 关闭 zookeeper 服务:
zkServer.sh stop
如打印如下信息则表明成功关闭:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
14. 重启 zookeeper 服务:
zkServer.sh restart
如打印如下信息则表明重启成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
五、redis安装参照以下博客执行安装(其中端口在执行时更改为6369)
http://blog.csdn.net/u011365831/article/details/78225993?locationNum=6&fps=1
六、node.js
直接从yum安装即可,命令参考 yum -y install nodejs
七 nginx安装
下载依赖包
1. gzip模块需要 zlib 库 ( 下载:http://www.zlib.net/ )
2.rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )
3.ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ )
openssl :
[root@localhost] tar -zxvf openssl-fips-2.0.16.tar.gz
[root@localhost] cd openssl-fips-2.0.16
[root@localhost] ./config && make && make install
pcre:
[root@localhost] tar zxvf pcre-8.36.tar.gz
[root@localhost] cd pcre-8.36
[root@localhost] ./configure && make && make install
zlib:
[root@localhost]tar zxvf zlib-1.2.8.tar.gz
[root@localhost] cd zlib-1.2.8
[root@localhost] ./configure && make && make install
最后安装nginx
[root@localhost]tar zxvf nginx-1.8.0.tar.gz
[root@localhost] cd nginx-1.8.0
[root@localhost] ./configure && make && make install
通过whereis找到 nginx安装目录
[root@EOSSVR nginx]# whereis nginx
nginx: /usr/local/nginx
启动直接输入:
/usr/local/nginx/sbin/nginx
如果出现端口占用情况:
可运行lsof -i:占用端口号(yuminstall lsof安装),然后kill -9 端口号
启动成功后,输入服务器ip,直接访问: