Skip to content

Instantly share code, notes, and snippets.

@u1-liquid
Last active October 14, 2018 17:36
Show Gist options
  • Save u1-liquid/c07e9ca05ea1a9210561af12d4361d0a to your computer and use it in GitHub Desktop.
Save u1-liquid/c07e9ca05ea1a9210561af12d4361d0a to your computer and use it in GitHub Desktop.
CentOSしかサポートしてくれないVPSサービスですが何としてもWindows Serverを動かしてみたかったです ref: https://qiita.com/u1-liquid/items/b9ae7d032f607c69e11a
[root@sdurnqde ~]# yum install -y curl vim unzip
[root@sdurnqde ~]# cd /boot
[root@sdurnqde boot]# mkdir gparted
[root@sdurnqde boot]# cd gparted
[root@sdurnqde gparted]# curl -L -o gparted.zip "https://jaist.dl.sourceforge.net/project/gparted/gparted-live-stable/0.32.0–1/gparted-live-0.32.0–1-amd64.zip"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 309M 100 309M 0 0 21.1M 0 0:00:14 0:00:14 --: --: --11.1M
[root@sdurnqde gparted]# unzip gparted.zip
[root@sdurnqde gparted]# mv live live-hd
[root@sdurnqde gparted]# rm gparted.zip
[root@sdurnqde gparted]# vim /boot/grub2/grub.cfg
### BEGIN /etc/grub.d/10_linux ### から
### END /etc/grub.d/10_linux ### までのLineを全部削除して次の通り入力
menuentry "GParted live" {
set root=(hd0,msdos1)
linux /gparted/live-hd/vmlinuz boot=live config union=overlay username=user components noswap noeject vga=788 ip=net.ifnames=0 live-media-path=/gparted/live-hd bootfrom=/dev/sda1 toram=filesystem.squashfs
initrd /gparted/live-hd/initrd.img
}
menuentry "Install Windows" --class windows --class os {
insmod part_msdos
insmod ntfs
insmod fat
search --no-floppy --set=root --file /bootmgr
insmod ntldr
ntldr /bootmgr
}
[root@sdurnqde gparted]# shutdown -r now
root@debian:/home/user# apt update
root@debian:/home/user# apt install -y curl unzip
cd C:\Workspace\
DISM /Export-Image /SourceImageFile:sources\install.wim /SourceIndex:2 /DestinationImageFile:install.wim /Compress:max /CheckIntegrity
mkdir boot install winre
DISM /Mount-Image /ImageFile:boot.wim /Index:1 /MountDir:boot
DISM /Image:boot /Add-Driver /Driver:.\virtio-win-0.1.141\ /Recurse
DISM /Unmount-Image /MountDir:boot /Commit
DISM /Mount-Image /ImageFile:boot.wim /Index:2 /MountDir:boot
DISM /Image:boot /Add-Driver /Driver:.\virtio-win-0.1.141\ /Recurse
DISM /Unmount-Image /MountDir:boot /Commit
DISM /Mount-Image /ImageFile:install.wim /Index:1 /MountDir:install
DISM /Image:install /Add-Driver /Driver:.\virtio-win-0.1.141\ /Recurse
DISM /Mount-Image /ImageFile:install\Windows\System32\Recovery\WinRE.wim /Index:1 /MountDir:winre
DISM /Image:winre /Add-Driver /Driver:.\virtio-win-0.1.141\ /Recurse
DISM /Unmount-Image /MountDir:winre /Commit
DISM /Export-Image /SourceImageFile:install\Windows\System32\Recovery\WinRE.wim /SourceIndex:1 /DestinationImageFile:WinRE.wim /CheckIntegrity
attrib -h -a -s install\Windows\System32\Recovery\WinRE.wim
del install\Windows\System32\Recovery\WinRE.wim
copy WinRE.wim install\Windows\System32\Recovery\WinRE.wim
attrib +h +a +s install\Windows\System32\Recovery\WinRE.wim
DISM /Unmount-Image /MountDir:install /Commit
move install.wim install-raw.wim
move boot.wim boot-raw.wim
DISM /Export-Image /SourceImageFile:boot-raw.wim /SourceIndex:1 /DestinationImageFile:boot.wim /Compress:max /CheckIntegrity
DISM /Export-Image /SourceImageFile:boot-raw.wim /SourceIndex:2 /DestinationImageFile:boot.wim /Compress:max /CheckIntegrity
DISM /Export-Image /SourceImageFile:install-raw.wim /SourceIndex:1 /DestinationImageFile:install.wim /Compress:max /CheckIntegrity
root@debian:/mnt/install# shutdown -r now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment