WDMycloud安装Debian

WDMycloud安装Debian #

所需文件下载地址: https://wd.hides.su/fox_exe/WDMyCloud-Gen2/Debian/

国内搬运地址:

登录WD Mycloud后台在设置中开启ssh登录,用户名为sshd,密码自己设置。

试着SSH登录mycloud查看系统信息。

ssh [email protected] 
root@acloud ~ # free
              total        used        free      shared  buff/cache   available
Mem:         509136      308416       29604        6604      171116      153060
Swap:       1529832        9992     1519840
root@acloud ~ # cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 1 (v7l)
BogoMIPS        : 50.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x4
CPU part        : 0xc09
CPU revision    : 1

processor       : 1
model name      : ARMv7 Processor rev 1 (v7l)
BogoMIPS        : 50.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x4
CPU part        : 0xc09
CPU revision    : 1

Hardware        : Marvell Armada 375 (Device Tree)
Revision        : 0000
Serial          : 0000000000000000
root@acloud ~ # uname -a
Linux acloud 4.14.22 #1 SMP Thu Oct 27 08:42:06 UTC 2022 armv7l GNU/Linux
root@acloud ~ #

使用WinSCP登录mycloud,将下载的文件jessie-rootfs.tar.gzuImageuRamdisk上传至/boot/boot目录。

上传完成后重启mycloud

重启后通过telnet登录系统,ip地址在路由器后台找下。

telnet 192.168.1.14
/ # uname -a
Linux (none) 3.10.70+ #9 SMP Sat Jul 23 22:00:15 YEKT 2016 armv7l GNU/Linux
/ # free -h
             total       used       free     shared    buffers     cached
Mem:        509536      44864     464672          0          0       8836
-/+ buffers/cache:      36028     473508
Swap:            0          0          0
/ # parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: ATA WDC WD20EFRX-68E (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  2149MB  2147MB               Linux swap
 4      2149MB  3222MB  1074MB  ext4         Microsoft basic data
 5      3222MB  4296MB  1074MB  ext4         Microsoft basic data
 6      4296MB  6443MB  2147MB  ext4         Microsoft basic data
 7      6443MB  7517MB  1074MB  ext4         Microsoft basic data
 3      7517MB  8591MB  1074MB  ext4         Microsoft basic data
 2      8591MB  2000GB  1992GB  ext4         Microsoft basic data

接下来继续安装

======= 分区方案 ========
/dev/sda1 - Swap 交换分区
/dev/sda2 - User data 用户数据
/dev/sda3 - Rootfs/Boot (Important for bootloader) 系统文件和启动分区
======= 正常步骤(用telnet刷系统) =======
# 使用parted命令重新分区
# 删除分区124567留下分区3,新建1G的分区1
parted /dev/sda 
rm 1
rm 2
rm 4 
rm 5
rm 6
rm 7
mkpart primary 0% 1G 
# 退出parted
q 
# 将分区1 格式化为ext4格式
mkfs.ext4 /dev/sda1 

# 把分区3 /boot/boot里的三个文件,复制到分区1里)
mkdir -p /mnt/root /mnt/data
mount /dev/sda1 /mnt/data
mount /dev/sda3 /mnt/root
cp /mnt/root/boot/uImage /mnt/data/
cp /mnt/root/boot/uRamdisk /mnt/data/
cp /mnt/root/boot/jessie-rootfs.tar.gz /mnt/data/
umount /mnt/root

# 删除原分区3,建立新的分区2和分区3
parted /dev/sda
rm 3
mkpart primary 4G 100%  
mkpart primary 1G 4G 
q
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3

# 把分区1里的3个文件解压并复制回分区3,
mount /dev/sda3 /mnt/root
tar xvf /mnt/data/jessie-rootfs.tar.gz -C /mnt/root
mkdir -p /mnt/root/boot
cp /mnt/data/uImage /mnt/root/boot/uImage
cp /mnt/data/uRamdisk /mnt/root/boot/uRamdisk
umount /mnt/root

# 把分区1格式化成swap
umount /mnt/data
mkswap /dev/sda1

# 重启完成Debian8安装
sync
reboot -f

# ssh进入Debian8 初始密码是 mycloud
ssh root@your_device_ip 

以下为升级内核和系统方法。

#Source of _Update_Kernel_and_os_EN.txt:
# Download latest kernel and install:
wget http://fox-exe.ru/WDMyCloud/WDMyCloud-Gen2/Debian/Dev/Debian-kernel-bin_4.15.0-rc6.tar.gz
tar xvf Debian-kernel-bin_4.15.0-rc6.tar.gz -C /

# Cleanup:
# Remove old network controller records:
rm /etc/udev/rules.d/70-persistent-net.rules
# Remove all "ipv6" records (lines of code) from /etc/network/interfaces
sed '/ipv6/d' /etc/network/interfaces -i
sed '/inet6/d' /etc/network/interfaces -i  

