対象とするUbuntuのバージョン
- Ubuntu14.04 をベースにしています。
https://help.ubuntu.com/community/Installation/FromLinux から抜粋。
Why installing from Linux?
今のところUbuntu14.04(Trusty Tahr)を使用しています。
Ubuntu14.10(Utopic Unicorn) amd64 での話
インストールしてみたところ busybox で停止&kernel panicを起こしました。オリジナル、日本語Remix 双方でです。orz
幸い仮想PC(VirtualBox)内ではインストール出来たので、カーネルのアップデートが出たタイミングでubuntu-defaults-builderを使ってLiveイメージをつくり、インストールにも成功しています。
でも、もう少し違う方向からインストールしてみたいな。という事でやってみました。
以下はUbuntu14.04(Trusty Tahr)から直接Ubuntu14.10(Utopic Unicorn)をインストールする方法です。
少々見難いですが下手な和訳を載せられないので基本的に原文のまま、自分が書いたところは日本語になります。
基本的な構成は変えていませんのでhttps://help.ubuntu.com/community/Installation/FromLinuxと合わせてお読み下さい。
日本語の設定を筆頭にこれで良いのかわからないので修正していただければ嬉しいです。
UEFI PC (Secure Bootは無効) でのインストールを想定しています。
Ubuntu15.04(Vivid Vervet) amd64 をインストールする場合は
Ubuntu14.04(Trusty Tahr)からインストールする場合は Ubuntu14.10(Utopic Unicorn) の所を Ubuntu15.04(Vivid Vervet) に便宜置き換えて下さい。
Ubuntu15.04(Vivid Vervet)ではsystemdになっていますが、
timedatectl set-timezone Asia/Tokyo localectl set-locale LANG=ja_JP.UTF-8 hostnamectl set-hostname < ホスト名 >
は実行されません。
Ubuntu14.10(Utopic Unicorn)と同じ方法でインストールできます。
Without CD
You can install Ubuntu directly from Ubuntu using debootstrap. Debootstrap installs some essential packages in a directory for use with chroot. Note that the essential packages does not in itself make the system bootable. It just installs what you need to chroot to that directory and use apt-get to install other packages which make ubuntu usable.
Step 1. First check that you have debootstrap installed.
sudo apt-get install debootstrap
(NOTE: if you want to install a newer release than your current system, you normally need to install the backported debootstrap version, see: UbuntuBackports)
Step 2. Partition device and make a filesystem.
gparted を使ってみます。(/dev/sdd)
gpt |
format |
capacity |
label |
flag |
partition1 |
fat32 |
300MB |
esp256 |
boot (EF00) |
partition2 |
ext4 |
適当 |
ubuntu1410 |
|
partition3 |
swap |
適当 |
|
|
Step 3. Mount that new partition.
ここは原文のまま sudo mkdir /mnt/installer sudo mount /dev/sda1 /mnt/installer
これで作業しました。ラベル名でマウントします。 sudo mkdir /mnt/installer sudo mount -L ubuntu1410 /mnt/installer
Step 4. Download and install base system packages.
Ubuntu14.10(Utopic Unicorn)をインストールしていきます。 sudo debootstrap utopic /mnt/installer
Step 5. Copy files to the new install to keep your repositories
# リポジトリを trusty から utopic へ変更します。 sudo cp /etc/apt/sources.list /mnt/installer/etc/apt/ sudo sed -i 's#trusty#utopic#g' /mnt/installer/etc/apt/sources.list
Step 6. Chroot to your new install.
sudo mount --bind /dev /mnt/installer/dev sudo mount --bind /dev/pts /mnt/installer/dev/pts sudo mount -t proc proc /mnt/installer/proc sudo mount -t sysfs sys /mnt/installer/sys sudo chroot /mnt/installer apt-get update apt-get install nano
# リポジトリの調整 # nano /etc/apt/sources.list http://extras.ubuntu.com を含む行をコメントアウト。他に不具合があれば対処して下さい。 apt-get update ## Inside chroot!
Step 7. Locale and language settings To make dpkg run without warning you need to set this settings first
ここは原文のまま cp /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime echo 'LANG="pt_BR.UTF-8' > /etc/default/locale echo 'LANG="pt_BR:pt:us' >> /etc/default/locale echo 'America/Sao_Paulo' > /etc/timezone locale-gen pt_BR.UTF-8 dpkg-reconfigure -f non-interactive tzdata ## All this inside chroot!
これで作業しました。 dpkg-reconfigure tzdata 又は echo 'Asia/Tokyo' > /etc/timezone dpkg-reconfigure -f non-interactive tzdata ## All this inside chroot!
Step 8. Upgrade the new install. Install your local "language-pack-en-base".
ここは原文のまま apt-get update apt-get install language-pack-en-base apt-get upgrade
これで作業しました。 apt-get update apt-get install language-pack-ja update-locale LANG=ja_JP.UTF-8 apt-get upgrade ## Inside chroot!
If you are using Software RAID and/or LVM, you should install these packages before installing a kernel:
apt-get install mdadm lvm2
Step 9. Install Grub and Linux Kernel.
ここは原文のまま apt-get install grub-pc linux-image
これで作業しました。 apt-get install grub-efi-amd64 linux-image-generic linux-headers-generic ## Inside chroot!
Step 10. Add user and/or set root password.
To add a user and set a password for that user.
adduser <username>
You may also want to add your user to the sudo group so that user can run programs as root.
gpasswd -a <username> sudo
To set a root password:
(NOTE: You must at least set a root password if you aren't adding a user)
passwd
Step 11. Create fstab. A simple example of fstab is
ここは原文のまま echo "/dev/sda1 / ext4 errors=remount-ro 0 1" >> /etc/fstab ## Inside chroot!
これで作業しました。 blkid root@t552-u1404-uefi:/etc/default# blkid [省略] /dev/sdd1: LABEL="esp256" UUID="CD93-783B" TYPE="vfat" PARTUUID="731ab7e5-f497-45ff-b667-a81ce2bcc097" /dev/sdd2: LABEL="ubuntu1410" UUID="62999e34-8dc5-40c8-910e-2e47ad2951b7" TYPE="ext4" PARTUUID="3d93d056-1199-4840-8384-4760a150b509" /dev/sdd3: UUID="c4ed4708-32fb-4a9e-8cd5-ac281303ec14" TYPE="swap" PARTUUID="bffb3e1b-eb05-437d-ba55-0b64bd09a67a" /dev/sdd4: LABEL="depot2" UUID="093b7f71-103a-452a-ab8a-31721316b253" TYPE="ext4" PARTUUID="65d4d636-9b78-4be3-b025-d080e0432ad9" ## Inside chroot!
これで作業しました。blkid の結果からUUIDを抽出します。インストールしたデバイスがSSDのため「discard,」設定を3カ所追加しています。SSD以外ならこれを消去して下さい。 nano /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sdb2 during installation UUID=62999e34-8dc5-40c8-910e-2e47ad2951b7 / ext4 discard,errors=remount-ro 0 1 # /boot/efi was on /dev/sdb1 during installation UUID=CD93-783B /boot/efi vfat discard,defaults 0 1 # swap was on /dev/sdb3 during installation UUID=c4ed4708-32fb-4a9e-8cd5-ac281303ec14 none swap discard,sw 0 0 ## Inside chroot!
It should now be safe to reboot; you may want the next few things.
Step 12. If you want to access it with ssh after reboot.
Use vi or install nano to edit /etc/hostname.
Remove any text in this file and add the hostname you would like.
nano /etc/hostname ## Inside chroot!
edit /etc/network/interfaces
vi /etc/network/interfaces
Add these lines to /etc/network/interfaces. This will start eth0 at boot and request an IPv4 address with dhclient.
少なくともUbuntu Desktop (Unity)では要らない設定。これを設定すると最終的に有線LANが繋がらなくなります。一応原文のままにしておきます。 auto eth0 iface eth0 inet dhcp
Next you need to install ssh
apt-get install openssh-server
Your computer should be safe to reboot now. If you want the Ubuntu Gnome desktop, continue with Step 13.
Step 14. Install ubuntu-desktop.
apt-get install ubuntu-desktop ubuntu-standard ## Inside chroot!
ToDo:
? mkswap /dev/sdbXy gparted で構築済みなので必要ありません。 ? nano /etc/hosts 127.0.1.1 の行を追加します。<TAB>はTabキーを一回押して下さい。<hostname>は /etc/hostname と同じ内容に置き換えて下さい。 --- 127.0.0.1<TAB>localhost 127.0.1.1<TAB><hostname> [以下略] --- ? edit default language 他にあれば設定して下さい。 ? edit /etc/environment 比較して必要ならば修正して下さい。 ? edit autologin autologin は設定していないので修正しません。 ? edit /etc/lightdm/lightdm.conf edit /usr/share/lightdm/lightdm.conf.d/ 修正しません。 ## Inside chroot!
Step 15. Reboot and keep those fingers crossed.
# grub2-efi をインストールします。
ここはUEFI対応のgrub2をインストールする手順です。 ラベル名でマウントします。/dev/sdX は皆さんの環境に合わせて下さい。ここでは /dev/sdd になります。 mkdir -p /boot/efi mount -L esp256 /boot/efi grub-install /dev/sdX update-grub umount /boot/efi ## Inside chroot!
# chroot から抜けます。
exit
これで作業しました。 makoto@t552-u1404-uefi:/mnt/installer$ mount | grep /mnt/installer /dev/sdd2 on /mnt/installer type ext4 (rw) /dev on /mnt/installer/dev type none (rw,bind) /dev/pts on /mnt/installer/dev/pts type none (rw,bind) proc on /mnt/installer/proc type proc (rw) sys on /mnt/installer/sys type sysfs (rw)
これで作業しました。 sudo umount -lf /mnt/installer/sys sudo umount -lf /mnt/installer/proc sudo umount -lf /mnt/installer/dev/pts sudo umount -lf /mnt/installer/dev sudo umount -lf /mnt/installer
# rEFInd Boot Manager をインストールします。
rEFInd Boot Managerを参考にインストールします。インストール先は Ubuntu14.10をインストールしたドライブのESP(EFI SYSTEM PARTITION)であるpartition1です。
# 日本語環境をインストールします。
インストールしたUbuntu14.10で再起動して下さい。
Ubuntuの日本語環境 [方法2・Japanese Teamのパッケージレポジトリを追加する] に従って導入します。
fcitx へ変更してください。
sudo im-config -c
インストールしたUbuntu14.10 で再起動して下さい。
fcitx-configtool
を実行して日本語キーボードを追加・一番上へ。英語キーボードを削除。(皆さんの環境に合わせて下さい。)
ここら辺でもう少し操作が必要かもしれません。編集して下さい
Troubleshooting
- If you are having issues installing grub, and dpkg-reconfigure grub-pc does not give you a chance to select the device you want to install grub to, make sure you have mounted /dev in your chroot. Review step 6.
External Links