tsung性能测试环境部署脚本

#!/bin/bash

#system init

#sysctl.conf
echo "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse=1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle=1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_fin_timeout=30" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range=1024 65535" >> /etc/sysctl.conf
echo "fs.nr_open=10240000" >> /etc/sysctl.conf
echo "fs.file-max=10240000" >> /etc/sysctl.conf
sysctl -p

#firewalld
systemctl disable firewalld.service

#ulimit
echo "* soft nofile 1024000" > /etc/security/limits.conf
echo "* hard nofile 1024000" >> /etc/security/limits.conf
echo "* soft nproc 1024000" >> /etc/security/limits.conf
echo "* hard nproc 1024000" >> /etc/security/limits.conf

echo "root soft nproc unlimited" > /etc/security/limits.d/20-nproc.conf

#sshd
sed -i 's/#RSAAuthentication/RSAAuthentication/g' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication/PubkeyAuthentication/g' /etc/ssh/sshd_config

systemctl restart sshd.service


#yum
yum -y install unixODBC unixODBC-devel perl perl-devel gcc openssl-devel gcc-c++ ncurses-devel gtk2-devel gnuplot gd libpng zlib bzip2 cpan mesa* freeglut* wget

#install soft
cd /usr/local/src
#此处根据包的实际路径去获取,这里因为将安装包放到了内网环境,因此可以直接获取,否则需要需官网上下载
#wget http://192.168.0.100:10086/tsung/{otp_src_20.2.tar.gz,Template-Toolkit-2.26.tar.gz,tsung-1.7.0.tar.gz,wxWidgets-3.1.0.tar.bz2}
wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.0/wxWidgets-3.1.0.tar.bz2
wget http://erlang.org/download/otp_src_20.2.tar.gz
wget http://cpan.org/modules/by-module/Template/Template-Toolkit-2.26.tar.gz
wget http://tsung.erlang-projects.org/dist/tsung-1.7.0.tar.gz

tar -xf wxWidgets-3.1.0.tar.bz2
cd wxWidgets-3.1.0
./configure --with-opengl --enable-debug --enable-unicode >/dev/null
if [ $? != "0" ];then
echo "wxWidgets-3.1.0 configure fail "
exit 100
fi
make >/dev/null && make install >/dev/null
if [ $? != "0" ];then
echo "wxWidgets-3.1.0 make fail "
exit 100
fi
echo " wxWidgets install successful"

cd /usr/local/src
tar xf otp_src_20.2.tar.gz
cd otp_src_20.2
./configure --prefix=/usr/local/erlang >/dev/null
if [ $? != "0" ];then
echo "otp_src_20.2 configure fail "
exit 100
fi
make >/dev/null && make install >/dev/null
if [ $? != "0" ];then
echo "otp_src_20.2 make fail "
exit 100
fi
ln -sf /usr/local/erlang/bin/erl /usr/local/bin/erl
echo "erlang install successful"

echo "ERLANG_HOME=/usr/local/erlang" >> /etc/profile
echo "TSUNG_HOME=/usr/local/tsung1.7" >> /etc/profile
echo 'PATH=$TSUNG_HOME/bin:$ERLANG_HOME/bin:$PATH' >> /etc/profile
echo 'export TSUNG_HOME ERLANG_HOME PATH' >> /etc/profile
source /etc/profile

cd /usr/local/src
tar zxf tsung-1.7.0.tar.gz
cd tsung-1.7.0
./configure --prefix=/usr/local/tsung1.7 >/dev/null
if [ $? != "0" ];then
echo "tsung-1.7.0 configure fail "
exit 100
fi
make >/dev/null && make install >/dev/null
if [ $? != "0" ];then
echo "tsung-1.7.0 make fail "
exit 100
fi
ln -sf /usr/local/tsung1.7/bin/tsung /usr/local/bin/tsung
echo "tsung install successful"


echo '''
192.168.0.1 master
192.168.0.2 slavea
192.168.0.3 slaveb
192.168.0.4 slavec
192.168.0.5 slaved
192.168.0.6 slavee
192.168.0.7 slavef
192.168.0.8 slaveg
192.168.0.9 slaveh
192.168.0.10 slavei
192.168.0.11 slavej
''' >> /etc/hosts


#cd /usr/local/src
#tar zxf Template-Toolkit-2.26.tar.gz
#cd Template-Toolkit-2.26
#cpan App::cpanminus

原文地址:https://www.cnblogs.com/NiceTime/p/8554730.html