Process For Setup CREATE DUPLICATE TEST SYSTEM
Virtualbox VM for wordpress web server.
- NAME webvm.dev
- CPU 1
- Memory 2G min
- Disk 20G min
- Network Bridge
Virtualbox VM for MariaDB server.
- NAME dbvmA.dev
- CPU 1
- Memory 2G min
- Disk 15G min
- Network Bridge
Virtualbox VM for MariaDB server.
- NAME dbvmB.dev
- CPU 1
- Memory 2G min
- Disk 15G min
- Network Bridge
vim /etc/hosts
localhost 127.0.0.1
webvm.dev 192.168.1.10
dbvmA.dev 192.168.1.11
dbvmB.dev 192.168.1.12
-
Install mysql server on primary database vm
sudo apt-get install mysql-server mysql-client -y
sudo mysql_secure_installation
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]
bind-address = dbvmA.dev
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
log_bin_index = /var/log/mysql/mysql-bin.log.index
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = wordpress
binlog_ignore_db = mysql
sync-binlog = 1
sync-relay-log = 1
sync-relay-log-info = 1
sync-master-info = 1
- Restart Mysql Service
sudo service mysqld restart
- Install mysql server on secondary database vm
sudo apt-get install mysql-server mysql-client -y
sudo mysql_secure_installation
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]
bind-address = dbvmA.dev
server-id = 2
log_bin = /var/log/mysql/mysql-bin.log
log_bin_index = /var/log/mysql/mysql-bin.log.index
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = wordpress
binlog_ignore_db = mysql
sync-binlog = 1
sync-relay-log = 1
sync-relay-log-info = 1
sync-master-info = 1
- Restart Mysql Service
sudo service mysqld restart
-
Setup named wordpress admin user of database.
- CREATE USER 'webuser'@'webvm.dev' identified by '123456';
- GRANT ALL ON . TO 'webuser'@'%.webvm.dev';
- CREATE USER 'webuser'@'webvm.dev' identified by '123456';
- GRANT ALL ON . TO 'webuser'@'%.webvm.dev';
-
Setup wordpress replication user for master-master database.
- CREATE USER 'repl_user'@'dbvmB' identified by '123456';
- GRANT REPLICATION SLAVE ON wordpress.* TO 'repl_user'@'%.dbvmB.dev';
- FLUSH PRIVILEGES;
- CREATE USER 'repl_user'@'dbvmA' identified by '123456';
- GRANT REPLICATION SLAVE ON wordpress.* TO 'repl_user'@'%.dbvmA.dev';
- FLUSH PRIVILEGES;
-
Setup empty database for wordpress installation to fill.
- CREATE DATABASE wordpress;
- CREATE DATABASE wordpress;
-
Get Replication position on primary database.
mysql> use wordpress;
mysql> FLUSH TABLES WITH READ LOCK;
mysql -uroot --vertical -e "show master status;"
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 455 | wordpress | mysql | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
- Dump mysql database to raw sql file.
mysqldump -uroot -p wordpress > dbvmA.sql
- Switch back to console with open mysql client connection and release the DB.
mysql> UNLOCK TABLES;
mysql> exit;
-
Copy database to secondary database server.
scp ./dbvmA.sql datasci@dbvmB.dev:/tmp/dbvmA.sql
-
Import database from primary database into secondary database.
mysql -uroot -p wordpress < /tmp/dbvmA.sql
-
Get Replication position on secondary database.
mysql -uroot --vertical -e "show master status;"
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 1426 | wordpress | mysql | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
- Start replication on secondary database.
mysql> STOP SLAVE;
mysql> CHANGE MASTER TO master_host='dbvmA.dev', master_port=3306, master_user='repl_user', master_password='12345', master_log_file='mysql-bin.000001', master_log_pos=455;
mysql> START SLAVE;
- Start replication on primary database.
mysql> STOP SLAVE;
mysql> CHANGE MASTER TO master_host='dbvmB.dev', master_port=3306, master_user='repl_user', master_password='12345', master_log_file='mysql-bin.000001', master_log_pos=1426;
mysql> START SLAVE;
- Verify on each server that replication is working on each.
mysql -uroot --vertical -e "show slave status;"
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
mysql -uroot --vertical -e "show slave status;"
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
- If you have Connecting or No on either database you will have to resync.
- But entails mostly going back over getting replication position and repeat.
-
Install Wordpress 5.x php7.x and support libraries.
URL: for download: https://wordpress.org/download/releases/
-
cd /var/www/html/
-
tar zxvf wordpress-5.3.2.tar.gz
-
sudo apt-get install php7.3 php7.3-mysql php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-xmlrpc php7.3-soap php7.3-intl php7.3-zip
-
Copy wp-config.php from remote system and keep each systems credentials in comments.
-
Uncomment for local development or production remote system.
-
-
BACKUP on system to recreate Wordpress page.
- Use Filezilla to backup all your wordpress directory files with ftp.
- Save DB using WP Migrate convert DNS webhost name to local testing webvm.dev.
- Convert all //userspace.org to //webvm.dev:8080
- Convert all /a/b/c/d/public_html to local /var/www/html
-
Change Various HOSTNAME data in files to DEV system.
- The rest of the changes will be in the Curator Theme.
- Need to make script to change theme HOSTNAME data.
- cd /var/www/html/wp-content/themes/curator/
- Change HOSTNAME data to your dev system in header.php , index.php , style.css
- cd js
- Change HOSTNAME data in common5.js , init4.js
-
RESTORE to local development system.
* Migrate only wordpress sql into systems DB.
`mysql wordpress < wordpress-migrate-20191008215324.sql`
* (OPTIONAL)Change wordpress login password to current system.
- ONLINE GERNATE MD5HASH: http://www.miraclesalad.com/webtools/md5.php
OR
- Get an MD5 hash of your password.
- On Unix/Linux:
- Create a file called wp.txt, containing nothing but the wordpress admin password.
- tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘ -‘
- rm wp.txt
`UPDATE wp_users SET user_pass="tc4dlsd67888dkf3662c86818b9df302314" WHERE ID = 1;`
-
OPTIONAL FIND admin user in detail.
- “use (name-of-database)” (select WordPress database)
- “show tables;” (you’re looking for a table name with “users” at the end)
- “SELECT ID, user_login, user_pass FROM (name-of-table-you-found);” (this gives you an idea of what’s going on inside)
- “UPDATE (name-of-table-you-found) SET user_pass=”(MD5-string-you-made)” WHERE ID = (id#-of-account-you-are-reseting-password-for);” (actually changes the password)
- “SELECT ID, user_login, user_pass FROM (name-of-table-you-found);” (confirm that it was changed)
- "exit" mysql
-
Change permissions on files and directories in alignment with httpd process.
- Install files you had downloaded from remote FTP server
cd /var/www/html/wordpress/ sudo find . -exec chown www-data:www-data {} + sudo find . -type f -exec chmod 664 {} + sudo find . -type d -exec chmod 775 {} + sudo chmod 660 wp-config.php
echo "define('FS_METHOD','direct');" >> wp-config.php
URL: http://webvm.dev/wp-admin/
-
Install/Activate Plugins,Fix Media Library.
- Use the Carousel Slider Plugin I use in this repo as I changed the lazyload image.
- I also use the podcast player from this repo, upgrading it seems to break it.
- Just check Regenerate Thumbnails and start processing.
-
Random Mix
- Widget Item not working : Had to save again. APPEARANCE->MENUS
- I also changed menu item icons to thumbnail size.
-
Wordsquest, if new words need to be overwritten to DB. Then reactivate plugin.
- scp words.sql to dbvmA.dev server.
- mysql wordpress < words.sql
-
Permalinks were not working.
- Go to SETTING->PERMALINKS and SAVE.
- This will regenerate your .htaccess file.
-
Still having problems with 404 and your permalinks.
- Check the apache2 config or in sites enabled for "AllowOverride None" Change None to All.
-
Setup CRON to PING site and set off WPCRON functions for updating my site cache
NOTE: May use free account on https://uptimerobot.com in future.
mkdir /usr/local/cron/
vim /usr/local/cron/updateRSScache.sh
curl -v --silent http://userspace.org/ 2>&1 | grep Words
crontab -e
0 */2 * * root /usr/local/cron/updateRSScache.sh
-
Add Hyperdb to Wordpress for load balance,fail-over,replication and cache.
- Download zip "wget https://downloads.wordpress.org/plugin/hyperdb.zip"
- Unzip "unzip hyperdb.zip"
- Move config to /var/www/html/db-config.php
- Add define('SLAVE_HOST','IP_ADDRESS_OF_SLAVE');" to wp-config.php
- Comment or uncomment needed DB config in db-config.php
- Activate HyperDB by moving config to /var/www/html/wp-content/db.php
-
Install REDIS for object caching.
LOGON: URL: http://webvm.dev/wp-admin/
- Install REDIS Wordpress plugin and activate.
apt-get install php-redis redis-server
vim /etc/redis/redis.conf
- Add bind address
- Uncomment auth password
- Add segment to wp-config.php
$redis_server = array(
'host' => 'dbvmA.dev',
'port' => 6379,
'auth' => '12345',
'database' => 0, // Default is 0.
);
-
Test to see if REDIS object cache its working.
redis <host address>
auth 12345
keys *