- Note: these links may change in the future, if they become dead, please report it.
- Download WordPress -stable branch zip archive, do not use Yum to install WordPress.
- Root or sudo access to the Centos system
Doing the Work
Basic description of what will be done and what is expected.
- Edit
/etc/hosts
as root: - Create web directories as root:
- Install httpd, MariaDB and PHP and configure them as root:
- Add Maria database container as root:
- Download WordPress into the Documentroot and configure
wp-config.php
as root: - As root, make sure MariaDB and httpd are started and and your web directories are all owned by the user/group your web server runs as (Warning: DO NOT DO THIS ON PRODUCTION SERVERS), in our case “apache”.
Next, the commands below will affect everything under:
/var/www/local_dev
- Restart httpd and MariaDB
- Check the running status of mariadb and httpd:
- Check the VirtualHosts config in httpd:
- Check the /etc/hosts file:
- http://wiki.centos.org
- http://wordpress.org
- http://codex.wordpress.org
- http://wordpress.org/extend/plugins
- http://wordpress.org/extend/themes
1 2 3 4 5 6 7 8 |
Make sure it looks something like this: # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 yourhostname localhost.localdomain localhost ::1 yourhostname localhost6.localdomain6 localhost6 127.0.0.1 local_dev 127.0.0.1 wordpress1 127.0.0.1 wordpress2 |
cd /var/www/; mkdir -p local_dev wordpress1 wordpress2
yum install httpd mariadb-server mariadb-bench php56u
For instructions on setting up MariaDB go here.
Add these lines to a new conf file located in: /etc/httpd/conf.d/localhost.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/local_dev ServerName local_dev ErrorLog logs/local_dev-error_log CustomLog logs/local_dev-access_log common AllowOverride All </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/wordpress1 ServerName wordpress1 ErrorLog logs/wordpress1-error_log CustomLog logs/wordpress1-access_log common AllowOverride All </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/wordpress2 ServerName wordpress2 ErrorLog logs/wordpress2-error_log CustomLog logs/wordpress2-access_log common AllowOverride All </VirtualHost> |
mysql -p
1 2 3 4 5 |
Enter password: MariaDB [(none)]> create database local_dev; MariaDB [(none)]> grant all privileges on local_dev.* TO 'local_admin'@'localhost' identified by 'strong_pass'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit; |
cd /var/www/local_dev;
wget https://wordpress.org/latest.zip; unzip latest.zip;
cd wordpress
mv wp-config-sample.php wp-config.php
vi wp-config.php
mv * ../
cd ../; rm -rf wordpress
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress1'); /** MySQL database username */ define('DB_USER', 'you') /** MySQL database password */ define('DB_PASSWORD', 'yourpass'); /** MySQL hostname */ define('DB_HOST', 'localhost'); 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'); Note: DO NOT USE THE SALTS IN THE EXAMPLE BELOW Example: define('AUTH_KEY', '{EY#xc5cgdAnNVSe0<ie!7_x9Rr|w$$??joee%Z<G0tOsp,2(N:ND+BZ}YLFqfXU'); define('SECURE_AUTH_KEY', 'yz_~,r/W%/L@+R(O:=X<zOSG?RK1],gy8Gh|Lq_OaPZ.-,mE;av~Sj8qa56h-_zX'); define('LOGGED_IN_KEY', 'B8RHA`-hYX<DFUsuw$&K)eVzMot>b%8R[]K)!z}>>eD(ok6N*Y|Z$a5?/`sm!jz+'); define('NONCE_KEY', 'z+#PsphC]Spu&1FIik02Uk8VWPJNN96aA+|ygA?_g%J:#<?Sssh,d$Q+H Y$+S^^'); define('AUTH_SALT', 'qkN;F_&_pU6nXtr| Wl4bW nWB06_>PbT&W@ UuvpBvm|h0V9bxMV`3;**pd@{I`'); define('SECURE_AUTH_SALT', 'PMK-[`y<mz:vJ9A.iTDd]dIGO!>d3.(9D*FJG?gtV#fu/HL7Y|LS#4W}WU^6sI?u'); define('LOGGED_IN_SALT', 'FwX0@}$^e] E9`M=#Cbm{8vC|Q(40+JYo_ehIT{H-TF&+Jsw+^o/-o9nIE^F|b>x'); define('NONCE_SALT', 'D<!fs#2j^7+)vsp?i+7 ART@wQ[H%+x8 39=ZH@oz2B+1X@yQ+w53X&JB<RJZISL'); |
Get a new set generated here: https://api.wordpress.org/secret-key/1.1/salt/
chown -Rf apache:apache /var/www/local_dev
find /var/www/local_dev -type f -exec chmod 644 {} \;
find /var/www/local_dev -type d -exec chmod 755 {} \;
1 |
systemctl restart mariadb.service; systemctl restart httpd.service |
Next, open a web browser and go to http://local_dev
You should be presented with the default WordPress install page.
You can repeat this for as many isolated instances as you want on your laptop or desktop Linux workstation.
Troubleshooting & Supplementary Information
How to Test
Explanation troubleshooting basics and expectations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
systemctl status mariadb.service; systemctl status httpd.service ● mariadb.service - MariaDB 10.0 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled) Drop-In: /usr/lib/systemd/system/mariadb.service.d └─mysql-compat.conf Active: active (running) since Sat 2015-12-05 11:47:32 PST; 5min ago Process: 11281 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS) Process: 11117 ExecStartPost=/usr/libexec/mysql-wait-ready $MAINPID (code=exited, status=0/SUCCESS) Process: 11081 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS) Process: 11057 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Main PID: 11116 (mysqld_safe) CGroup: /system.slice/mariadb.service ├─11116 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─11242 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/ma... Dec 05 11:47:30 quetzal mysqld_safe[11116]: 151205 11:47:30 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. Dec 05 11:47:30 quetzal mysqld_safe[11116]: 151205 11:47:30 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql Dec 05 11:47:32 quetzal systemd[1]: Started MariaDB 10.0 database server. ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled) Active: active (running) since Sat 2015-12-05 11:49:38 PST; 2min 57s ago Main PID: 11363 (httpd) Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec: 0 B/sec" CGroup: /system.slice/httpd.service ├─11363 /usr/sbin/httpd -DFOREGROUND ├─11364 /usr/sbin/httpd -DFOREGROUND ├─11365 /usr/sbin/httpd -DFOREGROUND ├─11366 /usr/sbin/httpd -DFOREGROUND ├─11367 /usr/sbin/httpd -DFOREGROUND ├─11370 /usr/sbin/httpd -DFOREGROUND └─11371 /usr/sbin/httpd -DFOREGROUND |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
httpd -S VirtualHost configuration: *:80 local_dev (/etc/httpd/conf.d/vhost.conf:1) ServerRoot: "/etc/httpd" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/etc/httpd/logs/error_log" Mutex lua-ivm-shm: using_defaults Mutex proxy: using_defaults Mutex authn-socache: using_defaults Mutex default: dir="/run/httpd/" mechanism=default Mutex mpm-accept: using_defaults Mutex authdigest-opaque: using_defaults Mutex proxy-balancer-shm: using_defaults Mutex rewrite-map: using_defaults Mutex authdigest-client: using_defaults PidFile: "/run/httpd/httpd.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="apache" id=48 Group: name="apache" id=48 |
1 2 3 4 5 6 |
cat /etc/hosts 127.0.0.1 yourhostname localhost.localdomain localhost ::1 yourhostname localhost6.localdomain6 localhost6 127.0.0.1 local_dev 127.0.0.1 wordpress1 127.0.0.1 wordpress2 |
Common problems and fixes
Describe common problems here, include links to known common problems if on another site
Disclaimer
We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #wordpress or #centoshelp on irc.freenode.net