{"id":17575,"date":"2015-08-25T15:24:46","date_gmt":"2015-08-25T20:24:46","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=17575"},"modified":"2022-12-15T06:32:22","modified_gmt":"2022-12-15T12:32:22","slug":"how-to-upgrade-a-wordpress-website-via-ssh","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/","title":{"rendered":"How to upgrade a WordPress website via SSH"},"content":{"rendered":"
<\/div>

\"wordpress-logo-notext-rgb\"Keeping your WordPress installation, plugins and themes up to date is very important. You have to continually update WordPress immediately after a new version is released. The new versions will bring you new features, bug fixes, stability improvements and the most important – security fixes. If you do not update your WordPress\u00a0 website it is very likely that your website will be hacked at some point. In this case you can lose your website content, your customers, lose your Google ranking, your website can be defaced, your server can be used for spamming, and many more. So, updating WordPress should be on the top of your list when it comes to the security of your Linux virtual server<\/a>.<\/a><\/p>\n

<\/p>\n

In this blog post we will explain how to update your WordPress installation to the latest available version through the Linux command line.<\/p>\n

Log in to your server via SSH as user root and first of all make sure to create a backup of your website and database.<\/p>\n

ssh root@IP<\/pre>\n

Create a backup of your MySQL database.<\/p>\n

mysqldump -u DBUSER -p DBNAME > \/root\/database_dump.sql<\/pre>\n

Replace DBUSER with your actual MySQL user and DBNAME with the name of the WordPress database. Once you execute the command you will be prompted to enter the password of the database<\/p>\n

Now, backup the website files using the following command<\/p>\n

rsync -Waq \/path\/to\/your\/site \/path\/to\/backup<\/pre>\n

Don’t forget to replace the paths in the command with the actual paths.<\/p>\n

Now, once we have created a backup of the website files and the database, we can start the update. If something goes wrong, you can easily restore your WordPress website from the backup.<\/p>\n

Change the current working directory to the document root directory and download WordPress zip archive from their official website<\/p>\n

cd \/var\/www\/html\r\nwget https:\/\/wordpress.org\/latest.zip<\/pre>\n

Unpack the zip archive<\/p>\n

unzip latest.zip<\/pre>\n

This will create new ‘wordpress’ directory<\/p>\n

Remove the ‘wp-admin’ and ‘wp-includes’ directories from your old WordPress installation<\/p>\n

rm -rf oldwordpress\/wp-includes\r\nrm -rf oldwordpress\/wp-admin<\/pre>\n

Replace ‘oldwordpress’ with the actual name of your WordPress directory.<\/p>\n

Now, move all content of the newly created ‘wordpress’ directory to the old WordPress directory and overwrite all files and directories.<\/p>\n

mv wordpress\/* oldwordpress\/<\/pre>\n

Delete the zip archive and the empty ‘wordpress’ directory<\/p>\n

rm -rf wordpress\r\nrm -f latest.zip<\/pre>\n

With this step the WordPress upgrade process from the command line is completed. Now you need to access http:\/\/yourdomain.com\/wp-admin\/upgrade.php to run the upgrade script and upgrade the database.<\/p>\n

WordPress can be also upgraded through the command line interface using the WP-CLI interface<\/a>. It is already explained in one of our previous blog posts.<\/p>\n

Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to update your WordPress installation, plugins or themes for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n

PS.<\/strong><\/span> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

Keeping your WordPress installation, plugins and themes up to date is very important. You have to continually update WordPress immediately … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":17576,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1710,21],"tags":[104,65,889,148],"yoast_head":"\nHow to upgrade a WordPress website via SSH - RoseHosting<\/title>\n<meta name=\"description\" content=\"How to upgrade a WordPress website via SSH - RoseHosting\" \/>\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.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to upgrade a WordPress website via SSH - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"How to upgrade a WordPress website via SSH - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-25T20:24:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-15T12:32:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to upgrade a WordPress website via SSH\",\"datePublished\":\"2015-08-25T20:24:46+00:00\",\"dateModified\":\"2022-12-15T12:32:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\"},\"wordCount\":488,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png\",\"keywords\":[\"Command Line\",\"security\",\"upgrade\",\"wordpress\"],\"articleSection\":[\"CMS, CRM, ERP\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\",\"name\":\"How to upgrade a WordPress website via SSH - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png\",\"datePublished\":\"2015-08-25T20:24:46+00:00\",\"dateModified\":\"2022-12-15T12:32:22+00:00\",\"description\":\"How to upgrade a WordPress website via SSH - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png\",\"width\":500,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to upgrade a WordPress website via SSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to upgrade a WordPress website via SSH - RoseHosting","description":"How to upgrade a WordPress website via SSH - RoseHosting","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.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/","og_locale":"en_US","og_type":"article","og_title":"How to upgrade a WordPress website via SSH - RoseHosting","og_description":"How to upgrade a WordPress website via SSH - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2015-08-25T20:24:46+00:00","article_modified_time":"2022-12-15T12:32:22+00:00","og_image":[{"width":500,"height":500,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png","type":"image\/png"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to upgrade a WordPress website via SSH","datePublished":"2015-08-25T20:24:46+00:00","dateModified":"2022-12-15T12:32:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/"},"wordCount":488,"commentCount":4,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png","keywords":["Command Line","security","upgrade","wordpress"],"articleSection":["CMS, CRM, ERP","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/","name":"How to upgrade a WordPress website via SSH - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png","datePublished":"2015-08-25T20:24:46+00:00","dateModified":"2022-12-15T12:32:22+00:00","description":"How to upgrade a WordPress website via SSH - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2015\/08\/wordpress-logo-notext-rgb.png","width":500,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-upgrade-a-wordpress-website-via-ssh\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to upgrade a WordPress website via SSH"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/17575"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=17575"}],"version-history":[{"count":3,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/17575\/revisions"}],"predecessor-version":[{"id":44285,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/17575\/revisions\/44285"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/17576"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=17575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=17575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=17575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}