原文:http://colekcolek.com/2011/12/20/hack-wd-book-live/
WD My Book Live is network storage installed with Debian Linux operating system. We can setup this device to be our web server at home. Here are the steps how I did it.
SECTION 1
Follow this Section 1 if you haven’t upgrade the firmware and you don’t want to use Debian Squeeze. If you just upgraded your My Book Live to latest firmware and you want to use Squeeze, go to Section 2.
1. Activate SSH
Open browser, and go to http://device_ip/UI/ssh and then enable SSH service.
2. Login to SSH
12username: root
default password: welc0me
3. Backup the system and protect udev update
Backup system:
123# dd if=/dev/sda bs=15728640 count=1 | bzip2 > /DataVolume/shares/Public/SDA_MBR_FREESPACE.bz2
# dd if=/dev/sda1 | bzip2 > /DataVolume/shares/Public/SDA1_IMA.bz2
# dd if=/dev/sda2 | bzip2 > /DataVolume/shares/Public/SDA2_IMA.bz2
Protect udev update:
1# aptitude hold udev
4. Disable load cycle count (http://wdc.custhelp.com/app/answers/detail/a_id/5357)
WD drives are designed to reduce power consumption, in part by positioning the heads in a park position (unloading the heads) and turning off unnecessary electronics, resulting in substantial power savings. WD defines this mode as Idle 3.
Some utilities, operating systems, and applications, such as some implementations of Linux, for example, are not optimized for low power storage devices and can cause our drives to wake up at a higher rate than normal. This can negatively impact some of the power savings associated with WD Green Power drives and artificially increases the number of load-unload cycles. The increase in load/unload cycles for a typical desktop user are within design margins (drive has been validated to 1 million load/unload cycles without issue).
Affected Models:
WD20EADS, WD20EARS, WD15EADS, WD15EARS, WD10EADS, WD10EARS, WD8000AARS, WD7500AADS, WD7500AARS, WD6400AADS, WD6400AARS, WD5000AADS, WD5000AARS
Run this command to check your model:
123MyBookLive:~
# dmesg|grep WDC
ata2.00: ATA-8: WDC WD10EURS-630AB1, 80.00A80, max UDMA
/133
scsi 1:0:0:0: Direct-Access ATA WDC WD10EURS-630 80.0 PQ: 0 ANSI: 5
If your model is included in the affected list, download idle3 tool from http://mybookworld.wikidot.com/local–files/mybook-live/idle3ctl.tar.gz
Extract, execute and reboot.
123# tar zxvf idle3ctl.tar.gz
# ./idle3ctl -d /dev/sda
# reboot
5. Install mysql-server
Comment out debian squeeze references from packaging list
1# sed -ie "s/deb .* squeeze/#&/g" /etc/apt/sources.list
Update aptitude and install mysql
12# apt-get update
# apt-get install mysql-server mysql-client php5-mysql
Create symlink of /etc/init.d/mysql in /etc/rc2.d/ to autostart the mysql server
1# ln -s /etc/init.d/mysql /etc/rc2.d/
Initialize mysql data dir and create system tables
1# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Restart apache
1# /etc/init.d/apache2 restart
6. Create apache virtual host
Go to apache vhost folder:
1# cd /etc/apache2/sites-available/
Copy current vhost configuration file:
1# cp wdnas mywebsite
Edit mywebsite vhost file:
1# nano mywebsite
Modify to the following:
1234567891011121314151617181920212223242526272829303132<VirtualHost *:80>
ServerName mywebsite.mooo.com
ServerAlias www.mywebsite.mooo.com
ServerAdmin webmaster@localhost
DocumentRoot /DataVolume/shares/mywebsite/
<IfModule mod_rewrite.c>
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 0
RewriteEngine On
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /DataVolume/shares/mywebsite/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/mywebsite_error.log
LogLevel warn
</VirtualHost>
Create document root folder:
1# mkdir /DataVolume/shares/mywebsite
Enable virtual host file:
1# a2ensite mywebsite
Rename wdnas virtualhost:
12# mv /etc/apache2/sites-enabled/000-wdnas /etc/apache2/sites-enabled/wdnas
# mv /etc/apache2/sites-enabled/000-wdnas-ssl /etc/apache2/sites-enabled/wdnas-ssl
Restart apache:
1# /etc/init.d/apache2 restart
7. Create your domain mywebsite.mooo.com using free DNS service by afraid.org. Follow this article on step no. 4, 5, 6.
8. Make cron running when in standby mode
Kill monitorio.sh script:
12# killall monitorio.sh
# nano /usr/local/sbin/monitorio.sh
Comment out the following line:
12#/etc/init.d/cron start > /dev/null
#/etc/init.d/cron stop > /dev/null
9. You can access your website at http://mywebsite.mooo.com. My Book Live UI also available athttp://device_ip
SECTION 2
Use this section if you are just upgrading your My Book Live to latest firmware. Below is my firmware after upgraded.
1
2
|
MyBookLive:~ # cat /etc/version 02.32.05-046 |
1. Activate SSH
Open browser, and go to http://device_ip/UI/ssh and then enable SSH service.
2. Login to SSH
12username: root
default password: welc0me
3. Backup the system and protect udev update
Backup system:
123# dd if=/dev/sda bs=15728640 count=1 | bzip2 > /DataVolume/shares/Public/SDA_MBR_FREESPACE.bz2
# dd if=/dev/sda1 | bzip2 > /DataVolume/shares/Public/SDA1_IMA.bz2
# dd if=/dev/sda2 | bzip2 > /DataVolume/shares/Public/SDA2_IMA.bz2
Protect udev update:
1# aptitude hold udev
4. Disable load cycle count (http://wdc.custhelp.com/app/answers/detail/a_id/5357)
WD drives are designed to reduce power consumption, in part by positioning the heads in a park position (unloading the heads) and turning off unnecessary electronics, resulting in substantial power savings. WD defines this mode as Idle 3.
Some utilities, operating systems, and applications, such as some implementations of Linux, for example, are not optimized for low power storage devices and can cause our drives to wake up at a higher rate than normal. This can negatively impact some of the power savings associated with WD Green Power drives and artificially increases the number of load-unload cycles. The increase in load/unload cycles for a typical desktop user are within design margins (drive has been validated to 1 million load/unload cycles without issue).
Affected Models:
WD20EADS, WD20EARS, WD15EADS, WD15EARS, WD10EADS, WD10EARS, WD8000AARS, WD7500AADS, WD7500AARS, WD6400AADS, WD6400AARS, WD5000AADS, WD5000AARS
Run this command to check your model:
123MyBookLive:~
# dmesg|grep WDC
ata2.00: ATA-8: WDC WD10EURS-630AB1, 80.00A80, max UDMA
/133
scsi 1:0:0:0: Direct-Access ATA WDC WD10EURS-630 80.0 PQ: 0 ANSI: 5
If your model is included in the affected list, download idle3 tool from http://mybookworld.wikidot.com/local–files/mybook-live/idle3ctl.tar.gz
Extract, execute and reboot.
123# tar zxvf idle3ctl.tar.gz
# ./idle3ctl -d /dev/sda
# reboot
5. Install mysql-server
Update aptitude and install mysql
12# apt-get update
# apt-get install mysql-server mysql-client php5-mysql
And then I got this error:
123Errors were encountered while processing:
/var/cache/apt/archives/php5-common_5.3.3-7+squeeze14_powerpc.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
To fix above error, run this command:
# dpkg -i –force-overwrite /var/cache/apt/archives/php5-common_5.3.3-7+squeeze14_powerpc.deb
And then another error came:
123W: GPG error: http://ftp.us.debian.org squeeze Release: The following signatures couldn't be verified because
the public key is not available: NO_PUBKEY AED4B06F473041FA NO_PUBKEY 64481591B98321F9
W: You may want to run apt-get update to correct these problems
To fix, run below commands:
1234567$ gpg --keyserver subkeys.pgp.net --recv AED4B06F473041FA
$ gpg --export --armor AED4B06F473041FA | sudo apt-key add -
$ gpg --keyserver subkeys.pgp.net --recv 64481591B98321F9
$ gpg --export --armor 64481591B98321F9| sudo apt-key add -
Replace the key number “AED4B06F473041FA” and “64481591B98321F9″ with the one included in your error message.
Then do:
12# apt-get update
# apt-get -f install
Restart apache
1# /etc/init.d/apache2 restart
6. Create apache virtual host
Go to apache vhost folder:
1# cd /etc/apache2/sites-available/
Copy current vhost configuration file:
1# cp wdnas mywebsite
Edit mywebsite vhost file:
1# nano mywebsite
Modify to the following:
1234567891011121314151617181920212223242526272829303132<VirtualHost *:80>
ServerName mywebsite.mooo.com
ServerAlias www.mywebsite.mooo.com
ServerAdmin webmaster@localhost
DocumentRoot /DataVolume/shares/mywebsite/
<IfModule mod_rewrite.c>
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 0
RewriteEngine On
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /DataVolume/shares/mywebsite/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/mywebsite_error.log
LogLevel warn
</VirtualHost>
Create document root folder:
1# mkdir /DataVolume/shares/mywebsite
Enable virtual host file:
1# a2ensite mywebsite
Rename wdnas virtualhost:
12# mv /etc/apache2/sites-enabled/000-wdnas /etc/apache2/sites-enabled/wdnas
# mv /etc/apache2/sites-enabled/000-wdnas-ssl /etc/apache2/sites-enabled/wdnas-ssl
Restart apache:
1# /etc/init.d/apache2 restart
7. Create your domain mywebsite.mooo.com using free DNS service。
8. You can access your website at http://mywebsite.mooo.com. My Book Live UI also available athttp://device_ip
Reference: http://mybookworld.wikidot.com/mybook-live
- 本文固定链接: https://www.fengshen.cn/2014/04/how-to-hack-wd-my-book-live/storyofwind/
- 转载请注明: fengshen 发表于 Dream of Wind | 一梦风神
