{"id":259,"date":"2014-08-24T14:17:29","date_gmt":"2014-08-24T14:17:29","guid":{"rendered":"https:\/\/www.joetannorella.com\/?p=259"},"modified":"2014-11-24T18:18:29","modified_gmt":"2014-11-24T18:18:29","slug":"linux-server-setup-powering-deployment","status":"publish","type":"post","link":"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/","title":{"rendered":"Linux server setup: from powering on to deployment"},"content":{"rendered":"
This post is more for my own use than anything else. These are common snippets I use that I’ve jotted down to jog my memory whenever I need them.<\/p>\n
apt-get install git<\/pre>\nSource: http:\/\/git-scm.com\/book\/en\/Getting-Started-Installing-Git<\/p>\n
rsync the SSH key to computer<\/h2>\n
We need to make sure the VPS is trusted from the git repo (Bitbucket, Github, etc).<\/p>\n
Create the key:<\/p>\n
ssh-keygen -t rsa -C "joetannorella@gmail.com"<\/pre>\nThen download the key:<\/p>\n
rsync -avzh root@website.com:\/~.ssh\/id_rsa.pub \/Users\/joetannorella\/sites\/<\/pre>\nThen copy the contents of the key:<\/p>\n
cat id_rsa.pub | pbcopy<\/pre>\nSource: http:\/\/www.tecmint.com\/rsync-local-remote-file-synchronization-commands\/<\/p>\n
To copy contents of a file from Mac<\/h2>\n
cat ~\/Desktop\/ded.html | pbcopy<\/pre>\nTo use an SSH key from Mac with a Nix server <\/span><\/h2>\n
Something I was getting wrong (I know this sounds ridiculous!) is that I was generating the SSH key on the SERVER side, NOT on the CLIENT side.<\/p>\n
That was the problem.<\/p>\n
You must generate the SSH key pair on the client side, and then transfer the public key over to the authorised file under ~\/.ssh on the server.<\/p>\n
To do this:<\/h3>\n
Generate the keypair:<\/p>\n
ssh-keygen -t rsa<\/pre>\nThen copy over the public key to the server. The following line assumes that no .ssh folder is present:<\/p>\n
cat ~\/.ssh\/id_rsa.pub | ssh user@machine "mkdir ~\/.ssh; cat >> ~\/.ssh\/authorized_keys"<\/pre>\nMySql Local to Live<\/h2>\n
Export local DB to file within the local Git repo, and then sync up with Git repos so it’s on the live server.<\/p>\n
Log in to MySql:<\/p>\n
mysql -u <user> -p<\/pre>\nThen load the SQL from the file now on the live server. From the current directory:<\/p>\n
mysql> source sqlfile.sql<\/pre>\nRsync using a non-standard port (for shared hosting)<\/h2>\n
rsync -avzh -e "ssh -p <port>" <user>@<server>:<server_file_location>\u00a0<local_destination_location><\/pre>\nWordPress file persmissions<\/h2>\n
sudo chown -R www-data:www-data public<\/pre>\n","protected":false},"excerpt":{"rendered":"This post is more for my own use than anything else. These are common snippets I use that I’ve jotted down to jog my memory whenever I need them. Install Git: Source: http:\/\/git-scm.com\/book\/en\/Getting-Started-Installing-Git rsync the SSH key to computer We need to make sure the VPS is trusted from the git repo (Bitbucket, Github, etc)….<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"yoast_head":"\n
Linux server setup: from powering on to deployment - JoeTannorella.com<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n