{"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":"
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 Create a backup of your MySQL database.<\/p>\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 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 Unpack the zip archive<\/p>\n This will create new ‘wordpress’ directory<\/p>\n Remove the ‘wp-admin’ and ‘wp-includes’ directories from your old WordPress installation<\/p>\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 Delete the zip archive and the empty ‘wordpress’ directory<\/p>\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>\nssh root@IP<\/pre>\n
mysqldump -u DBUSER -p DBNAME > \/root\/database_dump.sql<\/pre>\n
rsync -Waq \/path\/to\/your\/site \/path\/to\/backup<\/pre>\n
cd \/var\/www\/html\r\nwget https:\/\/wordpress.org\/latest.zip<\/pre>\n
unzip latest.zip<\/pre>\n
rm -rf oldwordpress\/wp-includes\r\nrm -rf oldwordpress\/wp-admin<\/pre>\n
mv wordpress\/* oldwordpress\/<\/pre>\n
rm -rf wordpress\r\nrm -f latest.zip<\/pre>\n