w3.bethelministries.org

Making And Maturing Disciples of Jesus Christ For The Glory Of God.

User Tools

Site Tools


servers

This is an old revision of the document!


Servers

Setup WordPress

Note: Example site name is myblog and user name is myuser.
Note: The following styles are used in this guide:

this typeface indicates a command to be entered in the terminal

A \ indicates that a command continues on the next line. The following two commands are equivalents:

sudo apt update && sudo apt upgrade

sudo apt update && \ sudo apt upgrade

name of a file to be edited
and this is the contents of the file
⋮ ← indicates sections of file not shown

1. Create a database for the WordPress site.

The first step we will take is to create a database that WordPress will use to store and maintain it’s data. At a terminal on the server issue the following command to launch the database management terminal with privileged access:

sudo mariadb

Note: MariaDB is a drop in replacement for MySQL. For this guide MariaDB and MySQL can be used interchangeably.

To create the database use the following command:

CREATE DATABASE wp_rick DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Note: SQL commands end with a ;

Next create a MariaDB user that will be used exclusively by WordPress. Use the following command:

GRANT ALL ON wp_rick.* TO 'wp_rick_user'@'localhost' IDENTIFIED BY 'secretpassword';

Now you have a database and user for WordPress’ exclusive use. The following command will reload the grant tables so the MariaDB knows about the changes.

FLUSH PRIVILEGES;

Exit out of MariaDB by typing:

EXIT;

2. Download and Pre-Configure WordPress

Download WordPress using wget from your home directory on the server.

Extract the compressed file to create the WordPress directory structure:

tar xzvf latest.tar.gz

On your own computer, use filezilla to copy wp-config-sample.php to your local computer. Host: bethelministries.co Username: rick Password: YourSuperSecretPassword

On your computer rename wp-config-sample.php to wp-config.php.

Open wp-config.php for editing. Modify the database connection settings. You need to adjust the database name, the database user, and the associated password that you’ve configured within MariaDB.

wp-config.php (Partial File – Database section)
⋮
 
define('DB_NAME', 'wp_rick');
 
/** MySQL database username */
define('DB_USER', 'wp_rick_user');
 
/** MySQL database password */
define('DB_PASSWORD', 'supersecretpassword');
 
⋮

Use your browser on your computer to navigate to https://api.wordpress.org/secret-key/1.1/salt/

copy the results into wp-config.php, replacing the define statements under Authentication Unique Keys and Salts.

wp-config.php (Partial section BEFORE edit)
/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
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' );
 
/**#@-*/
wp-config.php (Partial section AFTER edit)
/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'h=&l4.Zfi+Gzk/feWhG2?fL=l|jRzco{h,KQK4Dsx!+vpH@N4AmPSm>:VP47Yv$j');
define('SECURE_AUTH_KEY',  'E;|CQ)^!vVw.]4|@YMm)-p]Zm]KFq*2T10 >f7^|to3ZTpMMOUh?Y|x|K{;k$@|E');
define('LOGGED_IN_KEY',    'SJ#DDwU>IAV6^s/tbXjZ--cL+h9|}xlbeOz E:wnIr|{]dkpL|T2Ls.oZ]ofVAsv');
define('NONCE_KEY',        '-++QaRvkw-}9p@9||`hZ3EQl(,eInMJr+0[!3So&-@S|5{[Vj5GUuQFPMh.y-3F)');
define('AUTH_SALT',        ')D11R(5S_hi{]sISeQNt`kPRC#yj;~H?`R_~qR(1w:Of<$NM(B2:UK$V!Yh8xYl;');
define('SECURE_AUTH_SALT', 'F~QnAb;x@pvO[|}kplNi}cKHHqJ-p?#}1i}hEnN #9+zikCueBF!!snY!b~hcO#I');
define('LOGGED_IN_SALT',   '9081bzSU4X^jXWvfT?-D>hL&+(n()U.D3rr{Sd{3PFf6tl:BXjlOB,p%63[40uZc');
define('NONCE_SALT',       '@ZNAuqn><eO|N/55yMMu%{f+#Ux?*XB(tU*B-~)9%JKitu^~6Ja&S4@qP~nU=n:h');
/**#@-*/

Save and close the file when you are finished.

Copy the file from your computer back onto the server with Filezilla.

3. Prepare the virtualhost document root Directory

Back at the server, copy the entire pre-configured wordpress folder from your home directory on the server to your virtualhost document root. The source includes a dot at the end to indicate that everything in the directory should be copied, including hidden files.

sudo cp -a ./wordpress/. /var/www/rickandsarah.us

Now that WordPress is located in it’s final location we need to set the ownership and permissions for the files and folders.

Apache2 runs as www-data, so set the ownership to that user and group. This allows Apache2 to serve the files and update them when it needs to.

sudo chown -R www-data:www-data /var/www/rickandsarah.us

Change the permissions of the files and folders under /var/www/rickandsarah.us. We can use find to create a list of files or folders and chmod to apply the permissions.

sudo find /var/www/rickandsarah.us/ -type d -exec chmod 750 {} \; sudo find /var/www/rickandsarah.us/ -type f -exec chmod 640 {} \;

4. Complete the Installation Through the Web Interface

Finally, you can finish installing and configuring WordPress by accessing it through the web interface.

In your web browser, navigate to your server’s domain name or public IP address:

http://rickandsarah.us

Select the language you would like to use: Next, you will come to the main setup page. Select a name for your WordPress site and choose a username and password. A strong password is generated automatically. Save this password or select an alternative strong password.

Enter your email address and select whether you want to discourage search engines from indexing your site: When ready, click the Install WordPress button. You’ll be taken to a page that prompts you to log in: Once you log in, you will be taken to the WordPress administration dashboard: From the dashboard, you can begin making changes to your site’s theme and publishing content.

Conclusion

WordPress is now installed and ready to use. Some things you might want to consider:

  • Go over the settings and verify they are set to what you want.
    • In Discussion, you might want to specify that a user must be registered and logged in in order to comment.
    • Under Reading you can set what to show on the home page.
    • Configure Permalinks (the persistent path part of the url).
    • Setup a privacy page explaining your privacy policies.
  • Change the Appearance with themes
  • Install plugins (such as WPGiftRegistry and All-in-One WP Migration)
  • Check out the First Steps with WordPress guide: https://wordpress.org/support/article/first-steps-with-wordpress-classic/
servers.1570459132.txt.gz · Last modified: 2019/10/07 09:38 by johngoossen