How to install linux from linux

How to install linux from linux

Ставим Ubuntu/Debian через debootstrap из другой Linux-системы

How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linuxПрошло почти три года с публикации последней и единственной статьи на хабре про это дело, и с тех пор некоторые вещи изменились. Хочу сразу сказать, что этот пост — упрощение и объединение двух замечательных вики-страниц написанных моим другом: раз и два. Если те страницы направлены на полное и подробное описание процесса установки, то я постараюсь максимально упростить и ускорить процесс установки, разбив его всего на три шага.

Сам я считаю такой способ установки самым адекватным, т.к. он при всей своей простоте имеет большую гибкость, свежеустановленная система имеет самые новые версии пакетов, а всё, что нужно для полноценной работы системы можно установить до первой загрузки в неё. Под катом я приведу некоторый набор скриптов,

Во-первых, вам понадобится рабочая Linux-система, из которой мы будем устанавливать новую систему. Подойдет любой дистрибутив, как и установленный, так и запущенный с LiveCD.

Шаг нулевой: Подготовка жесткого диска

Для начала нужно разметить диск, как ваша душа пожелает. Хороших инструкций в интернете много, я обычно использую графическую утилиту GParted. Настоятельно советую выделить /home в отдельный раздел, при переустановке/смене дистрибутива это позволит избежать геморроя с переносом данных.

Шаг первый: Формирование базовой системы

Для работы скрипта потребуется рабочий debootstrap, который есть в репозиториях всех deb-based дистрибутивов. Не бойтесь исправлять переменные и комментировать/раскомментировать строчки.

Шаг второй: начальная конфигурация

В рассмотренном выше примере он будет выглядеть так:

Шаг третий: всё остальное

Если нужно поставить что-нибудь еще вручную до перезагрузки, то всегда можно войти в chroot-окружение командой:

Вот и всё. Полный набор скриптов для полуавтоматической установки я выложил на github, так что не стесняйтесь оформлять предложения и улучшения в виде pull-request’ов.

Ubuntu Documentation

If you already have Ubuntu installed, it is easy to upgrade using the Update Manager. However, this is not always safe, and it will overwrite your old system.

If upgrading is not an option (you are running a different Linux distro than Ubuntu, or your system is several versions old), or you wish to keep your old system, you should use the live Ubuntu Desktop installer or Debootstrap.

The Ubuntu Desktop installer is usually run on a DVD or a bootable USB stick. However, if you already run Linux, using a DVD or USB is not necessary. You may run the Ubuntu Desktop installer directly from your hard drive, or use Debootstrap.

Note: These are advanced installation techniques and are not recommended for new users. If you are uncomfortable with the command line terminal, you should create a live Ubuntu Desktop DVD or USB.

Running the Ubuntu Desktop installer from your hard drive requires an extra partition. Debootstrap installs Ubuntu directly, without using the guiding Ubuntu Desktop installer. Debootstrap does not require a DVD, USB, Ubuntu Desktop ISO, or an extra installer partition.

Live Ubuntu Desktop from Hard Drive

Note: You will need blank hard drive space to create new partitions. If your current system partition(s) take up all available space, you must create a live DVD or live USB.

Step 1, Partition

Step 2, Copy

Copy Ubuntu Desktop installer contents over to the new partition using the commands

Replace disk-image.iso with the path to your disk image and /dev/sda3 with the new partition.

Step 3, Grub

Configure grub2. Edit the file /etc/grub.d/40_custom and add the lines

Replace Ver. with the version number and (hd0,3) with the new partition (for example, /dev/sda3 becomes (hd0,3) because Grub 2 counts drives from 0, but partitions from 1).

Then run update-grub to rebuild the grub configuration.

Step 4, Reboot

Reboot, and choose «installer» from the grub boot menu, and continue as if you were installing from CD. Be sure to set the root partition to another new partition, different from the installer; do not overwrite the whole drive.

Step 5, Grub (again)