# Reboot
sync && reboot

# Remove old kernel modules:
rm -r /lib/modules/3.10.70+


###############################
# OS upgrade (Wheezy or Jessie to latest stable release (Stretch))

# Replace apt repository:
#cat << EOF > /etc/apt/sources.list
#deb  http://deb.debian.org/debian stable main contrib non-free
#deb-src  http://deb.debian.org/debian stable main contrib non-free
#
#deb  http://deb.debian.org/debian stable-updates main contrib non-free
#deb-src  http://deb.debian.org/debian stable-updates main contrib non-free
#
#deb http://security.debian.org/ stable/updates main contrib non-free
#deb-src http://security.debian.org/ stable/updates main contrib non-free
#EOF

cat << EOF > /etc/apt/sources.list
deb  http://archive.debian.org/debian-archive/debian stretch main contrib non-free
deb-src  http://archive.debian.org/debian-archive/debian stretch main contrib non-free
deb  http://archive.debian.org/debian-archive/debian stretch-updates main contrib non-free
deb-src  http://archive.debian.org/debian-archive/debian stretch-updates main contrib non-free
deb http://archive.debian.org/debian-archive/debian-security/ stretch/updates main contrib non-free
deb-src http://archive.debian.org/debian-archive/debian-security/ stretch/updates main contrib non-free
EOF

# Do upgrade packages/software/system:
apt update
apt upgrade
apt dist-upgrade

安装OpenMediaVault

#echo "127.0.0.1       wdmc.lan wdmc" >> /etc/hosts
apt-get install --yes gnupg
wget -O "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc" https://packages.openmediavault.org/public/archive.key
apt-key add "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc"

cat <<EOF >> /etc/apt/sources.list.d/openmediavault.list
deb https://packages.openmediavault.org/public Arrakis main
# deb https://downloads.sourceforge.net/project/openmediavault/packages Arrakis main
## Uncomment the following line to add software from the proposed repository.
# deb https://packages.openmediavault.org/public Arrakis-proposed main
# deb https://downloads.sourceforge.net/project/openmediavault/packages Arrakis-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
# deb https://packages.openmediavault.org/public Arrakis partner
# deb https://downloads.sourceforge.net/project/openmediavault/packages Arrakis partner
EOF


export LANG=C.UTF-8
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
apt-get update
apt-get --yes --auto-remove --show-upgraded \
    --allow-downgrades --allow-change-held-packages \
    --no-install-recommends \
    --option DPkg::Options::="--force-confdef" \
    --option DPkg::Options::="--force-confold" \
    install openmediavault-keyring openmediavault

omv-confdbadm populate

以下为原作者安装步骤,以供参考。

======= OMV SETUP =======
# Connect to device via SSH
# Default SSH login/password: root/mycloud

# Install latest OMV (v.3.x.x, "erasmus")
echo "deb http://packages.openmediavault.org/public erasmus main" > /etc/apt/sources.list.d/omv.list
echo "127.0.1.1       wdmc.lan wdmc" >> /etc/hosts
apt-get update
apt-get install --force-yes openmediavault-keyring
apt-get update
apt-get install openmediavault
# choose "none", "yes", "standalone"

# Default OMV login/pass is: admin / openmediavault
# Warning: create network interface in webgui or you loose network connection after restart!
# "Mount" data partition (/dev/sda2) as "User data".
# Configure all other things.
# Profit!

以下为非常规安装方法

# 把硬盘拆出来安装到另一台linux电脑上,并安装parted
# centos下
yum install parted 
# debian/Ubuntu下
apt-get install parted
# 查看硬盘及分区情况
parted -l
# 进入parted分区,注意/dev/sdb改成你 parted -l 看到的那个
parted /dev/sdb
mklabel gpt
# 删掉所有分区
rm 1
rm 2
rm 3
rm 4 
rm 5
rm 6
rm 7
# 建立大小为1G的分区1
mkpart primary 0% 1G 
# 建立大小为剩余空间大小的的分区2
mkpart primary 4G 100%  
# 建立大小为3G的分区3
mkpart primary 1G 4G 
q
# 格式化
mkswap /dev/sdb1
mkfs.ext4 /dev/sdb2
mkfs.ext4 /dev/sdb3

# 上传文件,把三个文件解压复制到分区3
mkdir /mnt/root
mount /dev/sdb3 /mnt/root
mkdir /mnt/root/boot
tar xvf  jessie-rootfs.tar.gz -C /mnt/root
cp uImage /mnt/root/boot/uImage
cp uRamdisk /mnt/root/boot/uRamdisk

# 重启完成Debian8安装
sync
reboot -f