Install Linux from Linux
There is an example to install debian from a Linux-mint live USB (or any debian based distro). If you have a debian based distribution already installed on your hdd , you can install other debian based distro using chroot
and debootstrap
from the existing OS.
Boot from the live USB .Use gparted to create your root
, swap
,/home
... partitions.
If you prefer the command line ( fdisk
, parted ..) , there is how to activate the swap partition :
mkswap /dev/sdaY
sync
swapon /dev/sdaY
Let's say you need to install debian stretch .
Install the debootstrap
package :
sudo apt-get install debootstrap
Create the /mnt/stable
then mount your root partition (sdaX
)
sudo mkdir /mnt/stable
sudo mount /dev/sdaX /mnt/stable
Install the base system:
sudo debootstrap --arch amd64 stretch /mnt/stable http://ftp.fr.debian.org/debian
sudo mount -t proc none /mnt/stable/proc
sudo mount -o bind /dev /mnt/stable/dev
sudo chroot /mnt/stable /bin/bash
Set up your root password:
passwd
Add a new user:
adduser your-username
Set up the hostname :
echo your_hostname > /etc/hostname
Configure the /etc/fstab
:
add the following lines:
/dev/sdaX / ext4 defaults 0 1
/dev/sdaY none swap sw 0 0
proc /proc proc defaults 0 0
use the debian documentation to edit your sources.list
(replace jessie
by stretch
)
Configure locale :
apt-get install locales
dpkg-reconfigure locales
Configure you keyboard:
apt-get install console-data
dpkg-reconfigure console-data
Install the kernel:
apt-cache search linux-image
Then:
apt-get install linux-image-4.9.0-3-amd64
Configure the network:
editor /etc/network/interfaces
and past the following:
auto lo
iface lo inet loopback
allow-hotplug eth0 # replace eth0 with your interface
iface eth0 inet dhcp
allow-hotplug wlan0 # replace wlan0 with your interface
iface wlan0 inet dhcp
To manage the wifi network install the following packages:
apt-get install net-tools network-manager wireless-tools
Install grub :
apt-get install grub2
grub-install /dev/sda
update-grub
You can install a desktop environment through the command tasksel
:
apt-get install aptitude tasksel
Run the following command and install your favorite GUI:
tasksel
Finally exit the chroot and reboot your system
Documentation: D.3. Installing Debian GNU/Linux from a Unix/Linux System
Debian wiki:
- chroot
- debootstrap