ReadLine in Perl on Ubuntu

Tags:

Update July 2012: A more robust solution, from within the cpan program, is: install Bundle::CPAN


A common Perl module, ReadLine is especially handy when running the cpan program to install other modules, as it lets you up-arrow through previous commands, edit your command with the arrows and so on.

At least on Ubuntu 10.10 ... CPAN will not install it. You get this error:

cpan> <span style="text-decoration: underline;">install Term::ReadLine</span>
Running install for module 'Term::ReadLine'
CPAN: Data::Dumper loaded ok (v2.124)
'YAML' not installed, falling back to Data::Dumper and Storable to read prefs '/home/luser/.cpan/prefs'
The most recent version "1.05" of the module "Term::ReadLine"
is part of the perl-5.12.2 distribution. To install that, you need to run
 force install Term::ReadLine   --or--
 install J/JE/JESSE/perl-5.12.2.tar.gz
Running make test
 Can't test without successful make
Running make install
 Make had returned bad status, install seems impossible
Failed during this command:
 JESSE/perl-5.12.2.tar.gz                     : make NO isa perl

(typed text is underlined.)

The proper Ubuntu way to get ReadLine installed is to:

$ <span style="text-decoration: underline;">sudo apt-get install libterm-readline-gnu-perl </span>

You probably also want to install Term::ReadLine::Perl (and) Term::ReadKey

Alternately, use the single-command-line cpanm to install one or more Perl modules and all dependencies, like this:

$ <u>cpanm Term::ReadLine Term::ReadLine::Perl Term::ReadKey</u>

You might also check Racker Hacker's article on auotmatically installing CPAN dependencies without requiring confirmation. Note, this will not prevent modules like those in the Test suite from asking:

<em>{this module} </em>is just needed temporarily during building or testing.
Do you want to install it permanently? [yes]

Suspend fails on Dell Inspiron 8600

Tags:

Applies to: Ubuntu Linux 9.10, 10.04

Reason: Laptop suspends but does not awaken properly. Screen is black, with or without cursor, does not respond to keyboard. Issue is that display backlight is not restarted.

Resolution: Per comments and instructions in the Lanuchpad Bugs site, in file /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-dell.fdi

Find and change by adding the bold text:

<!-- Dell Inspiron -->
 <match key="system.hardware.product" prefix="Inspiron">
<strong> <match key="system.hardware.product" contains_outof="1501">
<!--
</strong> <match key="system.hardware.product" contains_outof="1501;8600">
<strong>--></strong>

CPAN won't install Perl GD module on Ubuntu 9.04

Tags:

The 'cpan' command won't "install GD" as it complains that the GD library is not found. Although GD is installed in Ubuntu by default, you need the developer library. What you want instead is:

$ sudo apt-get install libgd-gd2-perl
$ perl
use GD;

(works!)

Zabbix under Ubuntu 9.10

Tags:

ZABBIX [zabbix.com] is an enterprise-class distributed monitoring solution designed to monitor and track performance and availability of network servers, devices, and other resources. It supports distributed and Web-based monitoring, auto-discovery, real-time monitoring, SLA assurance, trending, and more.

Key features

Recommend Not Installing from Ubuntu Repository.

Installed the Zabbix packages from Synaptic, with an eye to following instructions here [zabbix.com]. Problems and solutions:

Installing Zabbix 1.8.1 from Source

Preparing your server

Install the required packages

sudo apt-get install build-essential gnustep-make

sudo apt-get install linux-headers-$(uname -r)

sudo apt install ntp ntpdate

Now you need to edit /etc/ntp.conf file and change your NTP servers after that restart ntp using the following comamnd

sudo /etc/init.d/ntp restart

Be sure you have a timezone defined for PHP, placing a value from the list of recognized zones [php.org] in file apache2/php.ini:

date.timezone =America/Phoenix

Next, create a zabbix user:

sudo adduser

**

zabbix **

and create a password.

Install the following packages