The installer may not add an entry in Grub for the new version of Ubuntu. You will have to do this manually.

Older Versions of Ubuntu

Older verions of Ubuntu may use /casper/vmlinuz instead of /casper/vmlinuz.efi

For even older versions of Ubuntu with grub1, change the grub configuration file (typically /etc/grub.conf or /boot/grub/menu.lst) to boot from the new partition by adding the lines

The first line after the title tells grub which partition contains the installer. hd0 stands for «first hard disk,» and the 0 following it standards for first partition. You will need to change this if your installer partition is different from /dev/sda1. sdaN becomes (hd0, N-1), sdbN becomes (hd1,N-1) and so on. As you can see, grub starts counting from 0, which can be confusing.

If you are trying to use Hard Disk installation with Ubuntu 9.10 chances are initrd.gz is renamed as initrd.lz now. So rename accordingly in menu.lst.

Note (old, for grub1) You do not need to modify the grub config of the existing linux system, if you feel uncomfortable modifying an otherwise fine running system. Instead, you may create a new menu.lst file on the new partition, preferably in directory /boot/grub/. Then, reboot, and when the (old) grub menu appears, press ‘c’ to get the grub command line. Then, type: configfile (hd0,1)/boot/grub/menu.lst to switch over to your new grub menu. Tip: use the tab-key halfway typing to have grub help you complete the command, or grub commands such as search or help.

Note2: Instead of using ‘workaround’, an alternative is to modify the file /etc/mtab by erasing the line that specifies the partition where the cdrom is mounted. This way the kernel thinks that the /cdrom is not mounted and will not show the advice when installing ubuntu. I think this procedure is less dangerous than the one in the previous note.

Note3: Instead of the above ‘workarounds’, you may simply use the boot option live-media=/dev/sdb1 or LIVEMEDIA=/dev/sdb1, referring to the USB device holding the ISO. This would be the «bootable usb», even if your pc has a «buggy BIOS» and cannot boot from USB. The running kernel can access the USB device. This boot option is documented in http://manpages.ubuntu.com/manpages/karmic/man7/casper7.html, but unfortunately not supported by Ubuntu 11.10. Use the patch I filed as bug fix in https://bugs.launchpad.net/ubuntu/+source/casper/+bug/423616 while this is not yet put back in the ISO. Warning: this implies building a new initrd.gz which is not very trivial, although this forum has a good manual.

Debootstrap

You can install Ubuntu directly from Linux 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.

