Directadmin到期 更换license的步骤

  1. cd /usr/local/directadmin/scripts
  2. ./getLicense.sh 你的client_ID 新的DA_LicenseIP
  3. service directadmin restart

for english people:
how to fix the expired issue for directadmin,
when you trying to log into your DA control panel and it showing:
License has expired, it means you need to start a new subscription.
log into your DA server by ssh,
cd in your DA path ( default is /usr/local/directadmin/scripts)
run the getLicense.sh with your client id and new license , new IP address.
Eg, ./getLicense.sh Your_Client_ID Your_new_DA_Licnese NewIP
./getLicense.sh 112233 123456 1.2.3.4
finally,just type command to restart the DA service,
service directadmin restart

perl模块_List::Util

1加2加3加4 … 加到100,试了一下还是perl最快
需要用到perl的List::Util模块.

  1. [root@centos perl]# more plus.pl
  2. #!/usr/bin/perl -w
  3. use strict;
  4. use List::Util qw[sum];
  5. my $t = sum(1..100);
  6. print "$t\n";
  7. [root@centos perl]# perl plus.pl
  8. 5050

shell取巧的方法也很简单,利用seq与sed和bc
seq生成数字,sed将空格替换为加号,通过管道传递给bc进行加法运算.

  1. [root@centos perl]# seq -s " " 100|sed 's/ /+/g'|bc
  2. 5050

centos配置vpn 基于pptpd

centos上配置vpn并指定出口IP

  1. 添加centos的源
  2. /etc/yum.repos.d/CentOS-Base.repo 
  3.  
  4. [doylenet]
  5. name=Doylenet custom repository for CentOS
  6. baseurl=http://files.doylenet.net/linux/yum/centos/5/i386/doylenet/
  7. gpgcheck=1
  8. gpgkey=http://files.doylenet.net/linux/yum/centos/RPM-GPG-KEY-rdoyle
  9. enabled=1
  10.  
  11. yum install ppp pptpd.i386 -y
  12.  
  13. echo 1 > /proc/sys/net/ipv4/ip_forward 
  14. sysctl -p
  15.  
  16. 修改 /etc/pptpd.conf
  17. 注释掉logwtmp
  18. 并添加IP范围
  19. localip 10.0.0.1
  20. remoteip 10.0.0.2-254
  21.  
  22. 修改 /etc/ppp/options.pptpd
  23. 添加DNS
  24. ms-dns 8.8.8.8
  25. ms-dns 8.8.4.4
  26.  
  27. 添加用户名密码
  28. /etc/ppp/chap-secrets 
  29.  
  30. iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j SNAT --to-source YourIPs
  31. iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE #或者轮询

centos5更新kernel

centos5 更新kernel

yum list kernel*

yum install kernel-PAE.i686 -y
# PAE为支持大内存的版本

reboot 后就可以

#查看32位或64位系统
file /sbin/init

未更新前: 2.6.18-164.el5PAE
更新后: 2.6.18-194.8.1.el5PAE

修复proftpd的550 Forbidden filename

公司客户的机器,装的是webmin+virtualmin
上传文件提示550 forbidden filename
把/etc/proftpd.conf里的这两行注释掉
PathAllowFilter “”
PathDenyFilter “”
proftpd的官方网站上有详细的解释:
http://www.proftpd.org/docs/directives/linked/config_ref_PathDenyFilter.html
http://www.proftpd.org/docs/directives/linked/config_ref_PathAllowFilter.html

重启ftp服务恢复

客户讲放着没动过,FTP自己变成这样,这年头有的人可真厉害,睁眼说瞎话哈~