[Snippet] Restrict user to a particular folder

By default in Linux, an SSH can freely navigate around your file system. I recently needed to restrict an SSH user to their home directory. You need rbash.

CentOS doesn’t ship with rbash enabled as default. It was easy enough to solve.

[codesyntax lang=”bash”]
ln -s /bin/bash /bin/rbash

Then change /etc/passwd so that the user’s shell is /bin/rbash.

[Snippet] One line installation of wkhtmltopdf

A super quick, one line install of wkhtmltopdf

[codesyntax lang=”bash”]
wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2 && tar xvjf wkhtmltopdf-0.10.0_rc2-static-amd64.tar.bz2 && mv wkhtmltopdf-amd64 /usr/bin/wkhtmltopdf

Quite often you’ll need pdftk also

[codesyntax lang=”bash”]
wget http://pkgs.repoforge.org/pdftk/pdftk-1.44-2.el6.rf.x86_64.rpm && rpm -Uvh pdftk-1.44-2.el6.rf.x86_64.rpm && pdftk

How I installed Batik for HighCharts

Batik for HighCharts allows you to create static PNGs from dynamic data. HightCharts offers a hosted export server, sometimes I don’t want to use a 3rd party service.
Here’s how I installed the Apache Batik SVG Toolkit to create PNGs from HightCharts on CentOS

You’ll need a HighCharts download also.

yum install batik
yum install batik-rasterizer
chmod 777  highcharts/exporting-server/php/php-batik/temp
wget http://mirrors.enquira.co.uk/apache/xmlgraphics/batik/batik-1.7-jre13.zip
unzip batik-1.7-jre13.zip     
cd batik-1.7             
cp batik-rasterizer.jar lib/ ../highcharts/exporting-server/php/php-batik/ -r       
yum install bitmap*   
yum install dejavu*     
ln -s /usr/share/fonts/dejavu /usr/share/fonts/dejavu-lgc

 

Change default cron editor on CentOS

Install nano

Installing nano is done using the yum system.

[codesyntax lang=”bash”]
yum -y install nano

System Default Editor

During login, a number of scripts are run to setup the environment. In CentOS, a file for each subject is used. These are stored in a system profile directory, /etc/profile.d/. There are two environment variables that control which editor to use.

[codesyntax lang=”bash”]
cat <<EOF >>/etc/profile.d/nano.sh
export VISUAL=”nano”
export EDITOR=”nano”
EOF

How to replace MySQL with MariaDB in 11.36

MariaDB is an enhanced, drop-in replacement for MySQL – best of all, nobody from Oracle phones you trying to sell you a premium version!
I see many applications moving over to soon when Oracle steps up it’s marketing, after all, I assume that is why Oracle bought MySQL.

Here’s how I replaced MySQL with MariaDB on cPanel/WHM. Continue reading “How to replace MySQL with MariaDB in 11.36”

cache::Cache error when installing Munin on Fedora/CentOS

There is a fruity issue with the munin RPM on Fedora/CentOS.

You may encounter this message;

[root@foo ~]# /usr/share/munin/plugins/mysql_ suggest
Missing dependency Cache::Cache at /usr/share/munin/plugins/mysql_ line 716.
[root@foo ~]#

You are simply missing two Perl modules – perl-Cache-Cache and perl-IPC-ShareLite.

yum install perl-Cache-Cache perl-IPC-ShareLite

MySQL 5.0 or 5.1 to 5.5 Upgrade Traumas on CentOS

Ignoring all the panic-mongers on the rest of the internet upgrading MySQL from 5.0 or 5.1 to 5.5 shouldn’t be that difficult. My task was to upgrade from 5.0 to 5.5 on CentOS (Remi Repos). It was to fix a bug with MySQL 5.0 ignoring the wait_timeout parameter in my.cnf.

Five to five on a Friday, I dive into the swamp, which turns out to be full of alligators.

Alligator 1: Version depenencies
Alligator 2: /usr/libexec/mysqld: unknown option ‘–skip-locking’
Alligator 3:  [ERROR] Error message file ‘/usr/share/mysql/english/errmsg.sys’ had only 481 error messages,
but it should contain at least 641 error messages.
Or some other variation of numbers.

Continue reading “MySQL 5.0 or 5.1 to 5.5 Upgrade Traumas on CentOS”

Alternate ‘Messing with time and date on Linux’

Following up from a previous post, some hypervisors like Xen are a bit fruity when trying to control the time via NTP. Here’s how we managed it.

Firstly, if your installation doesn’t have ntp install. Install that.

[codesyntax lang=”bash”]
yum install ntp

Continue reading “Alternate ‘Messing with time and date on Linux’”