nginx、rabbitmq、redis、zookeeper、zkui安装脚本

nginx安装脚本

#!/bin/bash
yum install -y wget pcre-devel openssl openssl-devel gcc
###安装perl###
cd /usr/local/
wget http://www.cpan.org/src/5.0/perl-5.24.1.tar.gz
tar zxvf perl-5.24.1.tar.gz 
cd perl-5.24.1
./Configure -des -Dprefix=/usr/local/perl
make && make install
cd /usr/bin/
mv -f perl perl.old
ln -s /usr/local/perl/bin/perl /usr/bin/perl
###安装openssl###
cd /usr/local/
wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1q.tar.gz
tar zxvf openssl-1.0.1q.tar.gz
cd openssl-1.0.1q
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' --prefix=/usr/local/ssl shared zlib-dynamic
make && make install 
cd /usr/bin/
mv -f openssl openssl.old
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
#####安装tengine#####
cd /usr/local
wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
tar zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --prefix=/usr/local/nginx --with-http_stub_status_module  --with-pcre --with-http_upstream_check_module --with-http_spdy_module --dso-path=/usr/local/nginx/dso/module/ --with-http_ssl_module --with-openssl=/usr/local/openssl-1.0.1q
make && make install
#####删除下载包####
cd /usr/local
rm -rf tengine-2.1.2.tar.gz
rm -rf openssl-1.0.1q.tar.gz
rm -rf perl-5.24.1.tar.gz
#rm -rf tengine-2.1.2
#rm -rf openssl-1.0.1q
#rm -rf perl-5.24.1
/usr/bin/find /usr/local -name "*.gz" |/usr/bin/xargs -r /bin/rm -f

rabbitmq安装脚本

#!/bin/bash
yum -y install epel-release
yum -y install wget pcre-devel openssl openssl-devel gcc
yum -y install erlang
cat /var/lib/rabbitmq/.erlang.cookie
####环境设置#####
echo fs.file-max = 100000 >> /etc/sysctl.conf
#####安装rabbitmq#####
rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
yum -y install https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm

####判断是否添加开机启动######
systemctl is-enabled rabbitmq-server
if [ $? -eq 0 ];then
        break
else
        systemctl enable rabbitmq-server
fi

systemctl start rabbitmq-server

redis 安装脚本

#!/bin/bash
yum -y install epel-release
yum -y install wget pcre-devel openssl openssl-devel gcc
#####安装redis#####
cd /usr/local/
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar zxvf redis-4.0.11.tar.gz
mv redis-4.0.11 redis
cd /usr/local/redis
make MALLOC=libc
mkdir -p /etc/redis/conf
cd src && make install
cp /usr/local/redis/redis.conf /etc/redis/conf/
#cp /usr/local/redis/src/redis-server /usr/local/bin/
#cp /usr/local/redis/src/redis-cli /usr/local/bin/
#cp /usr/local/redis/src/redis-benchmark /usr/local/bin/
####判断是否添加开机启动######
mkdir -p /etc/redis/log
mkdir -p /etc/redis/pid
mkdir -p /etc/redis/data
cd /usr/local
rm -rf redis-4.0.11.tar.gz

zkui 安装脚本

#!/bin/bash
yum install -y wget pcre-devel openssl openssl-devel gcc git
##构建程序###
cd /usr/local/
git clone https://github.com/DeemOpen/zkui.git
cd zkui/
yum install -y maven
mvn clean instal 
cp config.cfg target/
cd target
####根据zookeeper的数量,进行配置config.cfg中的serverPort和zkServer

##启动程序至后台
nohup java -jar zkui-2.0-SNAPSHOT-jar-with-dependencies.jar &

zookeeper 安装脚本

#!/bin/bash
yum -y install epel-release
yum -y install wget pcre-devel openssl openssl-devel gcc
###安装java 环境###
yum -y install java-1.8.0-openjdk*
#####环境变量设置#####
echo ZOOKEEPER_HOME=/usr/local/zookeeper >> /etc/profile && \
echo JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk >> /etc/profile && \
echo CLASSPATH=/usr/lib/jvm/java-1.8.0-openjdk/lib/dt.jar:/usr/lib/jvm/java-1.8.0-openjdk/lib/tools.jar >> /etc/profile && \
echo PATH=/usr/lib/jvm/java-1.8.0-openjdk/bin:$PATH:/usr/local/zookeeper/bin >> /etc/profile && \
echo export PATH JAVA_HOME CLASSPATH ZOOKEEPER_HOME >> /etc/profile 
source /etc/profile 

####源码安装zookeeper#######
cd /usr/local
wget https://www.apache.org/dist/zookeeper/stable/zookeeper-3.4.14.tar.gz
tar -zxvf zookeeper-3.4.14.tar.gz
mv zookeeper-3.4.14 /usr/local/zookeeper
cd /usr/local/zookeeper/conf
cp zoo_sample.cfg zoo.cfg
####修改配置文件#######
echo dataDir=/usr/local/zookeeper/data >> /usr/local/zookeeper/conf/zoo.cfg && \
echo dataLogDir=/usr/local/zookeeper/logs >> /usr/local/zookeeper/conf/zoo.cfg && \
echo server.1=192.168.1.116: 2888:3888 >> /usr/local/zookeeper/conf/zoo.cfg && \
echo server.2=192.168.1.117: 2888:3888 >> /usr/local/zookeeper/conf/zoo.cfg && \
echo server.3=192.168.1.116: 2888:3888 >> /usr/local/zookeeper/conf/zoo.cfg && \
echo server.4=192.168.1.116: 2888:3888 >> /usr/local/zookeeper/conf/zoo.cfg && \
echo server.5=192.168.1.116: 2888:3888 >> /usr/local/zookeeper/conf/zoo.cfg && \
mkdir -p /usr/local/zookeeper/data && \
touch /usr/local/zookeeper/data/myid && \
echo "1" >> /usr/local/zookeeper/data/myid

#####删除下载文件########
cd /usr/local
rm -rf zookeeper-3.4.14.tar.gz 
echo "install over"
上一篇:apt update秘钥过期解决方法


下一篇:redis生产者和消费者的实现和Redis阻塞操作实现原理