Skip to content

Instantly share code, notes, and snippets.

@colegatron
Created July 21, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colegatron/c064b44797701ae5c1a292b2b239606c to your computer and use it in GitHub Desktop.
Save colegatron/c064b44797701ae5c1a292b2b239606c to your computer and use it in GitHub Desktop.
Move Ubuntu to the new machine
Whenever is possible, try to do not install anything on your desktop.
Use virtualbox.
Better, use Docker.
Don't feel bad. I have lots of shit installed in my desktop too.
------
On source machine:
------
$ sudo apt-key exportall > /tmp/trustedkeys.txt
$ sudo tar zcvf /tmp/etc.tgz /etc
$ sudo dpkg --get-selections | sed "s/.*deinstall//" | sed "s/install$//g" > /tmp/pkglist.txt
$ sudo scp /tmp/trustedkeys.txt /tmp/etc.tgz /tmp/pkglist.txt remoteuser@destmachine:~
------
On dest machine:
------
sudo apt-get install -y openssh-server
sudo apt-key add trustedkeys.txt
# etc.tgz is only needed if you configured something locally instead on virtualbox or docker (nginx.conf, my.cnf or similar)
sudo apt-get install aptitude -y
sudo aptitude update && cat ~/pkglist.txt | xargs sudo aptitude install -y | tee ~/install.log
# Check the install log to see what was not installed (always there is some package poor package not installed, skype, for example)
# Install them
# Do this after everything is installed. That will overwrite the default configs ~/.whatever/cfg with your own right versions.
# The reverse would be a disaster, wouln't?
$ rsync -avz /home/ivan ivan@192.168.10.97:/home/ivan/ # Care not forget with the trailing /
----------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment