WordPress/Installation/CentOS

From r00tedvw.com wiki
Revision as of 20:08, 5 February 2018 by R00t (Talk | contribs)

Jump to: navigation, search

Ubuntu Installation | CentOS Installation
Installation done on CentOS 6.9

Contents

Download required packages

~$ sudo yum install mysql-server php php-mysql -y 

Date

Make sure your date/time is set correctly

~$ date -s "5 FEB 2018 18:54:00" 

Setup MySQL

Start MySQL

~$ sudo service mysqld start

Set the root password

~$ sudo /usr/bin/mysql_secure_installation 
Enter current password for root (enter for none):
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Configure MySQL

~$ mysql -u root -p
~$ mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'THISpasswordSHOULDbeCHANGED';
~$ mysql> CREATE DATABASE wordpress;
~$ mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'wordpressuserpassword' WITH GRANT OPTION;

Install Wordpress

~$ sudo mkdir /opt/wordpress && sudo wget -O /opt/wordpress/wordpress-4.9.2.tar.gz https://wordpress.org/latest.tar.gz
~$ mkdir /var/www/html/website.com
~$ tar -C /var/www/html/website.com/ -zxf /opt/wordpress/wordpress-4.9.2.tar.gz
~$ sudo cp -r /var/www/html/website.com/wordpress/* /var/www/html/website.com/
~$ sudo rm -r var/www/html/website.com/wordpress/

Configure Wordpress

~$ cp /var/www/html/website.com/wp-config-sample.php /var/www/html/website.com/wp-config.php
~$ ~$ vim /var/www/html/website.com/wp-config.php
...
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

it would also be a good idea to SALT your authentication and cookies. go to https://api.wordpress.org/secret-key/1.1/salt/ and it will auto generate random salts. You can change these at any time to invalidate all cookies given out forcing users to log back in.

~$ ~$ vim /var/www/html/website.com/wp-config.php
...
define('AUTH_KEY',         'mMHx%-{<+&.P~c27Yw;jQ*,bp*%W4vPF#/vo_[Q`My07j*zXj27PRumC-|4mhCV)');
define('SECURE_AUTH_KEY',  'cu#`Jh,?^}jh%~#NE/:hzB<iCMf$@D| 4/ov|-OHrA=`/%? k15|T}k^kl2%ZaGP');
define('LOGGED_IN_KEY',    'w!Ur~brqVe~B]-M^^YQ]gc[oo9oKsg.M//TH=k#mf_#Kq>AKbMih|B(8yuE`~dlI');
define('NONCE_KEY',        '(+1vx]Q;)%&3Z}j1[${Q#/F5i465kTrOEG{hyM<|dv hfV2U%|@M6m|Fn9EnE1}^');
define('AUTH_SALT',        'W((kWAX/0`-VZ`#30)0]:&D}c0KZg|aMhF5=L6wtJotRA2}DeD;,(YC_m67aq) W');
define('SECURE_AUTH_SALT', 'D?fyi DhO&98g,R^+h[= XyeEp+Y?WcNDUv@!:1^PoNUD4xa|ko/a}mK*0i!w3{b');
define('LOGGED_IN_SALT',   '}=JeV6A!uhkMC2hYH2Bwr-ME%|nnr!rvPH9Lt/S8Z%i>Z5s=<%x4F[NsUl3`Q.m{');
define('NONCE_SALT',       'H4{=At.DFY+rUv{~L|fKbn/]W_UY-`EcUc`Su$LU|wdI@qi/>*z~g!qB+;/K|asG');

Configure Folders and Permissions

Wordpress needs the appropriate permissions setup in order to load content properly.

To determine what user/group your httpd uses, you can run this command.

~$ egrep -i '^user|^group' /etc/httpd/conf/httpd.conf
User apache
Group apache

Create the upload directory

~$ mkdir /var/www/html/website.com/wp-content/uploads 

Installation instructions say to give the sudo user and the apache user ownership of all the wordpress files and folders

~$ sudo chown -R root:apache /var/www/html/website.com/*

HTTPD Configuration

If you've already got a site setup, you may already have httpd configured. If not, it's fairly easy.

If you're going with a subsite configuration, the virutalhost file is going to be simple and only point to the site's root directory

~$ sudo vim /etc/httpd/conf.d/website.com.conf
add:
<VirtualHost *:80>
        ServerName website.com
        ServerAdmin [email protected]
        DocumentRoot /var/www/html/website.com/
        TransferLog /var/log/httpd/website.com-access_log
        ErrorLog /var/log/httpd/website.com-error_log
</VirtualHost>
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox