Created
April 22, 2011 00:03
-
-
Save dogmatic69/935747 to your computer and use it in GitHub Desktop.
moving aws locations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log into the old server | |
ssh -i <key_file> ubunut@<old_ip> | |
// login as root | |
sudo su | |
// tar the entire drive skipping a few dirs | |
tar -cvpzf backup.tar.gz --exclude=~/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copying the files from the old server to the new server | |
scp -i <key_file> backup.tar.gz ubuntu@<new_ip>:~/ | |
// exit the server | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log into the new server | |
ssh -i <key_file> ubuntu@<new_ip> | |
// unzip the backup and overwrite everything on the new instance (lazy install) | |
sudo tar -xvpzf backup.tar.gz -C / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fixing up sources on the new server | |
sudo nano /etc/apt/sources.list | |
// when nano opens find and replace the old with the new | |
ctrl + \ | |
// you will be given the following | |
// - find what | |
// - replace with | |
// - [a] for all | |
// when done save and exit, on the keyboard hit | |
ctrl + o // save | |
ctrl + x // exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clean apt-get | |
sudo apt-get clean | |
cd /var/lib/aptsudo | |
// always backup | |
mv lists lists.old | |
// fooling it to thing there was a partial update? | |
sudo mkdir -p lists/partial | |
// update the server | |
sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// oh I do love pipe, this downloads the key from the ubuntu server and pipes the text to apt-key add | |
wget -q "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x<key_it_complained_about>" -O- | sudo apt-key add - | |
// updates should now work | |
sudo apt-get update | |
sudo apt-get upgrade | |
// \o/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove anything mysql related | |
sudo yes | apt-get remove mysql-* | |
// install all the mysql stuff you need again | |
sudo yes | apt-get install mysql-server php5-mysql | |
// dont forget to add your users back and/or run your database buckup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save this to ~/.ssh/config | |
host <some-cool-name> | |
Port <port> | |
User <user> | |
HostName <host> | |
// fill out the stuff in <here> and then use it like 'ssh <some-cool-name>' | |
// you can also do ssh some<tab> for auto complete :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment