TCP.info

Konia Zheng

Network Product Designer

脚本备忘

Description

存放常见的运维命令、脚本

Operate System Release

Debian

python tesseract 图像库

# 安装tesseract
aptitude install libtesseract-dev libtesseract3 tesseract-ocr tesseract-ocr-eng -y

# 安装python-dev unzip
aptitude install python2.7-dev unzip -y

# 安装jpeg zlib库
aptitude install libjpeg-dev zlib1g-dev libpng12-dev -y

# 创建软链接
# 32位系统:
[ ! -s /usr/lib/libjpeg.so ] \
    && [ -s /usr/lib/i386-linux-gnu/libjpeg.so ] \
    && ( ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/libjpeg.so )

[ ! -s /usr/lib/libz.so ] \
    && [ -s /usr/lib/i386-linux-gnu/libz.so ] \
    && ( ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/libz.so )

# 64位系统
[ ! -s /usr/lib/libjpeg.so ] \
    && [ -s /usr/lib/x86_64-linux-gnu/libjpeg.so ] \
    && ( ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/libjpeg.so )

[ ! -s /usr/lib/libz.so ] \
    && [ -s /usr/lib/x86_64-linux-gnu/libz.so ]
    && ( ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/libz.so )

# 安装pip
aptitude install python-pip -y

# 安装 pillow pytesseract
pip install pillow pytesseract

socks5

wget --no-check-certificate \
    https://raw.github.com/Lozy/danted/master/install.sh -O /root/sockd.sh \
    && bash /root/sockd.sh \
    --whitelist-url="https://script.nie.link/cfg/white.list" \
    --from-package \
    --port= --user= --passwd=

shodowsocks

wget --no-check-certificate \
    https://script.nie.link/ss.sh -O /root/ss.sh \
    && bash /root/ss.sh

升级 4.9x 内核以及开启bbr

echo "deb http://ftp.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
apt-get update

aptitude install -yyy -o Aptitude::ProblemResolver::SolutionCost='100*canceled-actions,200*removals' \
    linux-image-4.9.0-3.bpo.2-amd64

[ -z "$(grep 'net.core.default_qdisc=fq' /etc/sysctl.conf)" ] && \
    echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
[ -z "$(grep 'net.ipv4.tcp_congestion_control=bbr' /etc/sysctl.conf)" ] && \
    echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf

安装nftables

aptitude install git git-core -y
aptitude install libmnl0 libjansson4 -y

aptitude install pkg-config autoconf automake libtool libmnl-dev -y
aptitude install bison flex libgmp-dev libreadline-dev -y

git clone git://git.netfilter.org/libnftn
cd libnftnl/
sh autogen.sh
./configure --libdir /usr/lib
make && make install
cd ../

git clone git://git.netfilter.org/nftables
cd nftables/
sh autogen.sh
./configure
make && make install

nft --version