Quickly install WordPress from the command line (7 easy steps)

Install wordpress from the command line:

Here’s the quickest way to install wordpress from the command line:

1. Get wordpress:
wget --quiet http://wordpress.org/latest.zip ; unzip -q latest.zip

2. Get rid of your old site and mv wordpress to your document root (or put it where-ever it is you want it)
mv www www-old ; mv wordpress www

3. Change to the wordpress directory
cd www

4. Rename the config file

mv wp-config-sample.php wp-config.php

5. Edit the config file, be sure to put in your db name, username and password in the code below

sed -i -e 's/database_name_here/YOUR_DB_NAME_HERE/' wp-config.php
sed -i -e 's/username_here/YOUR_USER_NAME_HERE/' wp-config.php
sed -i -e 's/password_here/YOUR_PASSWORD_HERE/' wp-config.php

6. Set your unique keys and salts

wget -q -O - https://api.wordpress.org/secret-key/1.1/salt/

you’ll get something like:

define('AUTH_KEY', 'Jcie-e]vC6!^;JHf5}ikA]k){#RWr&Sl6/Z-M,F=Y+4{G?dFc`=!E+bl^Mu!,c e');
define('SECURE_AUTH_KEY', '.o5oBJC|p[X4');
define('LOGGED_IN_KEY', 'TR_Nc m|w;5@e2EgA55$5:1U -NWd|tC_^M;oYt^3{j-4;P~oU#&bBBMvXH=m6i(');
define('NONCE_KEY', 'c}c E?V$C*T({;lm:(1K?+~AP`vM4< !rnounx~Qydz:n]7V< *98 6[+!d='); define('LOGGED_IN_SALT', 'pG}6d}~l3nbEHPD9$@?eSp

Do not copy the above into your wp-config.php - it is an example only and not safe to use

paste the output of this into wp-config.php

7. Load the install page into your browser, follow the steps and you are done!

Wordpress install screenshot

or as a near one-liner :

DB_USER=put_the_db_username_here ; DB_PASS=put_the_db_user_password_here ; DB_NAME=put_the_db_name_here ; wget --quiet http://wordpress.org/latest.zip ; unzip -q latest.zip ; mv www www-old ; mv wordpress www ; mv www/wp-config-sample.php www/wp-config.php ; sed -i -e "s/database_name_here/$DB_NAME/" www/wp-config.php ; sed -i -e "s/username_here/$DB_USER/" www/wp-config.php ; sed -i -e "s/password_here/$DB_PASS/" www/wp-config.php ; rm -f latest.zip ; wget -q -O - https://api.wordpress.org/secret-key/1.1/salt/

Leave a Reply

Your email address will not be published. Required fields are marked *