.. include:: /urls.rst

.. _pureos_migrate_computers:

Computer migration
==================

.. _pureos_migrate_computers_files:

Copying files
-------------

This brief guide describes steps to transfer your home files from an old computer to a new one.

On "source" computer
~~~~~~~~~~~~~~~~~~~~

#. Setup ``ssh-server`` on the 'old' computer.
   This enables the ability to copy files over the local network.
   :ref:`Launch a terminal emulator <pureos_terminal_launch>` and run the following command:

   .. code-block:: bash

      sudo apt install openssh-server

#. Obtainthe IP address of the 'old' machine.
   Open **Settings** > **Network** > **Network Settings**.
   Note the IPv4 Address (e.g. ``192.168.1.182``).

On "destination" computer
~~~~~~~~~~~~~~~~~~~~~~~~~

3. Proceed through the normal install.
   Creating users, passphrases, etc.
#. After installation and configuration, login, open up a terminal emulator and type:

   .. code-block:: bash

      rsync -avx <username>@<ip-address>:~/ ~/

   In my case it was:

   .. code-block:: bash

      rsync -avx todd@192.168.1.182:~/ ~/

   .. note::
      There were issues getting ``gpg`` working on the 'new' computer from running ``rsync -avx`` and the ``.gnupg`` keyring directory.
      To successfully export/import, follow these steps: `<https://access.redhat.com/solutions/2115511>`_ | `<https://access.redhat.com/solutions/2115511>`_


.. _pureos_migrate_computers_applications:

Copying applications
--------------------

This brief guide describes the steps migrate applications from one computer to another one.

.. note::
   ``apt-clone`` is an alternative method that works within Debian GNU/Linux, but not derivatives such as PureOS.

On "source" computer
~~~~~~~~~~~~~~~~~~~~

#. Create the package list

   .. code-block:: bash

      dpkg --get-selections > /tmp/selections.list
      apt-mark showauto > /tmp/auto.list

#. Get the address of the 'old' machine.
   Open **Settings** > **Network** > **Network Settings**.
   Note the IPv4 Address (e.g. ``192.168.1.182``).

On "destination" computer
~~~~~~~~~~~~~~~~~~~~~~~~~

3. Copy over the "source" computer clone files

   .. code-block:: bash

      scp <user>@<ip-address>:/tmp/*.list /tmp

   In my case it was:

   .. code-block:: bash

      scp todd@192.168.1.182:/tmp/*.list /tmp

#. Update the package list before updating applications

   .. code-block:: bash

      sudo apt update

#. Upgrade to the latest base system first

   .. code-block:: bash

      sudo apt upgrade

#. Install all the packages

   .. code-block:: bash

      sudo /usr/lib/dpkg/methods/apt/update /var/lib/dpkg/
      sudo dpkg --set-selections < /tmp/selections.list
      sudo apt-get dselect-upgrade
      sudo xargs apt-mark auto < /tmp/auto.list