sudo apt-get install apache2 postgresql-8.3 postgresql-server-dev-8.3 php5 php5-gd php5-pgsql snmp libsnmp-dev snmpd libcurl4-openssl-dev fping libiksemel3 libiksemel-dev

Install postgresql web GUI admin application using the following command

sudo apt-get install phppgadmin

Now you need to login as root

sudo su -

sudo -u

**

postgres * psql postgres password postgres password123 q; ubuntu and Postgres Usernames (both = zabbix * ) are the same so they can work in unison

sudo -u

**

postgres * createuser --superuser zabbix * sudo -u

**

postgres * createdb zabbix *

Now you can login to psql without sudo

Now you need to login as zabbix user

su -

**

zabbix ** cd /home/

**

zabbix **

Download zabbix latest version from here [zabbix.com]

tar zxvpf

**

zabbix ** -1.8.1.tar.gz

cd

**

zabbix ** -1.8.1/create/schema

cat postgresql.sql | psql

**

zabbix ** cd ../data

cat data.sql | psql

**

zabbix ** cat images_pgsql.sql | psql

**

zabbix ** cd ..

cd ..

sudo ./

**

configure **

`

` enable-server

`

` enable-agent

`

` with-pgsql

`

` with-net-snmp

`

` with-jabber=/usr/

`

` with-libcurl

sudo make install

Now you need to add the following ports to services file

sudo nano /etc/services

Add at the following ports

zabbix_agent 10050/tcp zabbix_trap 10051/tcp

Save and exit the file

sudo mkdir /etc/

**

zabbix ** sudo chown -R

**

zabbix * . zabbix /etc/ zabbix * /

cp misc/conf/zabbix_* /etc/

**

zabbix ** /

Now we need to edit the agent config file

nano /etc/

**

zabbix ** /zabbix_agentd.conf

Make sure that the Server parameter points to the server ip address, for the agent that runs on the

server it is like this: Server=127.0.0.1 change to xxx.xxx.xxx.xxx

AND REMOVE # from ListenIP=127.0.0.1 AND CHANGE IT to ListenIP=xxx.xxx.xxx.xxx

Save and exit the file

Now we need to edit the server config file

nano /etc/

**

zabbix ** /zabbix_server.conf

For small sites this default file will do, however if you are into tweaking your config for your 10+ hosts site,

this is the place.

Change this:

Database user

DBUser=zabbix

Database password

Comment this line if no password used

DBPassword=password123

AND REMOVE # from ListenIP=127.0.0.1 AND CHANGE IT to ListenIP=X.X.X.X (your server ip)

Save and exit the file

Now copy the zabbix server,agent startup scripts for to /etc/init.d location

sudo cp misc/init.d/debian/

**

zabbix ** -server /etc/init.d

sudo cp misc/init.d/debian/

**

zabbix ** -agent /etc/init.d

Now we need to change of destination path in server and agent configuration files

For zabbix server config file

sudo nano /etc/init.d/

**

zabbix ** -server

Look for the following line:

DAEMON=/home/

**

zabbix ** /bin/${NAME}

and replace it with:

DAEMON=/usr/sbin/${NAME}

For zabbix server config file

sudo nano /etc/init.d/

**

zabbix ** -agent

Look for the following line:

DAEMON=/home/

**

zabbix ** /bin/${NAME}

and replace it with:

DAEMON=/usr/sbin/${NAME}

Save and exit the file

Add the zabbix server and agent config files to startup

sudo chmod 755 /etc/init.d/<strong>zabbix</strong>-server
sudo update-rc.d <strong>zabbix</strong>-server defaults
sudo chmod 755 /etc/init.d/<strong>zabbix</strong>-agent
sudo update-rc.d <strong>zabbix</strong>-agent defaults

Now you can start zabbix server and agent using the following command

sudo /etc/init.d/<strong>zabbix</strong>-server start
sudo /etc/init.d/<strong>zabbix</strong>-agent start

You can check the processes using the following command

ps -aux | grep

**

zabbix ** cd /home/

**

zabbix * / zabbix * -1.8.1/

mkdir /home/

**

zabbix ** /public_html

