|
服务器的网卡不识别,需要在系统安装完成以后,再安装网卡驱动
dpkg -i firmware-bnx2_0.14+lenny2_all.deb
或者
将bnx2-09-4.0.5.fw文件拷贝到usb盘中,安装的时候驱动
安装好的系统中可以得到这个文件,在/lib/firmware/下
内存8G,只能识别4g
apt-cache search linux image big mem
apt-get install linux-image-2.6.26-2-686-bigmem
修改ip地址
vi /etc/network/interfaces
添加静态路由
/etc/init.d/sroute.sh
#! /bin/bash
route add -net 172.16.0.0 netmask 255.240.0.0 gw 172.16.17.254
route add -net 192.168.0.0 netmask 255.255.0.0 gw 172.16.17.254
route add -net 10.0.0.0 netmask 255.0.0.0 gw 172.16.17.254
route add -net 20.0.0.0 netmask 255.0.0.0 gw 172.16.17.254
设置开机启动
update-rc.d sroute.sh defaults
添加apt源
vi /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.de.debian.org/debian/ etch main contrib non-free
deb http://mirrors.163.com/debian etch main non-free contrib
deb http://mirrors.163.com/debian etch-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian-security etch/updates main contrib non-free
系统更新
apt-get update
apt-get upgrade -s 会下载哪些更新
apt-get upgrade
安装ssh
apt-get install ssh
vi /etc/inputrc
vi /etc/ssh/sshd_config
PermitRootLogin no 禁止root用户用ssh远程登录
Passwords Authentication yes 用户输入密码可远程登录
Protocol 2
ListenAddress 0.0.0.0
安装vim
apt-get install vim
vi /etc/vim/vimrc
syntax on 去掉注释,打开高亮显示
dpkg-reconfigure locales
选择字符集:en_US zh_CN.GBK
选择后的结果保存在 /etc/locale.gen
执行 locale-gen
vi /etc/procfile
export LC_ALL=zh_CN.GBK LANG=zh_CN.GBK
或者
vi ~/.bashrc
export LC_ALL=zh_CN.GBK LANG=zh_CN.GBK
关闭ipv6支持
vi /etc/modprobe.d/aliases
将alias net-pf-10 ipv6注释
添加以下2行
alias net-pf-10 off
alias ipv6 off
重启服务器
Debian 6 使用这个方法
vi /etc/default/grub
把此行:GRUB_CMDLINE_LINUX_DEFAULT="quiet" 替换为:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet"
然后保存退出。
执行
#update-grub
重启
把系统时间和标准时间同步
apt-get install ntpdate
vi /etc/init.d/updatetime.sh
#!/bin/bash
case $1 in
stop)
exit
;;
*)
/usr/sbin/ntpdate 210.72.145.44 2.cn.pool.ntp.org 3.asia.pool.ntp.org 0.asia.pool.ntp.org
;;
esac
chmod u+x updatetime.sh
ntpdate设置的是系统时钟,但它不设置硬件时钟(电池供电的时钟)。要让硬件时钟反应系统时钟的值,请使用如下命令:
# hwclock --systohc
# hwclock --show
使用crontab -e,输入如下信息,整点对时
0 0-23 * * * bash /etc/init.d/updatetime.sh
crontab如果默认编辑器不是vi 使用export EDITOR=vim改成vi
停掉不用的服务
netstat –nlp 正在监听的
netstat –anlp 所有的(正在监听的和已经建立的)
/etc/init.d/lpd stop 停掉打印服务
/etc/init.d/nfs-common stop 停掉nfs服务 (rpc.statd)
/etc/init.d/portmap stop 停掉portmap服务111 protmap (rpc:nfs:)
/etc/init.d/exim4 stop 停掉exim4服务邮件25
update-rc.d -f lpd remove ( 可以手工删除rc2-5 S开头,保留rc016中的K开头)
update-rc.d -f nfs-common remove
update-rc.d -f portmap remove
update-rc.d -f exim4 remove
113 auth服务
vi /etc/inetd.conf
#ident stream tcp wait identd /usr/sbin/identd identd
/etc/init.d/inetd restart
限制控制台重启
vi /etc/inittab
#ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
保护 su, 以便使得只有一些用户可以使用它成为 root 用户
groupadd wheel
usermod -G wheel myuser
usermod -G wheel root (可以不写)
id myuser
vi /etc/pam.d/su
加入如下行,确保只有wheel组的用户可以su 为root
auth requisite pam_wheel.so group=wheel debug
允许myuser用户使用ssh登录
vi /etc/sshusers-allowed 加入允许ssh登录的用户名
vi /etc/pam.d/sshd
加入如下行
auth required pam_listfile.so item=user sense=allow file=/etc/sshusers-allowed onerr=fail
保护系统免受arp攻击
arp -s ip mac 静态 (网关的ip和mac)
arp -d ip mac 删除
生成系统快照
为所有的软件生成md5sums编码
生成快照脚本,系统更新以后要从新制作快照
#!/bin/bash
if [ ! -f /usr/bin/md5sum ] ; then
echo "Cannot find md5sum. Aborting."
exit 1
fi
/bin/cp /usr/bin/md5sum /home/myuser
for dir in /bin/ /sbin/ /usr/bin/ /usr/sbin/ /lib/ /usr/lib/
do
find $dir -type f | xargs /usr/bin/md5sum >>/home/jwsong/md5checksums-lib.txt
done
echo "post installation md5 database calculated"
会在/home/myuser/目录下生成
md5sum
md5checksums-lib.txt
md5checksums.txt
把快照文件放到.md5check的隐藏文件夹中,并设置权限或者拷贝到本机
检查文件是否被修改
./md5sum –c md5checksums-lib.txt
./md5sum -c md5checksums-lib.txt|awk -F: {'print $2'}|uniq
防火墙配置
#!/bin/bash
iptables –F
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -s localhost -j ACCEPT
iptables -A INPUT -p tcp -s 10.1.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 1521 -j DROP
iptables -A INPUT -j DROP
内存8G,只能识别4g
apt-cache search linux image big mem
apt-get install linux-image-2.6.26-2-686-bigmem
ulimit -a
修改文件描述符
vi /etc/security/limits.conf
* - nofile 65535
ulimit -HSn 65536 文件描述符个数
安装网卡流量统计软件
apt-get install iptraf
-i iface 在指定接口上开始ip协议的监控 "-i all" 监控所有接口
-g 开始常规的接口流量统计
-d iface 在指定接口上开始详细的接口流量统计
-s iface 在指定接口上开始tcp和udp的流量统计
-z iface 显示指定接口的数据包的大小和数量
-l iface 显示指定接口LAN station监控(以mac地址形式) "-l all" 表示所有接口
-B 后台运行
-t timeout 指定命令运行时间 单位分钟
-L logfile 指定日志文件,默认放在/var/log/iptraf |
|
|