install rockmongo to ubuntu 16.04
Friday, August 10th, 2018 Posted in Linux | No Comments »rockmongo的安装非常简单。 首先,原来的rockmongo(https://github.com/iwind/rockmongo)不支持PHP 7.0,所以不能直接用了。 所以要从这里下载支持支持PHP 7.0的rockmongo: https://github.com/krutpong/rockmongo-php7。 然后就是安装php-mongodb [crayon-5c69aa21b8283117503652/] 最后就是配置config.php。这个根据config.sample.php或者后面的注释简单配置一下就可以了。 重点要写的就是新的mongodb应该是加强了鉴权部分,如果不对权限进行配置的话,使用普通用户登陆,你将会在rockmongo上看到下面这个错误 [crayon-5c69aa21b828a440942863/] 同时,在mongodb的日志中,你也可以看到类似下面的错误 [crayon-5c69aa21b828d116262335/] [crayon-5c69aa21b82a5300707206/] 应该是原来的mongodb允许任意用户列出所有的数据库或者表,但是现在已经不允许了。我们要通过下面命令来授权 首先,建立一个executeFunctions的角色 [crayon-5c69aa21b82a8497706173/] 然后将这个角色授权给你的用户 [crayon-5c69aa21b82ab207417134/] 之后再登陆应该就没有错误了。
use iptables to manage firewalling of ubuntu 16.04 bridge on VMware
Friday, August 4th, 2017 Posted in Linux | No Comments »背景: IDC分配了大量IP地址,但是自己并不能做网关,但我又不能把所有的机器全部直接置于外网,增加管理成本。 方案: 使用ubuntu 16.04做防火墙(FW) 外网(internet)只连接FW的ens160。 增加DMZ网络(DMZ),所有的需要外网IP的机器和FW的ens192全部连接到DMZ。 在FW中安装bridge-utils并桥接ens160与ens192,不知道怎么桥接的请直接参考这里。 接下来就是在VMware上启用DMZ和internet的混杂模式(Promiscuous Mode)。记住,两个网络的混杂模式都必须开启。不知道怎么开启混杂模式的可以看这里。这里没必要开启整个vSwitch的混杂模式,只需要开启DMZ和internet端口组就足够了。 到了这步,你的桥接就做完了。这个时候,你DMZ里面所有的机器都有完全的外网访问权限,你在iptables里面设置的规则完全限制不了DMZ的网络。接下来就是启用iptables对bridge的限制。 运行下面命令启用bridge netfilter模块 [crayon-5c69aa21b8800224585111/] 修改 /etc/modules-load.d/modules.conf,在最后加上下面一行,这样机器在重启后也会自动加载bridge netfilter模块 [crayon-5c69aa21b8806131339284/] 再修改 /etc/sysctl.conf,在文件的最后添加下面几行: [crayon-5c69aa21b8809383806892/] 最后,运行下面命令使配置生效 [crayon-5c69aa21b880b127917463/] 现在,就可以使用iptables对DMZ进行管理了。 不过,我目前还没摸清这里面进出端口(iptables里面的-i和-o)的规则,只能直接使用IP了。
How to remove the read failed after 0 of 4096 I/O error
Thursday, August 13th, 2015 Posted in Linux | No Comments »from: https://freeshell.de/~jose/317/kludges/how-to-temove-the-read-failed-after-0-of-4096-io-error/ Recently in a very old server I had to remove a disk. My server was composed by two physical volumes: a RAID5 volume, shown as /dev/sda to the operating system by the SCSI controller, and a single ...
php script to monitor OTRS queue size from SNMP
Tuesday, February 18th, 2014 Posted in Linux, MySQL, PHP & PW | No Comments »最近公司上线OTRS,感觉还不错,顾问居然还给了数据库的结构图,闲下来就写了这个php脚本给Opsview用来监控OTRS支持队列的大小。别问我为什么用php...因为我实在是不会pel.... 测试环境: [crayon-5c69aa21b90bd846203960/] 废话不说,先帖脚本: [crayon-5c69aa21b90c3297053117/] 脚本本身没什么好看的,不过最开始用来传参的东西还是蛮好玩的,这种脚本不能跟在web里面一直的传参,只能通过这个叫$argv的数组。 把脚本保存为/usr/local/bin/check_otrs_queue 修改/etc/snmp/snmpd.conf,加上下面几行 [crayon-5c69aa21b90c8881296047/] 最后就是使用check_snmp_exec.sh检测了~~~
How to use gmail as relay host for postfix in Ubuntu 12.04
Monday, January 20th, 2014 Posted in Linux, 安装配置 | No Comments »Reference: https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/ first of all, please note that when the recipient receives your email, the sender will be changed to the gmail account you are going to use Add the following code in /etc/postfix/main.cf [crayon-5c69aa21b93c7591745851/] Then, edit your authentication file /etc/postfix/sasl_passwd as the following ...
lsiutil to add hot spare drive on line for mpt raid controllers
Wednesday, May 29th, 2013 Posted in Linux | No Comments »environment: HP ProLiant ML150 G5 with Ubuntu 8.04 installed Run “mpt-status –i 1” to get the current array information. ioc0 vol_id 1 type IM, 2 phy, 231 GB, state DEGRADED, flags ENABLED ioc0 phy 0 scsi_id 2 ATA ...
Ubuntu 1204 安装NUT监控APC UPS
Wednesday, May 22nd, 2013 Posted in Linux | No Comments »安装相关程序 [crayon-5c69aa21b9597639799941/] 利用udev设定固定的设备文件名 在/etc/udev/rules.d/下面添加52-nut-usb.rules文件,以下是文件内容 [crayon-5c69aa21b959d469124812/] ASNNNNNNNNNN是你的APC UPS序列号,你可以直接在机器上找到,也可以用lsusb -v命令得到(iSerial字段)。 重启udev与ups驱动 [crayon-5c69aa21b95a0859683083/] 配置NUT 进入/etc/nut目录。 修改nut.conf文件,将MODE修改为netserver [crayon-5c69aa21b95a2778505425/] 修改ups.conf,在文件最后添加如下内容: [crayon-5c69aa21b95a4822846725/] 修改upsd.conf,修改LISTEN字段,把127.0.0.1改为你希望监听的地址,如果监听所有地址,用0.0.0.0 [crayon-5c69aa21b95a6729281705/] 修改upsd.users,按如下格式添加用户,这里不详解用户权限了。 [crayon-5c69aa21b95a8156409754/] 修改upsmon.conf,添加MONITOR字段 [crayon-5c69aa21b95aa518484621/] 重启nut服务之后,ups就已经在监控之中了,你可以用下面的命令查看基本信息了 [crayon-5c69aa21b95ac135597941/] 添加网页控制页面 直接用命令虽然看的很全面,但是很多时候还是不太方便。nut也提供网页查看方式,设置起来也很方便。 安装相关的软件 [crayon-5c69aa21b95af626407958/] 修改/etc/nut/hosts.conf,添加如下内容: [crayon-5c69aa21b95b0079102250/] 修改apache设置,添加alias到/usr/share/nut下面,然后就可以在网页上查看监控内容了。
PIN the kernel to the current version in apt
Tuesday, August 28th, 2012 Posted in Linux | No Comments »create a new file under /etc/apt/preferences.d with the following content [crayon-5c69aa21b9851525437623/] then run [crayon-5c69aa21b985b876900981/] you will find that you won't get the kernel upgrade notice any more. you can find you current kernel version with [crayon-5c69aa21b985f352917743/] reference: http://linux.die.net/man/5/apt_preferences
ubuntu下进行MySQL的移植
Thursday, December 9th, 2010 Posted in Linux, MySQL | No Comments »最近一直很忙,忙着加班进行服务器升级。 服务器全部升到了Ubuntu 1004 LTS,但是在进行mysql移植的时候碰到了个大问题,直接到原来的数据文件同步过来,mysql却无论如果也启动不了。 最后那边的老大告诉我说,是AppArmor的问题,让哥关掉这个什么AppArmor,果然,数据库就起来了。 简单查了一个,这个AppArmor应该是跟SELinux差不多的东西,但级别好像并没有SELinux那么高,直接停用服务就没用了。相关资料:https://wiki.ubuntu.com/AppArmor 另外还有两个问题: 1, socket文件的如果不能写入,数据库也是起不来的,所以,还要关注一下你指定的socket文件的位置的权限 2, 从5.0升级到5.1有很多麻烦,建议最好是做逻辑备份而不是做直接物理升级 好像直接升级也有问题,等待进一步的更新。
Samba升级后软链接无法访问的问题解决方案
Monday, October 18th, 2010 Posted in Linux | No Comments »方案来源: http://blog.csdn.net/zfpnuc/archive/2010/05/26/5626344.aspx 一开始我就认为这事很简单,的确也是很简单,只不过没时间弄。今天被催得没办法随便一搜就找到了答案。 果然是升级之后的默认策略问题,解决方案如下: 在[global]下面加下如下三句,然后reload一下就可以了: follow symlinks = yes wide symlinks = yes unix extensions = no