cp -R frontends/php/* /home/

**

zabbix ** /public_html/

Create a symbolic link to an Apache configuration:

ln -s /home/zabbix/apache.conf /etc/apache2/conf.d/zabbix

That configuration file should read:

Alias /zabbix /home/<strong>zabbix</strong>/public_html
<Directory /home/<strong>zabbix</strong>/public_html>
 AllowOverride FileInfo AuthConfig Limit Indexes
 Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
 php_value max_execution_time 300
 php_value memory_limit 128M
 php_value upload_max_filesize 16M
 php_value post_max_size 16M
<Limit GET POST OPTIONS PROPFIND>
 Order allow,deny
 Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
 Order deny,allow
 Deny from all
</LimitExcept>
 </Directory>

Also in /etc/php5/apache2/php.ini update the mbstring function overload capabilites line as follows:

mbstring.func_overload = 2

(adding this as a php_value in zabbix's apache.conf has no effect).

Change php.ini file memory limit and time settings

sudo nano /etc/php5/apache2/php.ini

Change the following values:

max_execution_time = 300 ; Maximum execution time of each script, in seconds date.timezone = Europe/Copenhagen

Allow postgres user to access webadmin console to do this edit /usr/share/phppgadmin/conf/config.inc.php,/etc/phppgadmin/apache.conf files

sudo nano /usr/share/phppgadmin/conf/config.inc.php

CHANGE:

$conf['extra_login_security'] = true;

TO:

$conf['extra_login_security'] = false;

sudo nano /etc/phppgadmin/apache.conf

CHANGE:

deny from all

TO:

allow from all

Restart apache server using the following command

sudo /etc/init.d/apache2 restart

Point your browser to http://localhost/zabbix ... or http://serverip/zabbix ... and you should see:

Welcome to the Zabbix frontend installation wizard. This installation wizard will guide you through the installation of Zabbix frontend

You will then arrive at a confirmation screen of your configuration values:

Current value

Required

Recommended

PHP version

5.2.10-2ubuntu6.4

5.0

5.3.0

Ok

PHP memory limit

50M

128M

256M

Fail

PHP post max size

8M

16M

32M

Fail

PHP max execution time

30

300

600

Fail

PHP timezone

America/Phoenix

Ok

PHP databases support

MySQL PostgreSQL

Ok

PHP BC math

yes

Ok

PHP MB string

yes

Ok

PHP MB string overload

no

Fail

PHP Sockets

yes

Ok

PHP GD

2.0

2.0

2.0.34

Ok

GD PNG Support

yes

Ok

libxml module

2.7.5

2.6.15

2.7.6

Ok

ctype module

yes

Ok

(final result) Fail

Please correct all issues and press "Retry" button

Ah, well if you see that -- you haven't added the right values to the apache.conf and the global php.ini file -- see above. Once you do, you should be able to proceed...

After a couple more clicks you will get to a screen saying

Configuration file: Fail

at which point you should click Save Configuration file, and put that file (or a copy of its contents) into /home/zabbix/conf/zabbix.conf.php as directed. It should look like:

global $DB;

$DB["TYPE"] = "POSTGRESQL"; $DB["SERVER"] = "localhost"; $DB["PORT"] = "0"; $DB["DATABASE"] = "zabbix"; $DB["USER"] = "zabbix"; $DB["PASSWORD"] = "yourpassword"; $ZBX_SERVER = "localhost"; $ZBX_SERVER_PORT = "10051";

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?>

User Admin password zabbix

In ZABBIX: Configuration / Hosts / Zabbix server should be yourserver ip instead of for 127.0.0.1

Plaintext logins with Dovecot and Ubuntu

Tags:

Disallow plaintext authentication in non-SSL mode?

Webmin permits you to enable non-SSL connections on its Dovecot SSL Configuration page, but on Ubuntu at least, that edits /etc/dovecot/dovecot.conf by changing 'yes' here to 'no':

disable_plaintext_auth = no

but the same thing also has to be done in /etc/dovecot/dovecot-postfix.conf ... manually for now.