Configure Sendmail on HPUX to listen on localhost only

Configure Sendmail on HPUX to listen on localhost only

HPUX 11.23

Edit /etc/mail/sendmail.cf  – search for DaemonPortOptions  and set
O DaemonPortOptions=Name=MTA, Addr=127.0.0.1
O DaemonPortOptions=Addr=127.0.0.1, Port=587, Name=MSA, M=E

Restart Sendmail

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

Confirm sendmail is only listening on localhost

netstat -an | grep 25
tcp 0 0 127.0.0.1.25 *.* LISTEN

HPUX 11.11,  HPUX 11.00 and HPUX 10.20

Edit /etc/mail/sendmail.cf  – search for DaemonPortOptions  and set
O DaemonPortOptions=Addr=127.0.0.1

Restart Sendmail

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

Confirm Sendmail is only listening on localhost

netstat -an | grep 25
tcp 0 0 127.0.0.1.25 *.* LISTEN

HPUX 11.31

cd /usr/newconfig/etc/mail/cf/cf
./gen_cf

1 General Features
8:  Send only

0 Main Menu

5: Generate sendmail.cf

6: Generate submit.cf

9: Create User and Queue for MSP
The group account for smmsp would be
created with the following gid value
gid = 25
>  Do you want to continue and create the group with the above gid
Press any key to continue or [n/N] to change the gid value

Group created Successfully

The user account for smmsp would be
created with the following uid value(recommended).
uid = 2500
>  Do you want to continue and create the user with the above uid
Press any key to continue or [n/N] to change the uid value

User created successfully
Creating Queue dir for MSP: /var/spool/clientmqueue/
Access permissions of /usr/sbin/sendmail is set to 2555
Group ID of /usr/sbin/sendmail is set to smmsp
Press any key to continue

0: Exit from selection

cp sendmail.cf.gen /etc/mail/sendmail.cf
cp submit.cf.gen /etc/mail/submit.cf

vi /etc/mail/sendmail.cf
O DaemonPortOptions=Name=MTA, Addr=127.0.0.1
O DaemonPortOptions=Addr=127.0.0.1, Port=587, Name=MSA, M=E

vi /etc/rc.config.d/mailservs
export SENDMAIL_SERVER=0
export SENDMAIL_SERVER_NAME=
export SENDMAIL_RECVONLY=0
export SENDMAIL_SENDONLY=1

cp sendmail.cf.gen /etc/mail/sendmail.cf
cp submit.cf.gen /etc/mail/submit.cf

vi /etc/mail/sendmail.cf
O DaemonPortOptions=Name=MTA, Addr=127.0.0.1
O DaemonPortOptions=Addr=127.0.0.1, Port=587, Name=MSA, M=E

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

Confirm Sendmail is listening on localhost only

netstat -an | grep 25

tcp        0      0  127.0.0.1.25           *.*                     LISTEN

Installing letsencrypt free SSL HTTPS certificate on Centos 6 Apache

Letsenscrypt is a free an open automated certificate authority. You can get a SSL certificate from them for free that is trusted by browsers on nearly all platforms – see the FAQ

This is how to do it for Centos 6 running Apache HTTPD server and assumes you already have HTTPS setup but are currently using a self signed certificate.

Note the way you request and get verified for the certificate is by installing a Python client which will  start up it’s own web server on port 80. The install of the client may involve installing dependency Centos packages  like gcc and other development tools.

So first install the client

As root or using sudo

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto --help

Stop Apache

service httpd stop

Run the client ( note as Centos 6 uses Python 2.6 you have to enable debug mode and you get lots of warnings about version 2.6 ) giving your email address and the domains you want i.e for my site I did

./letsencrypt-auto certonly --standalone --email me@tuqix.org -d tuqix.org  -d www.tuqix.org

It will fire up a screen to ask you to accept their terms and conditions

Selection_024

It will then come back with a message that your certificate has been saved as /etc/letsencrypt/live/yourdomain/fullchain.pem

Start your Apache HTTP server

service httpd start

Edit /etc/httpd/conf.d/ssl.conf

Update
SSLCertificateFile /etc/letsencrypt/live/yourdomain/cert.pem

SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain/privkey.pem

SSLCertificateChainFile /etc/letsencrypt/live/yourdomain/chain.pem

Restart Apache HTTPD server

service httpd restart

Now when you https://yourdomain    your browser should not complain about the SSL certicate

Renewing your certificate

Letsencrypt certificates are valid for 90 days.

