Category Archives: CentOS

How to upgrade to latest version of Ghostscript on Linux/Unix

For a new project, I need to use the latest verison of Ghostscript (at time of going to pixel, this is v9.21). However the CentOS yum install will only give me version 8.7.

Some Googling gave me some helpful answers, including downloading the latest version from the website and using then building manually. Following the instructions required me open a terminal and type:

./configure

Which would give me the error:

-bash: ./configure: No such file or directory

Turns out, I was downloading the latest x64 binary file from the Ghostscript website (which shouldn’t be used in a live, production environment). Actully what I needed was the source files.

So the full instructions to install the latest version of Ghostscript (v9.21) from a terminal session:

wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs921/ghostscript-9.21.tar.gz

./configure

make

make install

You should be able to execute and check the version:

/usr/local/bin/gs -v

Which outputs:

GPL Ghostscript 9.21 (2017-03-16)
Copyright (C) 2017 Artifex Software, Inc.  All rights reserved.

Voila.

Quick guide to setting up a VNC Server on CentOS

Install packages
yum install vnc vnc-server

User configuration
Assuming the user has already been configured on your system and have passwords already set.
For a user to be granted VNC access, they must have a VNC password set.
From within that user’s account (or you can su into it, e.g. su vnc_user), run:
vncpasswd
And type in your desired password and confirm.

VNC configuration
Using a text editor, open: /lib/systemd/system/vncserver@.service
Search for and replace with the actual required user name.
Example:
(ExecStart=/usr/sbin/runuser -l -c "/usr/bin/vncserver %i"
PIDFile=/home//.vnc/%H%i.pid)

Becomes:
(ExecStart=/usr/sbin/runuser -l vnc_user -c "/usr/bin/vncserver %i"
PIDFile=/home/vnc_user/.vnc/%H%i.pid)

Save and exit from the file. Run the following commands:
systemctl daemon-reload
systemctl enable vncserver@:1.service

Test setup
service vncserver@:1 start
service vncserver@:1 stop
If the service starts and stops without any errors, then you are ready to set to load at boot up.

Set to run at bootup
chkconfig vncserver on

Set the window manager
Edit your user’s VNC xstartup file: /home/vnc_user/.vnc/xstartup
Add the following to the bottom of the file:
gnome-session &
Save and close the file.

Add exception to iptables:
Edit /etc/sysconfig/iptables and add the following line:
-A INPUT -m state —state NEW -m tcp -p tcp -m multiport —dports 5901:5903,6001:6003 -j ACCEPT
Exit the file and restart iptables:
service iptables restart

Start the VNCServer:
service vncserver@:1 start

Using your client software, you can now connect via the IP address and display number. e.g. 192.168.0.5:1

Automatically reduce/scale CPU frequency in Linux

I have recently been converting my old computer into a webserver and leaving it switched on in my lounge. After the constantly whirring cooling fan started to bother me, I looked at reducing the CPU frequency in order to reduce heat production (and power consumption).

A bit of research led me to try and install CPUSPEED. However I when I tried to install via yum, I kept the getting package not available error.

I have since found the CPUPOWER package:

yum install cpupower
# cpupower --help
Usage:	cpupower [-d|--debug] [-c|--cpu cpulist ]  []
Supported commands are:
	frequency-info
	frequency-set
	idle-info
	idle-set
	set
	info
	monitor
	help

Not all commands can make use of the -c cpulist option.

Use 'cpupower help ' for getting help for above commands.

This is clearly very powerful for controlling the CPU. Enjoy the help file to find the answer, or for automatic control:

--cpu all frequency-set --governor ondemand