This is the procedure for how to install WordPress from the command line on a FreeBSD or similar UNIX- or Linux based web server.

In the following examples, it is assumed, that the commands are run by a system administrator on behalf of a client, that does not have a shell assigned to their system user account and is restricted to SFTP access only. It is assumed, that MySQL database, PHP scripting language and Apache web server is configured.

Installing WordPress from the command line.

Download WordPress from the official website of WordPress and unpack the compressed file. Make basic preparations, such as configuring MySQL database access, preparing for Apache configuration file for redirects and creating the upload directory for WordPress media files.

# wget https://wordpress.org/latest.zip
# unzip latest.zip
# rm latest.zip
# mv wordpress/* /home/ann/www/www.example.com
# cd /home/ann/www/www.example.com
# touch .htaccess
# chmod 0666 .htaccess
# mv wp-config-sample.php wp-config.php
# nano wp-config.php
# mkdir -m 0777 wp-content/uploads
# chown -R ann:sftp *

Installing WordPress in other languages.

WordPress is also available in other languages. In the example below, the Danish version of WordPress is downloaded as latest-da_DK.zip.

...
# wget https://da.wordpress.org/latest-da_DK.zip
# unzip latest-da_DK.zip
# rm latest-da_DK.zip
...

Updating WordPress from the command line.

WordPress are normally updated from within the WordPress dashboard. If necessary, it can also be updated from the command line. This is done by deleting core parts of WordPress and then installing the updated WordPress. The existing configuration, themes and plugins are not affected.

...
# rm -rf /home/ann/www/www.example.com/wp-{admin,includes}
...

Installing WordPress plugins from the command line.

WordPress themes and plugins can be installed and uninstalled from within the the WordPress dashboard. However, if needed, they are also available for download from the official WordPress website in compress Zip files. In the exmple below, the Yoush SEO plugin is downloaded and installed from the command line. The group and mode are normally set correct by default.

# wget https://downloads.wordpress.org/plugin/wordpress-seo.zip
# unzip wordpress-seo.zip
# rm wordpress-seo.zip
# mv wordpress-seo /home/ann/www/www.example.com/wp-content/plugins
# chown -R ann:sftp /home/ann/www/www.example.com/wp-content/plugins/wordpress-seo
# chmod 0755 /home/ann/www/www.example.com/wp-content/plugins/wordpress-seo

Updating WordPress plugins from the command line.

Updating a plugin is simply done by deleting the plugin before the Zip file is installed.

...
# rm -rf /home/ann/www/www.example.com/wp-content/plugins/wordpress-seo
...

Deleting WordPress website from command line.

If you no longer will be serving the WordPress website, then you can delete it.

# rm -rf /home/ann/www/www.example.com/*

More about WordPress and web servers.

Learn more about retricting system user accounts to their home directory on SFTP server with OpenSSH on FreeBSD by myself.