{"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

Install Git:<\/h2>\n
apt-get install git<\/pre>\n

Source: 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>\n

Then download the key:<\/p>\n

rsync -avzh root@website.com:\/~.ssh\/id_rsa.pub \/Users\/joetannorella\/sites\/<\/pre>\n

Then copy the contents of the key:<\/p>\n

cat id_rsa.pub | pbcopy<\/pre>\n

Source: 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>\n

To 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>\n

Then 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>\n

MySql 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>\n

Then load the SQL from the file now on the live server. From the current directory:<\/p>\n

mysql> source sqlfile.sql<\/pre>\n

Rsync 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>\n

WordPress 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":"\nLinux server setup: from powering on to deployment - JoeTannorella.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux server setup: from powering on to deployment - JoeTannorella.com\" \/>\n<meta property=\"og:description\" content=\"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)....\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/\" \/>\n<meta property=\"og:site_name\" content=\"JoeTannorella.com\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-24T14:17:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-24T18:18:29+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/\",\"url\":\"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/\",\"name\":\"Linux server setup: from powering on to deployment - JoeTannorella.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.joetannorella.com\/#website\"},\"datePublished\":\"2014-08-24T14:17:29+00:00\",\"dateModified\":\"2014-11-24T18:18:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.joetannorella.com\/#website\",\"url\":\"https:\/\/www.joetannorella.com\/\",\"name\":\"JoeTannorella.com\",\"description\":\"Web Development | Digital Marketing | Business\/Startups | Analytics\/data\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.joetannorella.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.joetannorella.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.joetannorella.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux server setup: from powering on to deployment - JoeTannorella.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/","og_locale":"en_US","og_type":"article","og_title":"Linux server setup: from powering on to deployment - JoeTannorella.com","og_description":"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)....","og_url":"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/","og_site_name":"JoeTannorella.com","article_published_time":"2014-08-24T14:17:29+00:00","article_modified_time":"2014-11-24T18:18:29+00:00","author":"admin","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/","url":"https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/","name":"Linux server setup: from powering on to deployment - JoeTannorella.com","isPartOf":{"@id":"https:\/\/www.joetannorella.com\/#website"},"datePublished":"2014-08-24T14:17:29+00:00","dateModified":"2014-11-24T18:18:29+00:00","author":{"@id":"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.joetannorella.com\/linux-server-setup-powering-deployment\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.joetannorella.com\/#website","url":"https:\/\/www.joetannorella.com\/","name":"JoeTannorella.com","description":"Web Development | Digital Marketing | Business\/Startups | Analytics\/data","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.joetannorella.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.joetannorella.com\/#\/schema\/person\/84eafed4ad6cd6934b006e371c06c7ae","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.joetannorella.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/257001162d06da1a465f242dfa80dd7b?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/www.joetannorella.com\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts\/259"}],"collection":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":13,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":329,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/posts\/259\/revisions\/329"}],"wp:attachment":[{"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joetannorella.com\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}