The good news is you can automagically renew your certificate. By default it will only update your certificate if it will expire in less than 30 days so you can run a cron job once a month for example without any harm.

To renew a certificate :-

Stop Apache

service httpd stop

/fullpath/letsencrypt-auto renew –standalone –debug

If the renew was successful you will see :-

Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/yourdomain/fullchain.pem (success)

Then start Apache

service httpd start

To run from cron create a script /usr/local/bin/letsencrypt.renew like

#!/bin/bash

/sbin/service httpd stop

/fullpath/letsencrypt-auto renew –standalone –debug  > /var/log/letsencrypt/renew.log 2>&1

 

/sbin/service httpd start

 

Add it to root’s cron to run for example 03:00 on the 9th of each month

00 03 09 * * /usr/local/bin/letsencrypt.renew

Odiris A-8 Coconut Grater Review

Odiris A-8 Coconut Grater Review

Getting the edible coconut out of a coconut can be a challenge. I have found a useful tool – the Odiris A-8 Coconut Grater.

odiris-box

It comes with just the blade needed to be screwed onto the body

Odiris Coconut Grater
Odiris Coconut Grater
Odiris assembled
Odiris Coconut Grater Assembled

 

Once assembled you clamp it to a worktop  ( use some paper to protect the worktop surface ) with a bowl underneath the cutter to catch the coconut gratings and then hold a half of a coconut with one hand while turning the handle with the other.

Odiris ready for action
Odiris ready for action

You need to rotate round the coconut as you go so the blades can get access to all the content.

Odiris done

 

I found it easy to use and easy to clean afterwards – much better than try to use a knife to get at the coconut.

The UK distributor is Nishan Enterprise Lanka Limited . You can find the Odiris for sale on Ebay as well as in various ethnic grocery shops.

 

 

E437: terminal capability “cm” required in Redhat or Centos 6

If you try to use vi or another curses based application in Redhat or Centos 6 and you get the error :-

E437: terminal capability “cm” required
Press ENTER or type command to continue
And your TERM type is something other than a vt100 like a dtterm then you need to install additional terminfo

The fix

yum install ncurses-term

Now ls /usr/share/terminfo/d   shows lots of entries rather than dumb

 

Updating Centos 5 to php 5.3

Updating centos 5 to php 5.3

The version of php shipped with Centos 5 is 5.1.6 , lots of programs now need php 5.2 or 5.3 to install. The latest version of WordPress for example will not install or update on servers running 5.1.6.

When Centos 5.6 came out it had the opportunity to install PHP 5.3 from Centos – the problem is not all the PHP rpms available at 5.1.6 are there in the Centos repository at 5.3 e.g. php-pear php-mcrypt

One way around this is use a different repository , a good one for PHP is IUS . IUS has some nice features such as an add on to yum to make replacing the Centos PHP very easy – also it names it’s RPMs differently to Centos so you don’t have to worry about it overwriting Centos RPMs when you do a yum update. You may need to upgrade tour PHP applications to work with PHP 5.3 so check them out before you upgrade.

The following upgrade procedure is taken mostly from here

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-8.ius.el5.noarch.rpm

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm

rpm -Uvh ius-release*.rpm epel-release*.rpm

Check you can now see the  PHP 5.3 rpms from IUS

yum list | grep -w \.ius\.

Install the IUS add-on to yum :-

yum install yum-plugin-replace

Stop Apache

service httpd stop

List what php rpms you have installed

-bash-3.2# rpm -qa | grep php
php-pdo-5.1.6-27.el5_5.3
php-pgsql-5.1.6-27.el5_5.3
php-odbc-5.1.6-27.el5_5.3
php-bcmath-5.1.6-27.el5_5.3
php-pear-1.4.9-6.el5
php-5.1.6-27.el5_5.3
php-devel-5.1.6-27.el5_5.3
php-gd-5.1.6-27.el5_5.3
php-cli-5.1.6-27.el5_5.3
php-mbstring-5.1.6-27.el5_5.3
php-common-5.1.6-27.el5_5.3
php-ldap-5.1.6-27.el5_5.3
php-mysql-5.1.6-27.el5_5.3
-bash-3.2
Now replace those rpms with the ones from IUS using the IUS yum add-on

-bash-3.2# yum replace php –replace-with php53
Loaded plugins: fastestmirror, priorities, replace
Loading mirror speeds from cached hostfile
* addons: mirror.netrino.co.uk
* base: mirror.netrino.co.uk
* epel: mirror01.th.ifl.net
* extras: mirror.netrino.co.uk
* ius: mirror.rackspace.co.uk
* rpmforge: fr2.rpmfind.net
* updates: mirror.netrino.co.uk
1872 packages excluded due to repository priority protections
Replacing packages takes time, please be patient…

