服务器硬盘故障恢复备忘

大概是从上周四晚上开始,托管的服务器就无法访问。周五请机房重启后,仍然无法登录,干脆拔掉网线,过一个不插电的周末。

周六中午,赶到机房,尝试重启几次,发现硬盘已经无法引导了(grub error 17)。联系机器的提供商提供了块新硬盘(才用了半年),在机房现刻安装光盘,重新安装系统……这就是大概的经过了。虽然平时做了完整的apache和mysql的备份,但是恢复还是花了半天的时间。这就是用虚拟主机的好处:虽然DreamHost偶尔有掉链子的时候,可是至少不用跑机房啊……

新系统使用的是Fedora Core 4。回家学习使用了一下yum,和debian的apt-get差不多了:而且软件包的依赖关系整理的比较好。

以下是应用的安装备忘:2006年7月30日 星期日 00时18分

用awk生成关闭服务的脚本:关闭不需要的服务
sudo /sbin/chkconfig --list| grep 3:on | awk '{print "/sbin/chkconfig "$1" off"}'
/sbin/chkconfig acpid off
/sbin/chkconfig anacron off
/sbin/chkconfig apmd off
/sbin/chkconfig auditd off
/sbin/chkconfig autofs off
/sbin/chkconfig bluetooth off
/sbin/chkconfig cpuspeed off
/sbin/chkconfig cups off
/sbin/chkconfig gpm off
/sbin/chkconfig haldaemon off
/sbin/chkconfig iptables off
/sbin/chkconfig isdn off
/sbin/chkconfig kudzu off
/sbin/chkconfig mDNSResponder off
/sbin/chkconfig mdmonitor off
/sbin/chkconfig messagebus off
/sbin/chkconfig netfs off
/sbin/chkconfig nfslock off
/sbin/chkconfig nifd off
/sbin/chkconfig pcmcia off
/sbin/chkconfig portmap off
/sbin/chkconfig rhnsd off
/sbin/chkconfig rpcgssd off
/sbin/chkconfig rpcidmapd off
/sbin/chkconfig sendmail off
/sbin/chkconfig xfs off

安装gcc(居然忘记了……)
sudo yum install gcc
sudo yum install gcc-c++
sudo yum install flex zlib curl zlib-devel curl-devel bzip2 bzip2-devel

apache的安装:
./configure --prefix=/home/apache --enable-shared=max --enable-module=most
mysql的安装:
./configure --prefix=/home/mysql --without-innodb --with-mysqld-user=apache
php的安装:
./configure --with-apxs=/home/apache/bin/apxs --enable-track-vars --with-mysql=/home/mysql --with-curl --enable-iconv --enable-mbstring
cronolog:
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz


安装MT需要的perl模块
sudo yum install mysql-devel
sudo yum install perl-DBI
sudo yum install perl-DBD-mysql

安装awstats需要的GeoIP模块:
perl -MCPAN -e 'install GeoIP'
sudo yum install GeoIP
安装awstats需要的GeoIP数据包:
wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz

sudo yum install xinetd
启用rsync

下次要把root的crontab和用户的crontab也一起备份下来,还有/etc/的一些设置

# time sync
0 5 * * 1 (/usr/bin/rdate -s 202.106.196.19)
# awstats
5 0 * * * (cd /home/apache/chedong.com/cgi-bin/awstats; ./awstats_updateall.pl -configdir=./ now )
# remove old logs
2 2 * * * (/usr/bin/find /home/apache/logs -mtime +7 -name "*log.*" |/usr/bin/xargs rm -f)
# backup
12 2 * * * (cd /home; tar czf /home/backup/apache.`date +\%w`.tgz apache)
13 2 * * * (/home/mysql/bin/mysqldump --all-databases -u*** -p*** -S/tmp/mysql.sock | gzip -f > /home/backup/mysql.`date +\%w`.gz)

作者: 车东 发表于:2006-07-30 22:07 最后更新于:2007-04-22 21:04
版权声明:可以转载,转载时请务必以超链接形式标明文章 的原始出处和作者信息及 本版权声明

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值