Ubuntu 18.04 Install WordPress in Home partition

­Install LAMP

For the purposes of this exercise the Apache document root will be moved to /home/mike/www/ and MySQL data directory moved to /home/mysql and a virtual host created called pcdocgo.co.uk

Use Tasksel to install LAMP services

$ sudo apt install tasksel

Install latest Apache, MySQL and PHP servers

$ sudo tasksel install lamp-server

Configure Apache

Add user to Apache www-data group

$ sudo useradd -G www-data mike

Prepare new document root

$ mkdir /home/mike/www
$ sudo rsync -av /var/www/html /home/mike/www

Note: rsync – be sure there is no trailing slash on the source directory. When there’s a trailing slash, rsync will dump the contents of the directory into the destination directory instead of transferring it into a containing directory of the same name as the source, e.g. html.

Add Virtual Host

$ cd /etc/apache2/sites-available
$ sudo cp 000-default.conf pcdocgo.co.uk.conf
$ sudo nano /etc/apaches2/sites-available/pcdocgo.co.uk.conf

Replace

DocumentRoot /var/www/html

with

DocumentRoot /home/mike/www
<Directory /home/mike/www/wordpress/>
 Options Indexes FollowSymLinks
 AllowOverride All
 Require all granted
</Directory>

Save file.

Note: Directory directives explanation

  1. Options
    • Indexes – if a URL which maps to a directory is requested and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will returns a formatted listing of the directory WordPress .htaccess code redirects this to index.php
    • FollowSymLinks – the server will follow symbolic links in this directory, e.g. Permalinks
  2. AllowOverride All – allow the use of .htaccess to override Apache global settings for this directory
  3. Require all granted – access to directory is allowed unconditionally to avoid permission errors

Use a2ensite to enable site – creates software symbolic link in /etc/apache2/sites-enabled

$ sudo a2ensite pcdocgo.co.uk.conf

Disable the Apache default site (/var/www/html)

$ sudo a2dissite 000-default.conf

Enable Apache2 mod_rewrite module to allow modification of URLs

$ sudo a2enmod rewrite

Create .htaccess file and add WordPress rewrite code support

Now that Apache is configured to allow rewrites through .htaccess files, we need to create it in the site root folder.

Create empty .htaccess file

$ touch /home/mike/www/wordpress/.htaccess

Add web server (www-data) group ownership:

$ sudo chown :www-data /home/mike/www/wordpress/.htaccess

$ nano /home/mike/www/.htaccess

Add the following code:

# BEGIN WordPress

RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]

# END WordPress

Note: WordPress adds/updates the above .htaccess code when Permalink Settings > Post aliases are changed. e.g, name.

Once modified save and exit.

Note: If WordPress were installed directly in the document root directory the rewrite codes would be:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

For increased security set .htaccess permission to read only.

$ chmod 644 /home/mike/www/.htaccess

644 is normally required and recommended for .htaccess.

Test Apache2 configuration changes

$ sudo apachectl -S

To suppress AH00558 error
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

Add Servername directive to Apache2 global configuration file

$ sudo nano /etc/apache2/apache2.conf

Add

ServerName 127.0.0.1

Save and exit and test again

$ sudo apachectl configtest

Reports “Syntax OK” when no errors found

Restart Apache2 to effect changes

$ sudo systemctl restart apache2

Configure MySQL

Move MySQL data directory to /home/mike/mysql

Check current root is /var/lib/mysql/

$ mysql -u root -p
mysql> select @@datadir;

Output

+-----------------+
| @@datadir |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
1 row in set (0.00 sec)

mysql> exit;

Stop MySQL

$ sudo systemctl stop mysql

Copy data directory to /home/mysql

$ sudo rsynch -av /var/lib/mysql /home

Backup original mysql folder by renaming it

$ sudo mv /var/lib/mysql /var/lib/mysql.bak

Point mysql data directory to new home folder location

Edit the MySQL configuration file

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Find “datadir” and change the path form /var/lib/mysql to /home/mysql

Edit AppArmor alias file to let MySQL write to the new directory by creating an alias between the default directory and the new location.

$ sudo nano /etc/apparmor.d/tunables/alias

Add the following alias rule to the end of the alias file

$ alias /var/lib/mysql/ -> /home/mysql/,

Restart AppArmor

$ sudo systemctl restart apparmor

Restart MySQL

$ sudo systemctl restart mysql

Verify status

$ sudo systemctl status mysql

Create WordPress Database and Admin User

$ mysql -u root -p
mysql> CREATE DATABASE pcdocgo_db;
mysql> CREATE USER mike@localhost IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON pcdocgo_db.* TO mike@localhost;
mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Install WordPress

Download latest WordPress and extract to ~/wordpress

$ cd ~
$ wget http://wordpress.org/latest.tar.gz
$ tar xzvf latest.tar.gz