WARNING: Unable to resolve all providers: [‘config(php)’, ‘php’, ‘config(php-ldap)’, ‘php-ldap’, ‘config(php-mbstring)’, ‘php-mbstring’, ‘config(php-mysql)’, ‘php-mysql’, ‘config(php-pgsql)’, ‘php-pgsql’, ‘config(php-common)’, ‘dbase.so()(64bit)’, ‘php-dbase’, ‘php-mime_magic’, ‘php-pspell’, ‘php-common’, ‘config(php-pdo)’, ‘php-pdo’, ‘config(php-odbc)’, ‘php-odbc’, ‘config(php-gd)’, ‘php-gd’, ‘config(php-bcmath)’, ‘php-bcmath’]

This may be normal depending on the package.  Continue? [y/N]
Resolving Dependencies
Resolving Dependencies
–> Running transaction check
—> Package php.x86_64 0:5.1.6-27.el5_5.3 set to be erased
–> Processing Dependency: php >= 4.0.4 for package: squirrelmail
—> Package php-bcmath.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-cli.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-common.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-devel.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-gd.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-ldap.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-mbstring.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-mysql.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-odbc.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-pdo.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php-pgsql.x86_64 0:5.1.6-27.el5_5.3 set to be erased
—> Package php53.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-bcmath.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-cli.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-common.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-devel.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-gd.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-ldap.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-gd.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-ldap.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-mbstring.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-mysql.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-odbc.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-pdo.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-pgsql.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-process.x86_64 0:5.3.3-1.el5_6.1 set to be updated
—> Package php53-xml.x86_64 0:5.3.3-1.el5_6.1 set to be updated
–> Running transaction check
—> Package squirrelmail.noarch 0:1.4.8-5.el5.centos.10 set to be erased
–> Finished Dependency Resolution
–> Running transaction check
—> Package squirrelmail.noarch 0:1.4.8-5.el5.centos.10 set to be erased
–> Processing Dependency: php >= 4.0.4 for package: squirrelmail
–> Processing Dependency: php-mbstring for package: squirrelmail
–> Running transaction check
—> Package squirrelmail.noarch 0:1.4.8-5.el5.centos.10 set to be erased
–> Finished Dependency Resolution

Dependencies Resolved
=================================================================================
Package             Arch        Version                    Repository      Size
=================================================================================
Installing:
php53               x86_64      5.3.3-1.el5_6.1            updates        1.3 M
php53-bcmath        x86_64      5.3.3-1.el5_6.1            updates         42 k
php53-cli           x86_64      5.3.3-1.el5_6.1            updates        2.4 M
php53-common        x86_64      5.3.3-1.el5_6.1            updates        605 k
php53-devel         x86_64      5.3.3-1.el5_6.1            updates        590 k
php53-gd            x86_64      5.3.3-1.el5_6.1            updates        109 k
php53-ldap          x86_64      5.3.3-1.el5_6.1            updates         37 k
php53-mbstring      x86_64      5.3.3-1.el5_6.1            updates        1.2 M
php53-mysql         x86_64      5.3.3-1.el5_6.1            updates         92 k
php53-odbc          x86_64      5.3.3-1.el5_6.1            updates         52 k
php53-pdo           x86_64      5.3.3-1.el5_6.1            updates         67 k
php53-pgsql         x86_64      5.3.3-1.el5_6.1            updates         74 k
php53-process       x86_64      5.3.3-1.el5_6.1            updates         38 k
php53-xml           x86_64      5.3.3-1.el5_6.1            updates        119 k
Removing:
php                 x86_64      5.1.6-27.el5_5.3           installed      6.2 M
php-bcmath          x86_64      5.1.6-27.el5_5.3           installed       33 k
php-cli             x86_64      5.1.6-27.el5_5.3           installed      5.3 M
php-common          x86_64      5.1.6-27.el5_5.3           installed      397 k
php-devel           x86_64      5.1.6-27.el5_5.3           installed      2.5 M
php-gd              x86_64      5.1.6-27.el5_5.3           installed      333 k
php-ldap            x86_64      5.1.6-27.el5_5.3           installed       49 k
php-mbstring        x86_64      5.1.6-27.el5_5.3           installed      1.8 M
php-mysql           x86_64      5.1.6-27.el5_5.3           installed      196 k
php-odbc            x86_64      5.1.6-27.el5_5.3           installed       88 k
php-pdo             x86_64      5.1.6-27.el5_5.3           installed      114 k
php-pgsql           x86_64      5.1.6-27.el5_5.3           installed      128 k
Removing for dependencies:
squirrelmail        noarch      1.4.8-5.el5.centos.10      installed       14 M

