To install WordPress to your server the following steps need to be performed.
- download WordPress
- unpack WordPress
- create database for WordPress
- setup WordPress configuration
- run install script
One of the preconditions is that either mySQL or MariaDB, PHP and Apache web server are already installed on your server.
From a command prompt
It is possible to go to the WordPress with your browser and download the most current version of WordPress.
https://wordpress.org/download/
This isn’t a bad solution if the computer you are browsing the Internet with also happens to be your web server. A better solution would be to have a dedicated server (or virtual server) and to download the software directly to it.
On linux the wget command can be used to retrieve a file if we know where it is located. Those nice folks at WordPress have made this very easy by always having the most current version available under the name latest.tar.gz or latest.zip.
wget http://wordpress.org/latest.tar.gz
The file can be unpacked with the following command.
tar zxvf latest.tar.gz
This will unzip the file into the wordpress subdirectory in the current working directory. The zip file should be unpacked into the directory of the web server. On Debian this is /var/www/html.
WordPress will be unpacked into the wordpress directory. This is fine if you want your blog to be prefixed with wordpress.
http://www.example.com/wordpress
If your intend to only run wordpress, you can move the contents to the root directory.
mv wordpress/* .
WordPress stores users, posts, comments, and links in the database. It is necessary to create a database, user and grant privileges to the database for the user. In order to do that, you need to log into the database as the owner (root).
mysql -u<root user> -p<root password>
create user 'max'@'localhost' identified by 'supersecret' ;
create database fishwrapper ;
grant all privileges on fishwrapper.* to max@localhost;
Before quitting it is best to switch to the database to verify that it is properly created and then exit mysql.
use fishwrapper;
exit
Before WordPress can be installed the configuration file needs to be properly setup. WordPress provides a sample configuration file called wp-config-sample.php. This file needs to be copied to wp-config.php and then changed to contain the database setup for your environment.
The database name, user and password need to be updated to contain the new user and database information. It is possible to leave the host set to localhost.
define('DB_NAME', 'database_name_here');
define('DB_USER', 'username_here');
define('DB_PASSWORD', 'password_here');
define('DB_HOST', 'localhost');
There is one more little section in this file that contains eight keys which are used for cookies. It is not actually necessary to change these phrases but a good idea.
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
Not only is it a good idea, it is super simple to get values for these keys. Simply visit the WordPress link below and it will generate the values which can simply be copied and pasted directly into the configuration file.
https://api.wordpress.org/secret-key/1.1/salt/
The final step is just to run the install script from WordPress. From the web browser, simply run the script.
http://www.example.com/wordpress/wp-admin/install.php
The installation script will only ask for a few pieces of information.
site title
db user
db password
email address
allow search engines to search this site checkbox
This final step takes a couple of seconds. Once this is done the site is available.