docker安裝snmp rrdtool環境
以Ubuntu16:04作為基礎版本
docker pull ubuntu:16.04
啟動一個容器
docker run -d -i -t --name flow_mete ubuntu:16.04 bash
進入容器
docker exec -it flow_mete bash
cd ~
安裝基本軟體
apt-get update && apt-get upgrade -y && apt-get install -y curl wget vim build-essential ca-certificates gcc git libpq-dev make python-pip python2.7 python2.7-dev ssh libmysqlclient-dev && apt-get autoremove && apt-get clean
安裝最新pip
python -m pip uninstall pip setuptools
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
ln -s /usr/local/bin/pip /usr/bin/pip && pip list
安裝net-snmp
wget https://sourceforge.net/projects/net-snmp/files/net-snmp/5.7.3/net-snmp-5.7.3.tar.gz
tar zxvf net-snmp-5.7.3.tar.gz
apt-get install libperl-dev
cd net-snmp-5.7.3
./configure --with-python-modules --enable-developer --libdir=/usr/lib64 --enable-shared --with-default-snmp-version="2" --with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"
make
make install
cd ..
echo export LD_LIBRARY_PATH=/usr/local/lib >> .bashrc
export LD_LIBRARY_PATH=/usr/local/lib
snmpget --version
安裝python擴充套件;
cd net-snmp-5.7.3/python
python setup.py build
python setup.py test
python setup.py install
安裝rrdtool:
apt-get install -y rrdtool python-rrdtool
設定時區:
apt-get install tzdata
dpkg-reconfigure tzdata
選擇6. Asia -》 69. Shanghai
檢視date -R
docker commit -m "flow-mete env init" flow_mete direpos.capitalonline.net/flow-mete:20180617
docker push direpos.capitalonline.net/flow-mete:20180617