Transaction Summary
=================================================================================
Install      14 Package(s)
Upgrade       0 Package(s)
Remove       13 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Total download size: 6.7 M
Is this ok [y/N]:
Downloading Packages:
(1/14): php53-ldap-5.3.3-1.el5_6.1.x86_64.rpm             |  37 kB     00:00
(2/14): php53-process-5.3.3-1.el5_6.1.x86_64.rpm          |  38 kB     00:00
(3/14): php53-bcmath-5.3.3-1.el5_6.1.x86_64.rpm           |  42 kB     00:00
(4/14): php53-odbc-5.3.3-1.el5_6.1.x86_64.rpm             |  52 kB     00:00
(5/14): php53-pdo-5.3.3-1.el5_6.1.x86_64.rpm              |  67 kB     00:00
(6/14): php53-pgsql-5.3.3-1.el5_6.1.x86_64.rpm            |  74 kB     00:00
(7/14): php53-mysql-5.3.3-1.el5_6.1.x86_64.rpm            |  92 kB     00:00
(8/14): php53-gd-5.3.3-1.el5_6.1.x86_64.rpm               | 109 kB     00:00
(9/14): php53-xml-5.3.3-1.el5_6.1.x86_64.rpm              | 119 kB     00:00
(10/14): php53-devel-5.3.3-1.el5_6.1.x86_64.rpm           | 590 kB     00:00
(11/14): php53-common-5.3.3-1.el5_6.1.x86_64.rpm          | 605 kB     00:00
(12/14): php53-mbstring-5.3.3-1.el5_6.1.x86_64.rpm        | 1.2 MB     00:00
(13/14): php53-5.3.3-1.el5_6.1.x86_64.rpm                 | 1.3 MB     00:00
(14/14): php53-cli-5.3.3-1.el5_6.1.x86_64.rpm             | 2.4 MB     00:00
——————————————————————————–

Total                                            3.2 MB/s | 6.7 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : php53-common                                             1/27
warning: /etc/php.d/json.ini created as /etc/php.d/json.ini.rpmnew
Installing     : php53-pdo                                                2/27
Installing     : php53-cli                                                3/27
Installing     : php53                                                    4/27
Installing     : php53-mbstring                                           5/27

Installing     : php53-bcmath                                             6/27
Installing     : php53-pgsql                                              7/27
Installing     : php53-mysql                                              8/27
Installing     : php53-ldap                                               9/27
Installing     : php53-xml                                               10/27
Installing     : php53-process                                           11/27
Installing     : php53-gd                                                12/27
Installing     : php53-devel                                             13/27
Installing     : php53-odbc                                              14/27
Erasing        : php-ldap                                                15/27
Erasing        : php-pdo                                                 17/27
Erasing        : php-mysql                                               18/27
Erasing        : php-devel                                               19/27
Erasing        : php-odbc                                                20/27
Erasing        : php-gd                                                  21/27
Erasing        : php                                                     22/27
Erasing        : php-common                                              23/27
Erasing        : php-bcmath                                              24/27
Erasing        : php-cli                                                 25/27

Erasing        : squirrelmail                                            26/27
Erasing        : php-pgsql                                               27/27

Removed:
php.x86_64 0:5.1.6-27.el5_5.3         php-bcmath.x86_64 0:5.1.6-27.el5_5.3
php-cli.x86_64 0:5.1.6-27.el5_5.3     php-common.x86_64 0:5.1.6-27.el5_5.3
php-devel.x86_64 0:5.1.6-27.el5_5.3   php-gd.x86_64 0:5.1.6-27.el5_5.3
php-ldap.x86_64 0:5.1.6-27.el5_5.3    php-mbstring.x86_64 0:5.1.6-27.el5_5.3
php-mysql.x86_64 0:5.1.6-27.el5_5.3   php-odbc.x86_64 0:5.1.6-27.el5_5.3
php-pdo.x86_64 0:5.1.6-27.el5_5.3     php-pgsql.x86_64 0:5.1.6-27.el5_5.3

Dependency Removed:
squirrelmail.noarch 0:1.4.8-5.el5.centos.10

Installed:
php53.x86_64 0:5.3.3-1.el5_6.1         php53-bcmath.x86_64 0:5.3.3-1.el5_6.1
php53-cli.x86_64 0:5.3.3-1.el5_6.1     php53-common.x86_64 0:5.3.3-1.el5_6.1
php53-devel.x86_64 0:5.3.3-1.el5_6.1   php53-gd.x86_64 0:5.3.3-1.el5_6.1
php53-ldap.x86_64 0:5.3.3-1.el5_6.1    php53-mbstring.x86_64 0:5.3.3-1.el5_6.1
php53-mysql.x86_64 0:5.3.3-1.el5_6.1   php53-odbc.x86_64 0:5.3.3-1.el5_6.1
php53-pdo.x86_64 0:5.3.3-1.el5_6.1     php53-pgsql.x86_64 0:5.3.3-1.el5_6.1
php53-process.x86_64 0:5.3.3-1.el5_6.1 php53-xml.x86_64 0:5.3.3-1.el5_6.1

Complete!

Check all the php rpms you had installed at 5.1.6 are now there at 5.3

-bash-3.2# rpm -qa | grep php
php53-cli-5.3.3-1.el5_6.1
php53-process-5.3.3-1.el5_6.1
php53-mysql-5.3.3-1.el5_6.1
php-pear-1.4.9-6.el5
php53-mbstring-5.3.3-1.el5_6.1
php53-devel-5.3.3-1.el5_6.1
php53-pdo-5.3.3-1.el5_6.1
php53-bcmath-5.3.3-1.el5_6.1
php53-xml-5.3.3-1.el5_6.1
php53-odbc-5.3.3-1.el5_6.1
php53-pgsql-5.3.3-1.el5_6.1
php53-5.3.3-1.el5_6.1
php53-gd-5.3.3-1.el5_6.1
php53-common-5.3.3-1.el5_6.1
php53-ldap-5.3.3-1.el5_6.1
-bash-3.2#
-bash-3.2# php -v
PHP 5.3.3 (cli) (built: Mar 30 2011 13:51:54)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
-bash-3.2#

