Tuesday, May 7, 2024
51
rated 0 times [  51] [ 0]  / answers: 1 / hits: 103459  / 3 Years ago, sun, july 25, 2021, 10:10:16

I am going to change my machine: from a laptop with Ubuntu to another laptop where I am going to install Ubuntu...



I am quite happy with the current system, what I am afraid of is having to rebuild everything from 0.



So what do people often do to clone an Ubuntu system? That may include the data, packages, shortcut settings, etc...


More From » system-installation

 Answers
7

There are a few ways to copy your config and set up. It depends on how big the changes you have made. And if you are upgrading to a new version. Some of the methods are useful when upgrading between versions but be careful as they can stop some software form working correctly.



Method 1: Fresh install



The most robust and stable way is a fresh install and then copy the config and re-install all your packages. This also work from an old version to a new version. There are ways to make this happen quite quickly, and automate most of the process. The slowest part would be having to download all the packages not included in your install media. I had the 8 dvd disk images that allowed me to install much faster then downloading.



I would recommend this option as setting up and install grub, can render your system unusable. You need to have a solid grasp of grub to use method 2.



Before you do your new install (new laptop) you need to copy some information off your old install (old laptop).



Your setup or configuration



All the files that save your customization are stored in two places. The first and most import is your /home/[username] directory. There can be hundreds of .[package-config-dir] files and directories. I am going to list the most important but you can have more and add more if you want. This process can cause problems with packages not working correctly. So be careful when you do this. Make a back up of you fresh install before you paste your new directories.



These directories and files are not very large, and will probably only take a few hundred megabytes. This method is also useful between upgrades. You can quite quickly copy all the configuration changes you made between Ubuntu versions.



By default most programs create the .[package-config-dir] when they run the first time. If it does not exist it is recreated. You should not rely on this behavior as not all programs will work like this.




  1. Using Nautilus, navigate to your home directory (/home/[username])

  2. Select "View menu → Show Hidden Files" (or Ctrl+H)


  3. You should now see all the hidden .* directories. You might need to do this as root. simply start nautilus as root from a command line.



    Select the following directories and copy them to a separate directory.



    /home/aaron/.config  
    /home/aaron/.gconf
    /home/aaron/.gnome2
    /home/aaron/.gnome2_private
    /home/aaron/.local
    /home/aaron/.mozilla


    I have made changes to these files. So I copy them as well.



    /home/aaron/.bash_aliases 
    /home/aaron/.bashrc
    /home/aaron/.vimrc


    There may be many other packages that you use that don't store the configuration in these directories. Copy them as well, but be warned if the programs don't work as expected. You might need to restore the .* file or directory. You could do this by simply deleting the file or directory, but you should have made a back up before copying over the directories.


  4. Depending on how you use your system. You might have made changes to some of the files in the /etc directory. If you have you should copy them as well. I create a custom smb.conf file for work and I have many Apache virtual hosts I use for development so I copy them as well. You could copy your whole /etc directory but this can create problems if you machine does not have exactly the same set up in terms of hardware. Which it wont going from one machine to another.



    /etc/samba/smb.conf
    /etc/hosts
    /etc/apache2 # the whole directory.


    Copy your config files before or after you install new software. Don't do this while an software package install is currently running. You could break the installation.




Your installed packages



Using Synaptic you can export all your installed packages quite easily using the export markings menu option.




  1. File menu → Save markings as

  2. Check "Save full state, not only changes"

  3. Choose a name and directory to save this file (You will probably have to put this on a flash drive.)



You can then reload all your installed packages by reversing the process:




  1. File menu → Read markings

  2. Select the file you created in the first step.



This will probably take the longest. If you download a lot of packages (1Gb of packages), this will take a few hours.



Method 2: Using disk images



I will make method 2 as a separate post. This is a more advanced option. It requires you understand partitions, install grub, and use the command line.



How to copy an Ubuntu install from one laptop to another


[#43412] Monday, July 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
inciplyies

Total Points: 10
Total Questions: 114
Total Answers: 93

Location: French Polynesia
Member since Sun, Dec 20, 2020
3 Years ago
;