(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.

We will assume /dev/sda is the storage device for your fresh install.

Remove former partitions and create the new one.

Make the filesystem

Step 3. Mount that new partition.

Step 4. Download and install base system packages.

Step 5. Copy files to the new install to keep your repositories

Step 6. Chroot to your new install.

Step 7. Locale and language settings To make dpkg run without warning you need to set this settings first

Step 8. Upgrade the new install. Install your local «language-pack-en-base».

If you are using Software RAID and/or LVM, you should install these packages before installing a kernel:

Step 9. Install Grub and Linux Kernel.

Step 10. Add user and/or set root password.

To add a user and set a password for that user.

You may also want to add your user to the sudo group so that user can run programs as root.

To set a root password:

(NOTE: You must at least set a root password if you aren’t adding a user)

Step 11. Create fstab. A simple example of fstab is

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.

Add these lines to /etc/network/interfaces. This will start eth0 at boot and request an IPv4 address with dhclient.

Next you need to install ssh

Your computer should be safe to reboot now. If you want the Ubuntu Gnome desktop, continue with Step 13.

Step 14. Install ubuntu-desktop.

Step 15. Reboot and keep those fingers crossed.

Alternate CD

As of December 29th 2007, the instructions above do not apply to the alternate CD provided for Ubuntu 7.10 (Gutsy Gibbon). Significant changes are required. Procedure 1 below has been used successfully with Gutsy (Ubuntu 7.10) and Procedure 2 with Hardy (Ubuntu 8.04).

Before going any further please note that the alternate CD contains documentation which can help with fixing problems or adapting solutions to your own situation. The documentation is located in doc/install/manual/ on the alternate CD. Please refer to that documentation as needed.

Note that Procedure 2 is potentially less disruptive because it does not call for a new partition.

For a simpler installation method which generally does not require re-partitioning, and downloads the packages at install time rather than requiring an ISO, see Installation/NetbootInstallFromInternet.

Procedure 1

I used the following procedure for Gutsy. It can also be used for Hardy.

Step 1. Use gparted to create a new primary partition and format it to ext3. You need slightly more than 700MB of free space on it. 750MB should be sufficient. Let’s say the name of the partition is /dev/sda1. If your new ubuntu install is going to coexist with your old system, you might find it convenient to create space for your new system as well at this point using gparted.

Step 2. Copy your alternate ISO to the root of the partition you created in step 1. You need to copy the ISO itself rather than the contents of the ISO.

Step 3. Grab the initrd.gz and vmlinuz files found in the following sub-directory of a Ubuntu mirror:

Put these files in your newly created partition. They can be in the root of the partition or in a sub-directory.

Step 4. Edit your grub configuration file (typically /etc/grub.conf or /boot/grub/menu.lst) to boot from the new partition by adding the lines:

If you use LILO, see the official documentation on the alternate CD for how to configure LILO. Or you can adapt the lines above for LILO if you know Grub and LILO well.

The first line after the title tells grub which partition contains the installer. hd0 stands for «first hard disk,» and the 0 following it standards for first partition. You will need to change this if your installer partition is different from /dev/sda1. sdaN becomes (hd0, N-1), sdbN becomes (hd1,N-1) and so on. As you can see, grub starts counting from 0, which can be confusing. The paths for the kernel and the initrd were set to start with /install/ in my setup but you could put those files in the root of the install partition and have them be /vmlinuz and /initrd.gz if you so wish.

As specified in the above, the installer will run without a preseed file. The preseed tells the installer what kind of system you are trying to install and it automatically selects some options for you during installation. For instance, using the ubuntu.seed file tells the installer that you want to install a full «desktop» system, with Gnome and everything. If you do not select a preseed file, it is unclear what the installer thinks. In my (LouisDominiqueDubeau) experience, it installs some sort of CLI or server form of Ubuntu. This is not disastrous but it may not be what you want. In Hardy in particular, running the installer without a seed results in LILO installed as the boot loader rather than Grub. Ugly. So it is better to select a seed. Adding the parameter file=/cdrom/preseed/ubuntu.seed to the kernel line above should take care of the problem. If installing Kubuntu, select kubuntu.seed instead. Adapt to other situations as needed.

Step 5. Reboot, and choose «installer» from the grub boot menu, and continue as normal.

Procedure 2

In this procedure you do not create a new partition to hold the installer. This procedure was used for Hardy. It may be adaptable for Gutsy.

Step 1. Copy your alternate ISO to the root of any partition that the installer can mount. You need to copy the ISO itself rather than the contents of the ISO. The important part here is that you must find a partition that the installer can mount, as it will search during the install procedure. If you use the traditional partitioning system used by DOS since ages immemorial, then any filesystem supported by Ubuntu should work. In particular ext2/ext3/ntfs/fat/vfat should all work. If you use LVM, things are trickier. As of April 26th 2008, the installer is unable to find an ISO stored on a partition managed in LVM. The installer can install Ubuntu in an LVM partition but in the stage at which it looks for the ISO it has not yet loaded the LVM modules so it cannot find the ISO if it is on an LVM partition. An enterprising person should be able to work around that problem but by default the installer won’t find the ISO if it is on an LVM partition. If you have Windows installed, then the Windows partition, which normally is not managed by LVM (because I don’t think Windows supports LVM), can hold the ISO.

Step 2. Grab the initrd.gz and vmlinuz files found in the following subdirectory of a Ubuntu mirror:

You will want to put these files in your normal /boot/ directory. It may be a good idea to create a subdirectory like newinstall, hardy-install, or something similar.

Step 3. Read the information at step 4 of procedure 1 above and then come back here: the information there will tell you what hd0,0 means and will inform you about seeds, etc. Edit your grub configuration file (typically /etc/grub.conf or /boot/grub/menu.lst) to boot from the new partition by adding the lines:

If you want a preseed file, change the kernel line to:

Note that some users report working installs with grub without seeds and/or seeds not working with this method. Adapt as needed to your situation.

Step 4. Reboot, and choose «installer» from the grub boot menu, and continue the installation as normal.

Alternate CD Alternate Method

I have a machine without a CD-ROM drive but with a network connection, and I struggled with these instructions for many days. Finally, I stumbled upon some straightforward solutions which appear to work for me.

1. Obtain Alternate CD. (This method may work for other CDs, I have not tried)

2. Mount at a temporary location, as described previously.

3. Copy vmlinuz and initrd.gz from mounted installation media to normal location on current linux root (the one to be replaced)

4. Unmount CDROM image.

5. Copy image as is to selected partition, i.e. cat "image" > /dev/hdXX

6. Configure grub or LILO as above

8. When choosing CD-ROM drive, choose manually, do not install a driver, for the device enter the partition to which you copied the image.

9. Continue installation as normal.

So far so good! I’ll let you know if it breaks later 😛

Troubleshooting

Installation/FromLinux (последним исправлял пользователь jamiesonc 2020-06-23 22:49:53)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

How to install linux from linux

Once you’ve got the new Debian system configured to your preference, you can migrate your existing user data (if any) to it, and keep on rolling. This is therefore a “ zero downtime ” Debian GNU/Linux install. It’s also a clever way for dealing with hardware that otherwise doesn’t play friendly with various boot or installation media.

As this is a mostly manual procedure, you should bear in mind that you will need to do a lot of basic configuration of the system yourself, which will also require more knowledge of Debian and of Linux in general than performing a regular installation. You cannot expect this procedure to result in a system that is identical to a system from a regular installation. You should also keep in mind that this procedure only gives the basic steps to set up a system. Additional installation and/or configuration steps may be needed.

D.3.1.В Getting Started

With your current *nix partitioning tools, repartition the hard drive as needed, creating at least one filesystem plus swap. You need around 613MB of space available for a console only install, or about 2133MB if you plan to install X (more if you intend to install desktop environments like GNOME or KDE Plasma).

Next, create file systems on the partitions. For example, to create an ext3 file system on partition /dev/sda6 (that’s our example root partition):

Initialize and activate swap (substitute the partition number for your intended Debian swap partition):

Mount one partition as /mnt/debinst (the installation point, to be the root ( / ) filesystem on your new system). The mount point name is strictly arbitrary, it is referenced later below.

If you want to have parts of the filesystem (e.g. /usr) mounted on separate partitions, you will need to create and mount these directories manually before proceding with the next stage.

D.3.2.В Install debootstrap

D.3.3.В Run debootstrap

debootstrap can download the needed files directly from the archive when you run it. You can substitute any Debian archive mirror for http.us.debian.org/debian in the command example below, preferably a mirror close to you network-wise. Mirrors are listed at http://www.debian.org/mirror/list.

D.3.4.В Configure The Base System

Now you’ve got a real Debian system, though rather lean, on disk. chroot into it:

If the target architecture is different from the host, you will need to first copy qemu-user-static to the new host:

After chrooting you may need to set the terminal definition to be compatible with the Debian base system, for example:

Depending on the value of TERM, you may have to install the ncurses-term package to get support for it.

If the target architecture is different from the host, you need to finish the multi-stage boot strap:

D.3.4.1.В Create device files

At this point /dev/ only contains very basic device files. For the next steps of the installation additional device files may be needed. There are different ways to go about this and which method you should use depends on the host system you are using for the installation, on whether you intend to use a modular kernel or not, and on whether you intend to use dynamic (e.g. using udev ) or static device files for the new system.

A few of the available options are:

install the makedev package, and create a default set of static device files using (after chrooting)

manually create only specific device files using MAKEDEV

bind mount /dev from your host system on top of /dev in the target system; note that the postinst scripts of some packages may try to create device files, so this option should only be used with care

Install Arch Linux from existing Linux

This document describes the bootstrapping process required to install Arch Linux from a running Linux host system. After bootstrapping, the installation proceeds as described in the Installation guide.

Installing Arch Linux from a running Linux is useful for:

The goal of the bootstrapping procedure is to setup an environment from which the scripts from arch-install-scripts (such as pacstrap and arch-chroot ) can be run.

Contents

Backup and preparation

Backup all your data including mails, webservers, etc. Have all information at your fingertips. Preserve all your server configurations, hostnames, etc.

Here is a list of data you will likely need:

In general, it is a good idea to have a local copy of your original /etc directory on your local hard drive.

From a host running Arch Linux

Follow Installation guide#Mount the file systems to mount the filesystem that will be used for the root directory as well as all the other needed mount points. If you already use the /mnt directory for something else, just create another directory such as /mnt/install and use it as the mount point base for the rest of the installation.

At this stage, Arch Linux can either be installed from scratch or it can mirror the host installation. The two options are described thereafter.

Create a new Arch installation

In the procedure, the first step, Installation guide#Select the mirrors, can be skipped since the host should already have a correct mirrorlist.

Create a copy of an existing Arch installation

It is possible to replicate an existing Arch Linux installation by copying the host filesystem to the new partition and make some adjustments to it to make it bootable and unique.

The first step is to copy the host files into the mounted new partition, for this, consider using the approach exhibited in rsync#Full system backup.

Then, follow the procedure described in Installation guide#Configure the system with some caveats and additional steps:

If the mirrored Arch installation may be used within a different configuration or with another hardware, consider the following additional operations:

From a host running another Linux distribution

There are multiple tools which automate a large part of the steps described in the following subsections. See their respective homepages for detailed instructions.

The manual way is presented in the following subsections. The idea is to either get pacman working directly on the host system, or to run an Arch system inside the host system, with the actual installation being executed from the Arch system. The nested system is contained inside a chroot.

Using pacman from the host system

Pacman can be compiled on most Linux distributions, and used directly on the host system to bootstrap Arch Linux. The arch-install-scripts should run without issues directly from the downloaded sources on any recent distribution.

Some distributions provide a package for pacman and/or arch-install-scripts in their official repositories which can be used for this purpose. As of July 2020, Void Linux is known to provide the pacman package, and Alpine Linux and Fedora are known to provide both pacman and arch-install-scripts.

Creating a chroot

Two methods to setup and enter the chroot are presented below, from the easiest to the most complicated. Select only one of the two methods. Then, continue at #Using a chroot environment.

Method A: Using the bootstrap tarball (recommended)

Download the bootstrap tarball signature from the download page and place it in the same directory. Do not download it from a mirror.

Extract the tarball:

Enter the chroot:

Method B: Using the LiveCD image

It is possible to mount the root image of the latest Arch Linux installation media and then chroot into it. This method has the advantage of providing a working Arch Linux installation right within the host system without the need to prepare it by installing specific packages.

To unsquash the root image, run

Before chrooting to the unsquashed root image, we need to set up some mount points and copy the resolv.conf for networking.

Now, everything is prepared to chroot into the newly installed Arch environment:

Using a chroot environment

The bootstrap environment is really barebones (no nano or lvm2 ). Therefore, we need to set up pacman in order to download other necessary packages.

Initializing pacman keyring

Before starting the installation, pacman keys need to be setup. Before running the following two commands, read pacman-key#Initializing the keyring to understand the entropy requirements:

Downloading basic tools

Installation tips

Some host systems or configurations may require certain extra steps. See the sections below for tips.

Debian-based host

/dev/shm

On some Debian-based host systems, pacstrap may produce the following error:

This is because in some versions of Debian, /dev/shm points to /run/shm while in the Arch-based chroot, /run/shm does not exist and the link is broken. To correct this error, create a directory /run/shm :

/dev/pts

While installing archlinux-2015.07.01-x86_64 from a Debian 7 host, the following error prevented both pacstrap(8) and arch-chroot from working:

The solution for pacstrap is to manually execute its various tasks, but use the regular procedure to mount the kernel filesystems on the target directory ( «$newroot» ):

Instead of using arch-chroot for Installation guide#Chroot, simply use:

lvmetad

Trying to create LVM logical volumes from an archlinux-bootstrap-2015.07.01-x86_64 environment on a Debian 7 host resulted in the following error:

(Physical volume and volume group creation worked despite /run/lvm/lvmetad.socket: connect failed: No such file or directory being displayed.)

This could be easily worked around by creating the logical volumes outside the chroot (from the Debian host). They are then available once chrooted again.

How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linuxThe factual accuracy of this article or section is disputed.How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linux

Also, if the system you are using has lvm, you might have the following output:

This is because debian does not use lvmetad by default. You need to edit /etc/lvm/lvm.conf and set use_lvmetad to 0 :

How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linuxThe factual accuracy of this article or section is disputed.How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linux

How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linuxThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linux

This will trigger later an error on boot in the initrd stage. Therefore, you have to change it back after the grub generation. In a software RAID + LVM, steps would be the following:

Fedora-based host

On Fedora based hosts and live USBs you may encounter problems when using genfstab to generate your fstab. Remove duplicate entries and the «seclabel» option where it appears, as this is Fedora-specific and will keep your system from booting normally.

Things to check before you reboot

Before rebooting, doublecheck a few details in your installation to achieve a successful installation. To do so, first chroot into the newly-installed system, and then:

Replacing the existing system without a LiveCD

700 MB of free space somewhere on the disk, e.g. by partitioning a swap partition. You can disable the swap partition and set up your system there.

Set old swap partition as new root partition

Do the following:

Disable the swap space:

Create a filesystem on it

Create a directory to mount it in

Finally, mount the new directory for installing the intermediate system.

Installation

Install essentials packages and any other package required to get a system with internet connection up and running in the temporary partition, being careful with the limit of

Once the new Arch Linux system is installed, fix the bootloader configuration, then reboot into the newly created system, and rsync the entire system to the primary partition.

How to Replace One Linux Distribution With Another From Dual Boot [Keeping Home Partition]

If you have a Linux distribution installed, you can replace it with another distribution in the dual boot. You can also keep your personal documents while switching the distribution.

How to install linux from linux. Смотреть фото How to install linux from linux. Смотреть картинку How to install linux from linux. Картинка про How to install linux from linux. Фото How to install linux from linux

Suppose you managed to successfully dual boot Ubuntu and Windows. But after reading the Linux Mint versus Ubuntu discussion, you realized that Linux Mint is more suited for your needs. What would you do now? How would you remove Ubuntu and install Mint in dual boot?

You might think that you need to uninstall Ubuntu from dual boot first and then repeat the dual booting steps with Linux Mint. Let me tell you something. You don’t need to do all of that.

If you already have a Linux distribution installed in dual boot, you can easily replace it with another. You don’t have to uninstall the existing Linux distribution. You simply delete its partition and install the new distribution on the disk space vacated by the previous distribution.

Another good news is that you may be able to keep your Home directory with all your documents and pictures while switching the Linux distributions.

Let me show you how to switch Linux distributions.

Replace one Linux with another from dual boot

Let me describe the scenario I am going to use here. I have Linux Mint 19 installed on my system in dual boot mode with Windows 10. I am going to replace it with elementary OS 5. I’ll also keep my personal files (music, pictures, videos, documents from my home directory) while switching distributions.

Let’s first take a look at the requirements:

Things to keep in mind for keeping your home directory while changing Linux distribution

If you want to keep your files from existing Linux install as it is, you must have a separate root and home directory. You might have noticed that in my dual boot tutorials, I always go for ‘Something Else’ option and then manually create root and home partitions instead of choosing ‘Install alongside Windows’ option. This is where all the troubles in manually creating separate home partition pay off.

Keeping Home on a separate partition is helpful in situations when you want to replace your existing Linux install with another without losing your files.

Note: You must remember the exact username and password of your existing Linux install in order to use the same home directory as it is in the new distribution.

If you don’t have a separate Home partition, you may create it later as well BUT I won’t recommend that. That process is slightly complicated and I don’t want you to mess up your system.

With that much background information, it’s time to see how to replace a Linux distribution with another.

Step 1: Create a live USB of the new Linux distribution

Alright! I already mentioned it in the requirements but I still included it in the main steps to avoid confusion.

You can create a live USB using a start up disk creator like Etcher in Windows or Linux. The process is simple so I am not going to list the steps here.

Step 2: Boot into live USB and proceed to installing Linux

Since you have already dual booted before, you probably know the drill. Plugin the live USB, restart your system and at the boot time, press F10 or F12 repeatedly to enter BIOS settings.

In here, choose to boot from the USB. And then you’ll see the option to try the live environment or installing it immediately.

You should start the installation procedure. When you reach the ‘Installation type’ screen, choose the ‘Something else’ option.

Step 3: Prepare the partition

You’ll see the partitioning screen now. Look closely and you’ll see your Linux installation with Ext4 file system type.

In the above picture, the Ext4 partition labeled as Linux Mint 19 is the root partition. The second Ext4 partition of 82691 MB is the Home partition. I haven’t used any swap space here.

Now, if you have just one Ext4 partition, that means that your home directory is on the same partition as root. In this case, you won’t be able to keep your Home directory. I suggest that you copy the important files to an external disk else you’ll lose them forever.

It’s time to delete the root partition. Select the root partition and click the – sign. This will create some free space.

When you have the free space, click on + sign.

Now you should create a new partition out of this free space. If you had just one root partition in your previous Linux install, you should create root and home partitions here. You can also create the swap partition if you want to.

If you had root and home partition separately, just create a root partition from the deleted root partition.

You may ask why did I use delete and add instead of using the ‘change’ option. It’s because a few years ago, using change didn’t work for me. So I prefer to do a – and +. Is it superstition? Maybe.

One important thing to do here is to mark the newly created partition for format. f you don’t change the size of the partition, it won’t be formatted unless you explicitly ask it to format. And if the partition is not formatted, you’ll have issues.

Now if you already had a separate Home partition on your existing Linux install, you should select it and click on change.

You just have to specify that you are mounting it as home partition.

If you had a swap partition, you can repeat the same steps as the home partition. This time specify that you want to use the space as swap.

At this stage, you should have a root partition (with format option selected) and a home partition (and a swap if you want to). Hit the install now button to start the installation.

The next few screens would be familiar to you. What matters is the screen where you are asked to create user and password.

If you had a separate home partition previously and you want to use the same home directory, you MUST use the same username and password that you had before. Computer name doesn’t matter.

Your struggle is almost over. You don’t have to do anything else other than waiting for the installation to finish.

Once the installation is over, restart your system. You’ll have a new Linux distribution or version.

In my case, I had the entire home directory of Linux Mint 19 as it is in the elementary OS. All the videos, pictures I had remained as it is. Isn’t that nice?

Creator of It’s FOSS. An ardent Linux user & open source promoter. Huge fan of classic detective mysteries ranging from Agatha Christie and Sherlock Holmes to Detective Columbo & Ellery Queen. Also a movie buff with a soft corner for film noir.

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *