Enabling zRAM Sawpspace on RHEL Clones

zRAM is a kernel module which creates swapspace in compressed RAM. The speed benefits of having swapspace in RAM far outweigh the minor cost of compression in CPU cycles.

zRAM is controlled by systemd, there’s no need for an fstab entry. It’s also installed by default on RHEL 7 and 8 and their clones. All you need to do is enable it. There are several steps to this process.

First, create a new file with the command:

sudo nano /etc/modules-load.d/zram.conf

In that file, add the word:

zram

Write out and close the file.

Next, create a new file with the command:

sudo nano /etc/modprobe.d/zram.conf

In that file, paste the line:

options zram num_devices=1

Write out and close the file.

Configure the size of the zRAM partition. Create a new file with the command:

sudo nano /etc/udev/rules.d/99-zram.rules

In that file, paste the following (modifying the disksize attribute to fit your needs):

KERNEL=="zram0", ATTR{disksize}="2G",TAG+="systemd"

Write out and close the file.

The existing swap file or partition must be disabled for zRAM to function. Edit /etc/fstab with the command:

sudo nano /etc/fstab

In that file, comment out the line for the swap partition or image by adding a leading # character.

Write out and close the file.

To run zRAM at startup, create a systemd unit file with the command:

sudo nano /etc/systemd/system/zram.service

Paste the following contents into the file:

[Unit]
Description=Swap with zram
After=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/sbin/mkswap /dev/zram0
ExecStart=/sbin/swapon /dev/zram0
ExecStop=/sbin/swapoff /dev/zram0

[Install]
WantedBy=multi-user.target

Write out and close the file.

Enable the new unit with the command:

sudo systemctl enable zram

Reboot.

To see if zRAM is working issue the command:

cat /proc/swaps

You can see details on utilization and compression using the command:

zramctl

That’s it! Have a beer, and consider reclaiming the disk space utilized by your old swap file or partition.

Enable ZoneMinder Multi-port Mode on Centos 7

Multi-port is a work-around for the six simultaneous connections per domain linmit in Chrome and WebKit. When implemented, ZoneMinder outputs each monitor’s video stream on a separate port, which Chrome considers a separate domain.

The instructions and forum posts I found on the web were all for Debian-based distros. I run ZoneMinder on CentOS 7. When RPMFusion recently updated ZoneMinder to 1.34.0 (stable), I took the opportunity to enable multi-port mode. This is actually easier on CentOS and other RedHat-based distros than it is on Debian or Ubuntu. So here’s how. Begin by pointing your browser to:

https://your.server.hostname/zm/index.php?view=options&tab=network

Enter “30000” (without quotes) in the MIN_STREAMING_PORT field, then click the SAVE button. This tells ZoneMinder to stream video each monitor on a port number equaling 30000 + the monitor number. So if your system has eight monitors, ZoneMinder serves the first monitor stream on port 30001, the second on 30002, etc. up to port 30008.

We’re not done. Apache must be configured to listen on the assigned ports. Since the upgrade to ZoneMinder 1.34.0 forces client connections via ssl we’ll be editing ssl.conf. Unlike Debian, this is the only file we need to edit for the default RPMFusion installation of ZoneMinder on CentOS 7. Prior to editing, make a back-up copy:

sudo cp /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.bak

Next , lets edit the ssl.conf file. I detest VI’s user interface, so I use Nano: 

sudo nano -w /etc/httpd/conf.d/ssl.conf

Scroll down to the line that reads “Listen 443 https”, then add a line corresponding to each new port ZoneMinder needs to stream video, one per monitor starting with 30001. Assuming a system with eight monitors, the new lines are:

Listen 30001 https
Listen 30002 https
Listen 30003 https
Listen 30004 https
Listen 30005 https
Listen 30006 https
Listen 30007 https
Listen 30008 https

Next, find the line which reads “<VirtualHost _default_:443>” and edit to include the new streaming ports for ZoneMinder, separated by spaces. For the above example with three monitors, the new line would look like this:

<VirtualHost _default_:443 *:3001 *:30002 *:30003 *:30004 *:30005 *:30006 *:30007 *:30008>

Write out the file, then exit Nano. Next, test the Apache configuration:

sudo apachectl -t

Correct any errors, then re-test. Once all is well, restart Apache:

sudo systemctl restart httpd

Then restart ZoneMinder:

sudo systemctl restart zoneminder

Lastly, we must open the range of new ports in the firewall:

sudo firewall-cmd --zone=public add-port=30001-30008/tcp

Your server should answer <success>.

sudo firewall-cmd --zone=public add-port=30001-30008/tcp --permanent

Your server should answer <success>.

sudo firewall-cmd --reload

Your server should answer <success>. Now point your browser to:

https://your.server.hostname/zm/index.php?view=montage

You should see all of your monitors streaming on the Montage page. Congrats! Go get yourself a beer.

Windows 7 End-of-Life Advisory and Upgrade to Windows 10 for Free

As of January 14, 2020, Windows 7 is no longer supported by Microsoft. That means no more security updates for the OS, and no more virus definition updates for Security essentials. If you’re running Windows 7 on the web, your machine is vulnerable, and you’re also placing others at risk. Upgrade to Windows 10 now, for free! Here’s how:

  1. Log into Windows 7 as an administrator
  2. Ensure your machine is current on all updates
  3. Click the start menu, then type PowerShell in the search box
  4. Right-click on the PowerShell icon, then select “Run as Administrator”
  5. Allow PowerShell to make changes to Windows when prompted
  6. At the PowerShell command line, enter the following command:
    Set-ExecutionPolicy Unrestricted
  7. Close PowerShell
  8. Download this script by right-clicking then selecting Save As
    https://scatterpated.net/download/upgrade.ps1
  9. Navigate to the downloaded script, right-click, then select Run with PowerShell
  10. Allow Microsoft to make changes to Windows when prompted
  11. Wait a while, possibly for a long while if you have a slow machine
  12. You can use the task manager to monitor the upgrade process
  13. If the upgrade stops, navigate to C:\temp and run the Upgrade to Windows 10 file interactively, you may be prompted to remove drivers or programs