Configure WordPress

$ cd ~/wordpress
$ cp wp-config-sample.php wp-config.php

Download WordPress Secure Keys and add to wp-config.php

$ curl -s https://api.wordpress.org/secret-key/1.1/salt/

Copy output to Paste buffer

$ nano wp-config.php

Overwrite dummy values section below with Paste buffer

. . .
#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');
. . .

Replace DB_NAME, DB_USER, and DB_PASSWORD values with database, user and password values:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'pcdocgo');

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

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

Once complete, save and close wp-config.php

Prepare  WordPress directory

Copy content

$ sudo rsync -avP ~/wordpress /home/mike/www

Configure Permissions

$ cd /home/mike/www

Assign ownership values

$ sudo chown -R mike:www-data *

Create Uploads directory

$ mkdir /home/mike/www/wp-content/uploads

Allow Apache to write to this directory

$ sudo chown -R :www-data /var/www/html/wp-content/uploads

Complete WordPress Installation via Web Interface

In web browser, navigate to localhost

http://localhost

For new installs you will see the WordPress initial configuration page, where you will create an administrator account. Fill out the information for the site and the administrative account information. When finished, click on the Install WordPress button. WordPress will confirm the installation, and then ask you to log in with the account just created

Change the Permalink Settings to Post name

Adjust the permalink settings through the WordPress administration interface. On the left-hand side, under the Settings menu, select Permalinks and click the Post name radio button. Click “Save Changes” to generate the .htaccess rewrite rules.

References:

https://linuxconfig.org/how-to-install-lamp-ubuntu-18-04-bionic-beaver-linux-apache-mysql-php

www.ubuntugeek.com/how-to-change-the-mysql-data-default-directory.html

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04

https://dzone.com/articles/install-wordpress-on-ubuntu-1804

NPM Rebuild

Delete node_modules folder and execute npm install

Virtualbox after 5.2.22 GA Install and Restart Windows Guest can’t Sign In

After installing  Virtualbox 5.2.22 Guest Additions and restart you can’t sign in. The Keyboard input is not recognised. Don’t try to restart from power button on login page as you end up going round in circles. Instead elect to Shutdown and then Start.

After this everything seems to be OK although I did not notice it took several minutes to shutdown the first time after successfully logging in. After this it shut down in the normal time frame.

.

 

 

 

Window 10 1803 Update Bug Automatic Repair Loop bootres.dll corrupt

Fix by Clean Install

  1. Boot Windows 10 iso usb and enter Troubleshoot – Advanced Option – Command
  2. Chkdsk d: /f  – where d: is the Windows drive
  3. Boot Macrium Reflect or Acronis True Image usb and make an image backup of the drive to a portable usb drive
  4. Boot Windows 10 1809 iso usb and do a clean install removing all partitions before hand
  5. Once Windows 10 1809 is up and running install 3rd party backup software
  6. Mount backup image and recover Home folder(s)
  7. Reinstall applications, e.g. Office Adobe Reader, …
  8. Uninstall 3rd party backup software

This is a particularly nasty bug, which, thankfully does not seem to affect all machines. In this case it was a Dell latitude E4310 laptop. It is a sledgehammer approach but the only way I could find to fix it.

Migrate Outlook 2010 onwards to another PC

Outlook migration steps

  • Source PC
    • Note account settings
      • Email addresses
      • Corresponding IMAP/POP3 and SMTP servers
      • Data folder locations
      • Default delivery pst file
    • Note data file locations, e.g.:
      • c:\users\[user]\Documents\Outlook Files\
      • c:\users\[user]\AppData\Local\Microsoft\Outlook
      • c:\users\[user]\AppData\Roaming\Microsoft\Outlook
    • Close Outlook
    • Copy all above data folders to a portable drive
  • New PC
    • Copy data from portable drive to same locations
    • Install Outlook 2010 but don’t start it
    • Run Control Panel
    • Change from Category view to  Medium Icons
    • Double-click Mail icon
    • Create new profile called Outlook
    • Set settings the same as the Source PC and save profile
    • Change Control Panel back to Category view
    • Disable Wireless/LAN connection
    • Start Outlook
    • Go to Account setting and enter email passwords
    • Re-enable Wireless/LAN connection
    • Click Send/Receive to update/synchronise data files

 

List Windows Installed Programs

List Installed Programs

Command Prompt

wmic product get name,version

Powershell

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, Size, InstallDate | Format-Table -AutoSize

 

Downgrade Linux Thunderbird

For those who have upgraded to latest Thunderbird to find Calendar add-on is suddenly not compatible. The quick fix is to roll-back to last version as follows:

Display Thunderbird available versions

apt-cache show thunderbird | grep Version

Select last version to rollback to, e.g.