Set your timezone for PHP ( if you do not do this you may see errors like PHP Warning:  strtotime(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. )

vi /etc/php.ini

date.timezone = ‘Europe/London’

Restart Apache

service httpd start

Check your applications now work

 

Living the Linux dream – installing XMBC on an Acer Revo 3700

Installing XBMC on the Acer Revo 3700

After years of waiting for the price of quiet small form factor PCs to come down to a reasonable price point the Acer Revo 3700 has appeared. I purchased one to install XBMC on. I also purchased an add on external USB DVD drive as I also wanted to replace my DVD player.

Because I wanted to use the Revo to do other things besides XBMC I decided to do a normal Ubuntu install rather than a minimum install with XBMC. I selected Ubuntu 10.04 LTS 32 bit to install.

I decided to make things easy and do the install with a wired Ethernet connection and enable wireless afterwards.

As I had an USB DVD drive I thought I would use this to do the install – big mistake it failed after the splash screen with :-

(initramfs) mount mounting /dev/loop0 on filesystem.squashfs failed: Input/Output error Cannot mount /dev/loop0 (/cdrom/casper/filesystem.squashfs on // filesystem.squashfs

Looking at the forums it appeared that boot from a USB memory stick would be a better solution. To make a bootable USB stick go here

Power on the Revo and hit DEL to enter the BIOS. Select Advance BIOS Features  – cursor down to 1st Boot Device and use the – key to select Removable Device.

F10 to save your settings and the Revo will reboot.

In spite of selecting Removable Device as the 1st boot it still booted from the hard disk – so I booted again and hit F12 to go into the boot menu then I could select the USB Flash to boot from.

Select erase and use the entire disk

Login name xbmc

Set a password and select Log in automatically

Once the installation is complete it will prompt you to reboot  – click Restart Now. Hit DEL to go into the BIOS again and select the hard disk as the 1st Boot Device . Remove the USB memory stick you booted from. Hit F10 to save and exit. It should now boot from the hard disk into Ubuntu.

Open up a terminal and do netstat -rn to check the network looks right.

Stop the screen saver from locking the screen with a password – System – Preference – Screensaver – untick lock screen when screensaver is active.

Install the Nvidia binary drivers -see here

Turn off compiz  – Preferences – Appearance – Visual Effects – None

Update manager should appear on the bottom toolbar advising that updates are available. Install the updates and once installed reboot the Revo.

Wireless network

I had a lot of problems getting the wireless network to work. First set it up in Network Manager , go to  System – Preferences – Network Connections

Select Wireless – Add  and add your wireless details.  Choose Infrastructure rather than addhoc and select the tick box to allow all users access. Reboot the Revo and if like me the wireless does not work check in /var/log/messages for failure to open a file :-

May 24 09:34:03 xbmc-desktop kernel: [   15.933794] Read file “/etc/Wireless/RT2860STA/RT2860STA.dat” failed(errCode=0)!

To fix :-

sudo mkdir -p  /etc/Wireless/RT2860STA

sudo touch /etc/Wireless/RT2860STA/RT2860STA/RT2860STA.dat

Reboot the Revo – you will be prompted for your password to start the network and now you should get a message about the wireless network has established a connection.

Now go to System – Preference – Network Connections

You will see a new connection with Last Used of now

Edit this and ensure the mode is Infrastructure , Connect automatically is ticked and available to all users is ticked. Apply the changes – it will disconnect the wireless connection. Reboot the Revo and this time you should not be prompted for a password and the wireless network should connect successfully.

I would advise you to setup a static IP address for the Revo as this will make things easy for using NFS mounts and using an Android phone app as a remote.

To setup a static IP address go to the Network Manager, select the Wireless connection 1 and add a static IP ( your router should have details of the DHCP range of IPs it gives out so select an IP address outside of this range ). Fill in the gateway ( e.g. the address of your router , the DNS servers ( either use your ISP’s one or use a public DNS service like Google’s one ). Reboot the Revo and check with netstat -rn and ifconfig -a that all is well.

Install flash and other media codecs

As this server is going to be able to play multiple video and sounds formats install the restricted extras for Ubuntu – see here

Sound over HDMI in the Revo 3700

I had lots of problems with this and there are lots of remedies posted on forums, the fix does seem to depend on what version of Ubuntu you install. To have sound over HDMI working you need X up and be connected to a HDMI display so plug your TV into the HMDI port.

Update the Alsa packages – instructions are  here – you need to reboot after updating.

After installing a newer version of ALSA you now see the Nvidia devices :-

xbmc@xbmc-desktop:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0

Startup alsamixer and use F6 key to select the Nvidia card – it should look like :-

alsamixer with muted channels

You now need to unmute the channels shown as MM – use the cursor keys to navigate to the MM boxes and use the m keys to toggle them to 00 . The display should now look like :-

alsamixer with channels unmuted
alsamixer with channels unmuted

Hit ESC to exit alsamixer

To test :-

xbmc@xbmc-desktop:~$ aplay -D plughw:1,7 /usr/share/sounds/alsa/Front_Center.wav

Sound should come out of the TV.

Now you need to setup Pulse audio

sudo vi /etc/pulse/default.pa

Search for the hashed out line #load-module module-pipe-sink

Add a line :-

load-module module-alsa-sink device=plughw:1,7

Remove any local user pulse config files :-

rm -rf ~/.pulse ~/.asound* ~/.pulse-cookie

Create a new /etc/asound.conf

sudo vi /etc/asound.conf
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}

Reboot the Revo and now you should be greeted by Tom-Toms when Ubuntu starts and playing a video from a website in Firefox the sound will now come out of the TV. Don’t worry about the slow performance playing a Video in Firefox – the fixes are later in this guide.

Install XBMC

instructions are here

Ensure you install NVidia hardware acceleration (VDPAU)  in the above instructions.

Open a terminal and type xbmc to start it up. Go to System – Settings and configure :-

Audio Output

Audio output              HDMI
Speaker configuration      2.0
Boost volume level on downmix
Audio output device         Defaults
Passthrough output device      hdmi

Video Playback

Render method           Auto detect
Allow hardware acceleration (VDPAU)
Adjust display refresh rate to match video
Sync playback to display
A/V sync method                 video clock (drop/dupe audio)
VDPAU studio level color conversion

Power saving

Shutdown function       shutdown

Weather – General  change area code 1 – set it to your local city

Speedup video playback

Ensure you installed NVidia hardware acceleration (VDPAU) when you did the XBMC install above. To allow flash videos ( like Youtube ) to run in full screen you need a version of flash that supports hardware acceleration – this currently means getting a beta version. The easiest way is to install Flash Aid Firefox plugin , once installed click on the Flash Aid symbol in the top right hand corner of Firefox and just let the wizard install the best version of flash for the hardware.  I did notice that Youtube videos played faster in the XBMC plugin than in Firefox which is fine as the XBMC plugin is nice to use.

If you are in the UK then install the BBC Iplayer XBMC plugin – follow the instructions here . The XBMC BBC  Iplayer plugin plays  programs much better full screen than in Firefox.

Remote Control

As I have an Android phone I looked for a remote app for XBMC and downloaded the official XBMC app

On the Revo start up XBMC and go to System – Network . enable Allow control of XBMC via HTTP , Allow programs on other systems to control XBMC, set a user name and password. Then go to System – Settings – Input Devices and enable Remote control sends keyboard presses.

Assuming you already have your Android phone setup so it is connected to your WIFI :-

Download the XBMC Android app, Once downloaded press menu and fill in the IP address of the Revo , username and password you setup in XBMC above ( not the Linux username / password ) , tick WIFI only. press the back button and OK the settings. Now you should be able to control XBMC from your phone.

setup XBMC to autostart

To setup XBMC to autostart but still have the Gnome desktop available if you click exit rather than shutdown in XBMC  :-

System – Preferences – Startup Applications. Click add and fill in name: xbmc , Command: xbmc  , Comment xbmc

Now when the Revo boots it will run xbmc but you still have the option to exit to the desktop by selecting exit in XBMC or to shutdown the Revo by selecting shutdown in XBMC

Sound no longer works after updates that include a new kernel

If you install updates ( security fixes etc. ) and it includes a new kernel the HDMI sound won’t work and XBMC will say cannot open audio device.

Update the alsa packages as above, make a copy of your /etc/asound.conf , create a new /etc/asound.conf  :-

pcm.!default {
type plug
slave.pcm “dmix:0,3”
}

If you don’t do this then you will get an error when starting alsamixer after the reboot ALSA lib pulse.c:229:(pulse_connect) PulseAudio: Unable to connect: Connection refused cannot open mixer: Connection refused

rm -rf ~/.pulse ~/.asound* ~/.pulse-cookie

Now reboot and check aplay -l sees the Nvidia sound card as in the install instructions above.

Startup alsamixer and unmute the channels as in the install instructions

Copy back your original /etc/asound.conf , reboot and your sound should be back.

Solaris FTP chroot on Netapp mounted filesystem

When setting up Solaris chroot FTP where the user’s home directory is on a NFS mounted Netapp filesystem you may encounter an error when doing ftpconfig :-

myhost# ftpconfig  -d  /input/jblogs

Updating directory /input/jblogs
ftpconfig: Error: Creation of devices in /input/jblogs/dev failed

To be able to run mknod to create devices ( which the ftpconfig does ) requires the Netapp volume to be exported with setuid  enabled.

Even though the mount command on Solaris seemed to show that setuid was set on the mount – the volume on the Netapp server had not been exported with setuid.

You don’t have to mount and remount the filesytem.

For security you should turn off setuid once you have finished doing your ftpconfig

Colour management in Linux; using a Pantone Huey to calibrate a monitor

Colour management in Linux; Using a Pantone Huey to calibrate a monitor

The following was done on Ubuntu 12.04 but should be similar on other recent Linux distributions.

To do proper colour calibration of your monitor you need a colorimeter and some software. The software to use is Argll CMS , this is a command line tool but there are GUI addons provided by other authors. You need a colorimeter compatible with Argll – check here for details of what hardware is supported by Argll. I chose the Pantone Huey as it was readily available and was the cheapest ( note don’t buy the Pro version – it is the same hardware – you just get better Windows software which we won’t be using anyway ).

Install Argyll

Use you favourite tool to install Argyll from the Ubuntu repositories.  If you are using Gnome then also install the Gnome CMS colour management system. To make the Huey accessible by a non-root user you need to add some rules to Udev – fortunately Argyll comes with a set of rules that can be copied into place.

sudo cp /lib/udev/rules.d/55-Argyll.rules /etc/udev/rules.d/55-Argyll.rules

Check that the Huey is accessible – plug it into a USB port and run spotread -? and look for the device listed :-

dmc@master:~$ spotread -?
Read Print Spot values, Version 1.1.0
Author: Graeme W. Gill, licensed under the GPL Version 3
usage: spotread [-options] [logfile]
-v                   Verbose mode
-s                   Print spectrum for each reading
-S                   Plot spectrum for each reading
-c listno            Set communication port from the following list (default 1)
1 = ‘usb:/bus0/dev2 (GretagMacbeth Huey)’
2 = ‘/dev/ttyS0’
3 = ‘/dev/ttyS1’
4 = ‘/dev/ttyS2’
5 = ‘/dev/ttyS3’

Installing DispcalGUI

Download the package for your distribution from the DispcalGUI site and install it – Ubuntu will fireup the install tool when you click on the Ubuntu package.

Create your profile using DispcalGUI

Make sure your Huey is plugged into a USB port. Startup Dispcal from your applications  menu. It should automagically detect your display. click the symbol between the display device and instrument – it should then show the Huey and the Calibrate and Profile buttons at the bottom of the screen will activate.

dispcalgui_021

Click on Measure for the Whitepoint and put the Huey face up next to the display. This will also measure the ambient light. You should really read the DispcalGUI manual which explains all of the settings that you should change from the defaults.

Click on Calibrate & Profile

A grey patch will apear on the screen and a terminal window will also open with instructions. Place the huey on the screen over the patch and select check all from the menu in the terminal window. Follow the instructions given. After calibration you are asked to install the profile created and make it the default one. If you have installed Gnome CMS it will handle the installation and activation of the profile.

Stop Spam in WordPress Comments – Install CAPTCHA

This WordPress blog has been targeted by Spam bots since it started but recently it has got a lot worse and it is getting tedious to go through all the pending comments and delete the Spam ones.

I’ve seen CAPTCHA used on other sites as a means to distinguish between humans and Spam bots so a quick Google for WordPress CAPTCHA plugins found a few. I wanted one that is updated regularly so it will still work when a new WordPress update is available. The plugin I chose was SI CAPTCHA . This seems to be regularly updated , looks very good, has audio and it works fine – I have had no Spam bot comments since installing. The plugin is free but if you find it useful and want to fund further development then there is a Paypal link – if you think how much time this plugin will save you a donation is highly recommended.

The link on the WordPress plugins site has all the information needed to install. ( Note for Centos check you have php-gd installed – see below ).  Basically you unzip it into wp-contents/plugins directory then go to your Admin page , select plugins ,  then activate the SI Captcha plugin.

There is a nice Captcha support test link to check all is well – my setup failed first time – I got :-

ERROR: GD image support not detected in PHP

ERROR: imagepng function not detected in PHP

This was resolved by installing php-gd RPM. For Centos you would do

yum install php-gd

service httpd restart

Now if anyone wants to add a comment they have to pass the CAPTCHA test which Spam bots are no good at.

Note by default it won’t add the CAPTCHA box to users who are logged in so ensure you have logged out if you want to test it for yourself.

You should see the CAPTCHA at the bottom of this entry.

pptp problem on Ubuntu after upgrading

I have a customer who uses pptp as a VPN for support logins.

After upgrading my Ubuntu server to 9.10 I found my PPTP tunnel would not start. Looking in /var/log/messages I got :-
Jun  4 18:10:20 master2 pppd[5009]: pppd 2.4.5 started by root, uid 0
Jun  4 18:10:20 master2 pppd[5009]: Using interface ppp0
Jun  4 18:10:20 master2 pppd[5009]: Connect: ppp0 <–> /dev/pts/2
Jun  4 18:10:22 master2 pppd[5009]: CHAP authentication succeeded
Jun  4 18:10:22 master2 pppd[5009]: LCP terminated by peer (MPPE required but peer refused)
Jun  4 18:10:25 master2 pppd[5009]: Connection terminated.
Jun  4 18:10:26 master2 pppd[5009]: Modem hangup
Jun  4 18:10:26 master2 pppd[5009]: Exit.

Now I know MPPE has been included in theUbuntu kernel for ages so I checked man pppd and it suggested I need to put something about mppe in /etc/ppp/options.pptp

I unhashed   require-mppe-128    in  /etc/ppp/options.pptp and it now works fine :-

Jun  4 18:23:09 master2 pppd[5703]: pppd 2.4.5 started by root, uid 0
Jun  4 18:23:09 master2 pppd[5703]: Using interface ppp0
Jun  4 18:23:09 master2 pppd[5703]: Connect: ppp0 <–> /dev/pts/2
Jun  4 18:23:11 master2 pppd[5703]: CHAP authentication succeeded
Jun  4 18:23:12 master2 kernel: [  897.391871] padlock: VIA PadLock Hash Engine not detected.
Jun  4 18:23:12 master2 kernel: [  897.393782] PPP MPPE Compression module registered
Jun  4 18:23:12 master2 pppd[5703]: MPPE 128-bit stateless compression enabled
Jun  4 18:23:12 master2 pppd[5703]: local  IP address 192.168.XXX.XXX
Jun  4 18:23:12 master2 pppd[5703]: remote IP address 192.168.XXX.XXX