3-2 UBUNTU主機配置

ubuntu主機裝了iptables以後 規則全空就是拒絕連接的。
而且也不像redhat可以用服務停掉,暫時不知道怎麼禁用的 
增加兩條規則:
sudo iptables -A INPUT -p tcp -m tcp --dport 10051 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT
保存新增iptables規則
sudo iptables-save > /root/iptables.save
sudo vi /etc/init.d/boot.local
iptables-restore /root/iptables.save #增加一條命令,讓系統的啓動的時候自動恢復

防火牆允許10050,10051通過:

sudo ufw allow 10050/tcp

sudo ufw allow 10051/tcp

若需要禁用防火牆:sudo ufw disable

若需要重新啓用防火牆:sudo ufw enable


配置zabbix agent開機自啓動

sudo sysv-rc-conf


UBUNTU Zabbix agent端支持JMX監控的配置


編輯tomcat配置文件catalina.sh,增加Tomcat啓動參數:

CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=12345"


問題:

裝軟件的時候總是提示dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed,導致無法安裝任何軟件


處理方式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
 
# 修復ubuntu通過apt-get安裝軟件時錯誤:
# dpkg: warning: files list file for package `*****' missing, assuming package has no files currently 丟包導致無法安裝任何軟件的問題
set -e
 
# Clean out /var/cache/apt/archives
apt-get clean
# Fill it with all the .debs we need
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' cut -f1)
 
DIR=$(mktemp -d -t info-XXXXXX)
for deb in /var/cache/apt/archives/*.deb
do
    # Move to working directory
    cd "$DIR"
    # Create DEBIAN directory
    mkdir -p DEBIAN
    # Extract control files
    dpkg-deb -e "$deb"
    # Extract file list, fixing up the leading ./ and turning / into /.
    dpkg-deb -c "$deb" awk '{print $NF}' cut -c2- | sed -e 's/^\/$/\/./' > DEBIAN/list
    # Figure out binary package name
    DEB=$(basename "$deb" cut -d_ -f1)
    # Copy each control file into place
    cd DEBIAN
    for file in *
    do
        cp -a "$file" /var/lib/dpkg/info/"$DEB"."$file"
    done
    # Clean up
    cd ..
    rm -rf DEBIAN
done
rmdir "$DIR"

 

注意:

執行腳本過程中,若遇到類似/bin/bash^M: bad interpreter錯誤,需要將此腳本的文本格式由其他格式轉爲unix,可以使用notepad++轉換文本格式




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章