sudo apt-get install thunderbird=1:52.9.1+build3-0ubuntu0.14.04.1

 

 

 

Fix Windows 10 EFI 0xc000000f Boot Error

Repair Windows 10 UEFI boot error 0xc000000f

If you can boot into Advanced Startup Options menu jump to step 4

  1. Insert the Windows 10 ISO USB in your PC and restart
  2. Boot from the media
  3. Select Repair Your Computer
  4. Select Troubleshoot
  5. Select Advanced Options
  6. Select Command Prompt

Type following in Command window

Use Diskpart to assign drive letter to EFI system partion

diskpart
list disk (Note which disk is your boot drive, e.g. 0)
select disk 0
list vol (System volume, e.g. 4 will be FAT32 size = 100-300MB )
select volume 4
assign letter=k:
exit
format k: /FS:FAT32 (Optionally format the System volume)
Finally rewrite BCD boot data to System volume
bcdboot C:\windows /s k: /f UEFI (or /f ALL for both BIOS and UEFI)
Reboot to start Windows. You should find that the BCD error code 0xc000000f in Windows 10 has been resolved.

Here are the instructions for rebuilding the System (EFI) partition

diskpart
list disk
select disk 0      (to select a disk to “create a new EFI partition”)
list partition
select partition 1 
shrink desired=200 minimum=200 (set size to 200MB)
create partition efi
list partition
select partition 2       (assuming that the new partition is the partition 2)
Format fs=fat32
list vol                (note the new volume number, e.g. 3)
select vol 3  
assign letter=k:
List vol        (and check which letter is assigned to the 200 MB EFI partition).
bcdboot C:\Windows /l en-gb /s k: /f ALL (assuming that C is for Windows partition and k for the EFI)

CA Useful Notes

Computer Active Useful Notes

www.snipca.com/nnnnn

nnnnn

32799 Padlet – share content
32643 Captura – records Windows screen(s)
32442 Glasswire firewall – indentifies programs that secretly use your Internet
31235 Android Magnifying Glass (IOS 31236)
30849 Appbuster Bulk Windows uninstall programs
30789 Search Companies House
29712 CloneApp Backup Windows App and System Settings default features
29899 MiTec Task Manager Delux – better Windows Task Manager
27353 Lasso to prioritise RAM for programs that need it
28329 NoBot AV scanner – use with AdwCleaner
28321 ControlMyMonitor colour tweaker, from NirSoft
28351 BleachBit remove hidden junk like ccleaner without paywall limitations
27011 Mpow’s Air Vent Mount <£10
26883 InSpectre Meltdown + Spectre detector and perf indicator – also disables patch
26868 Whocrashed 6.01 BSOD Analyser
26836 Cloudberry – remote access via web browser
25761 Google Backup&Sync 15GB free storage
26760 Drive Formatter – Wipe data
26400 DMEX Explorer tool ctrl-F1 menu to split windows
26359 W10 WinAero Tweaks
26358 Bootracer see which programs slow PC start up
25237 Windows Repair Pro
25199 Colorize Photos
24973 MusicBee + MediaMonkey.com
24368 Wise Program Uninstaller
23038 AllDup free duplicate file finder

Tips & Recommendations
Weed out broken system files
Run Deployment Image Servicing and Management tool
dism.exe /online /cleanup-image /Restorehealth
Once finished, check with System File Checker
sfc /scannow

Useful Stuff
www.Doodle.com – organise a get-together, send email link
WeTransfer instead of email attachment store file on their server and send recipient message + file link
MediaFire as WeTransfer but videos
Netgear Arlo Pro 2 camera inc 7 day online storage
Money Manager EX – replacement for Microsoft Money (support ended 2009)
Adobe Photoshop Express free Windows 10 basic photo editing app
clonapp.de Back up installed software to move to another PC/OS
Moneypool – Paypal Group to collect money
Logitech MK540 coffee prof kb + mouse – wireless only
Fast DNS 1.1.1.1/1.0.0.1 1dot1dot1dot.cloudflare.dns.com
www.easyscreenocr.com Extract text from screenshot
netsh wlan show profile “NETWORK” key+clear – Show WiFi password
netsh wlan show profile – Show WiFi networks
Notepad log book add .LOG to print time stamp on open
NordVPN nordvpn.com best paid for VPN £9.10/mon
TunnelBear alternative free/paid VPN 1.5GB/mon with TWitter a/c
www.aeroadmin.com free Unlimited Teamviewer alternative
Remove USB command line utility
https://www.uwe-sieber.de/drivetools_e.html

Recommended Printers

  • Brother MFC-J5330DW £120
  • Epson WF-3720DWF £80
  • Epson WF-2860DWF £70
  • HP Officejet 8715 £150 – bit noisy, but fast
  • Canon MG5750 £55 – no ADF
  • Canon TS6150 £100 – no ADF