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++转换文本格式




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值