Install WordPress via SSH

The following are the commands needed to install WordPress from the command line.

Note: change “/var/www/html” to the directory where you want WordPress installed. Also, change “www-data:www-data” to the correct user:group for your flavor of Apache.


cd /

mkdir tmp

cd tmp

wget (OR) curl -O

tar xzvf latest.tar.gz

touch wordpress/.htaccess

mkdir wordpress/wp-content/upgrade

mkdir /var/www/html/**newnamehere**

sudo mv  -v /tmp/wordpress/* /var/www/html/**newnamehere**

sudo chown -R www-data:www-data /var/www/html/**newnamehere** && sudo chmod -R g+w /var/www/html/**newnamehere** && sudo find /var/www/html/**newnamehere** -type d -exec chmod 755 {} \; && sudo find /var/www/html/**newnamehere** -type f -exec chmod 644 {} \;

Go to your new location and run through the steps to set up WordPress (if you need to set up a database, instructions can be found here). After installation, you can run the following 2 commands to harden your install:

sudo chmod 660 /var/www/html/**newnamehere**/wp-config.php

sudo chmod 666 /var/www/html/**newnamehere**/.htaccess