Inrichting Uranus




Hoe

Dit document is geschreven van 08-2010 tot 11-2010 om mijn server opnieuw te installeren met CentOS 5.5 64 bits en alles wat ik wil.

Voor CentOS 6.0 heb ik al wat testjes gedaan met de Beta van RedHat maar dit levert meer nadelen dan voordelen.
Sinds de geboorte van Emma heb ik hier weinig aan gedaan, dus zetten we het document maar online. Kan ik er zo eventueel weer mee verder werken.
RHEL6 staat gepland voor eind 2010, dus misschien gaan we dan nog wel om.

Voor de goede orde, uranus is een atom 510 van Gigabyte - Gigabyte GA-D510UD met 2 * 2Gb geheugen.

GA-D510UD

Deze heb ik gekozen boven die van Intel, vanwege de twee extra sata poorten (totaal 4 stuks). Helaas heeft het ding wat moeite met het booten van usb-dvd's dus heb ik wat harder moeten spelen met pxe.

Sudo

# visudo
...
gej ALL = (ALL) NOPASSWD: ALL

ssh

Remote login met root via ssh is erg handig, maar eigenlijk willen we dat niet. Ook mag een ssh machine die aan het internet hangt, alleen met een key ingelogd worden.

Op je werkstation/netbook/notebook:

[user1@localhost ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory '/home/user1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
2b:bd:53:6f:23:84:88:45:7d:02:12:b7:e8:10:fc:ab user1@localhost
[user1@localhost ~]$

Op de server:
[user1@uranus ~]# vi /home/user1/.ssh/authorized_keys
[inhoud van je eigen rsa_key.pub op je werkstation]
...

Nu kun je pas je sshd dichtzetten:
[root@uranus ~]# vi /etc/ssh/sshd_config
...
#PermitRootLogin yes
PermitRootLogin no

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication no

[root@uranus ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@uranus ~]#


Voorbeeld zonder key:

[user1@localhost ~]$ ssh uranus
user1@uranus's password:
Last login: Mon Oct 25 19:39:27 2010 from saturn

Voorbeeld met key:
[user1@localhost ~]$ ssh venus
Enter passphrase for key '/home/user1/.ssh/id_rsa':
Last login: Tue Oct 26 18:11:23 2010 from saturn
Have a lot of fun...
user1@venus:~>

Todo: CentOS en iptables dichtzetten van de ssh test-logins:
Op SuSE:
vi /etc/sysconfig/SuSEfirewall2
FW_SERVICES_ACCEPT_EXT="0.0.0.0/0,tcp,22,,hitcount=3,blockseconds=60,recentname=ssh"


Disk & Mirror


Dit stukje moet nog goed uitgewerkt worden.
Probleem is dat de WD 1.5Tb disk WD15EARS met 64Mb cache (die een mooie prijs/snelheid verhouding heeft en toch 3 jaar garantie heeft) een sector size heeft van 4kb. Hierdoor moet de disk wat anders ingericht worden dan normaal. (sector size van 63)
4k view


Disk
De disk is 1.5TB

WD15EARS

Een WD 1.5ears (64mb cache)

Met een ubuntu stick of het RHEL resque systeem even booten en de disk als volgt inrichten:

fdisk /dev/sda
x    xpert mode
s    sector size
32 (veelvoud van 4)
r    return to main menu
n    new partition
p    primary partition
1    partition 1
1    first cylinder
+75M    75Mb
t    change type
fd    Linux Raid Autodetect

n
p
2
20    default
Full size
t
fd    linux raid autodetect
p    print
        Controleren.......
w


Hetzelfde voor disk sdb

daarna maken we de mirror over de ingerichte layout heen:

mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=mirror --raid-devices=2 /dev/sda2 /dev/sdb2

Controleren met:

mdadm --detail /dev/md0
cat /proc/mdstat

Wacht tot de raid klaar is.


Daarna:

lvm pvcreate /dev/md1
lvm pvscan
lvm lvcreate -L 2G -n lvroot rootvg
lvm lvcreate -L 1G -n lvtmp rootvg
lvm lvcreate -L 3G -n lvopt rootvg
lvm lvcreate -L 3G -n lvsrv rootvg
lvm lvcreate -L 3G -n lvusr rootvg
lvm lvcreate -L 3G -n lvvar rootvg
lvm lvcreate -L 3G -n lvopt rootvg

mkfs.ext4 /dev/rootvg/lvroot

lvm vgchange -a y

Installeren doen we dus met advanced settings en gebruik maken van de vooraf ingerichte filesytemen.

Na het installeren alweer de eerste aanpassing aan de sizing:

xymon uranus

Handig dat monitoren.... Welke filesysteem is vol?

xymon uranus /usr vol

[root@uranus etc]# lvextend -n /dev/rootvg/lvusr -L +1G
Extending logical volume lvusr to 4.00 GB
Logical volume lvusr successfully resized
[root@uranus etc]# resize
resize resize2fs resize4fs
[root@uranus etc]# resize4fs /dev/rootvg/lvusr
resize4fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/rootvg/lvusr is mounted on /usr; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/rootvg/lvusr to 1048576 (4k) blocks.
The filesystem on /dev/rootvg/lvusr is now 1048576 blocks long.

[root@uranus etc]#

Hierna het formateren:

[root@uranus etc]# mkfs -t ext3 -b 4096 /dev/rootvg/lvroot

Hierna moeten we eens kijken naar parted en de bijbehorende alignment test (in verband met die sector size van 4kb).
Helaas is WD wel voorbereid op Windows maar niet op Linux (http://www.wdc.com/en/products/advancedformat/).


Dovecot en squirrelmail


cd /usr/share/squirrelmail/
/usr/share/squirrelmail/config/conf.pl
./iptables restart
./httpd start
/usr/share/squirrelmail/config/conf.pl
rpm -qa | grep dovecot
./dovecot status
./dovecot start

[root@uranus log]# service dovecot start
Starting Dovecot Imap: [ OK ]
[root@uranus log]# chkconfig --add --level 2345 dovecot


Todo:
root exclude extern
geen redirect naar uranus via webmail toegang
eventueel
virtuele server aanmaken via https


xymon

[root@uranus ~]# yum install gcc-c++ perl lynx ntp kernel-dev mrtg pcre-devel openssl-devel openldap-devel httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: ftp.tudelft.nl
* base: ftp.tudelft.nl
* extras: ftp.tudelft.nl
* updates: ftp.tudelft.nl
Setting up Install Process
Package gcc-c++-4.1.2-48.el5.x86_64 already installed and latest version
Package 4:perl-5.8.8-32.el5_5.1.x86_64 already installed and latest version
Package ntp-4.2.2p1-9.el5.centos.2.1.x86_64 already installed and latest version
No package kernel-dev available.
Package mrtg-2.14.5-2.x86_64 already installed and latest version
Package openssl-devel-0.9.8e-12.el5_4.6.x86_64 already installed and latest version
Package openssl-devel-0.9.8e-12.el5_4.6.i386 already installed and latest version
Package openldap-devel-2.3.43-12.el5_5.2.x86_64 already installed and latest version
Package openldap-devel-2.3.43-12.el5_5.2.i386 already installed and latest version
Package httpd-2.2.3-43.el5.centos.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package lynx.x86_64 0:2.8.5-28.1.el5_2.1 set to be updated
---> Package pcre-devel.i386 0:6.6-2.el5_1.7 set to be updated
---> Package pcre-devel.x86_64 0:6.6-2.el5_1.7 set to be updated
---> Package perl.i386 4:5.8.8-32.el5_5.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================
Package Arch Version Repository Size
============================================================================================================================
Installing:
lynx x86_64 2.8.5-28.1.el5_2.1 base 1.7 M
pcre-devel i386 6.6-2.el5_1.7 base 176 k
pcre-devel x86_64 6.6-2.el5_1.7 base 179 k
perl i386 4:5.8.8-32.el5_5.1 extras 12 M

Transaction Summary
============================================================================================================================
Install 4 Package(s)
Upgrade 0 Package(s)

Total download size: 14 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): pcre-devel-6.6-2.el5_1.7.i386.rpm | 176 kB 00:00
(2/4): pcre-devel-6.6-2.el5_1.7.x86_64.rpm | 179 kB 00:00
(3/4): lynx-2.8.5-28.1.el5_2.1.x86_64.rpm | 1.7 MB 00:02
(4/4): perl-5.8.8-32.el5_5.1.i386.rpm | 12 MB 00:16
----------------------------------------------------------------------------------------------------------------------------
Total 683 kB/s | 14 MB 00:20
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lynx 1/4
Installing : pcre-devel 2/4
Installing : pcre-devel 3/4
Installing : perl 4/4

Installed:
lynx.x86_64 0:2.8.5-28.1.el5_2.1 pcre-devel.i386 0:6.6-2.el5_1.7 pcre-devel.x86_64 0:6.6-2.el5_1.7
perl.i386 4:5.8.8-32.el5_5.1

Complete!
[root@uranus ~]#

[root@uranus xymon-4.3.0-beta2]# vi /etc/yum.repos.d/dag.repo
[root@uranus xymon-4.3.0-beta2]# yum install rrdtool-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: ftp.tudelft.nl
* base: ftp.tudelft.nl
* extras: ftp.tudelft.nl
* updates: ftp.tudelft.nl
dag | 1.1 kB 00:00
dag/primary | 2.2 MB 00:03
dag 10228/10228
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rrdtool-devel.x86_64 0:1.4.4-1.el5.rf set to be updated
--> Processing Dependency: rrdtool = 1.4.4 for package: rrdtool-devel
--> Processing Dependency: librrd.so.4()(64bit) for package: rrdtool-devel
--> Processing Dependency: librrd_th.so.4()(64bit) for package: rrdtool-devel
--> Running transaction check
---> Package rrdtool.x86_64 0:1.4.4-1.el5.rf set to be updated
--> Processing Dependency: ruby for package: rrdtool
--> Processing Dependency: perl(RRDs) for package: rrdtool
--> Processing Dependency: perl(RRDp) for package: rrdtool
--> Processing Dependency: lua for package: rrdtool
--> Running transaction check
---> Package lua.x86_64 0:5.1.4-2.el5.rf set to be updated
---> Package perl-rrdtool.x86_64 0:1.4.4-1.el5.rf set to be updated
---> Package ruby.x86_64 0:1.8.5-5.el5_4.8 set to be updated
--> Processing Dependency: ruby-libs = 1.8.5-5.el5_4.8 for package: ruby
--> Processing Dependency: libruby.so.1.8()(64bit) for package: ruby
--> Running transaction check
---> Package ruby-libs.x86_64 0:1.8.5-5.el5_4.8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================
Package Arch Version Repository Size
============================================================================================================================
Installing:
rrdtool-devel x86_64 1.4.4-1.el5.rf dag 295 k
Installing for dependencies:
lua x86_64 5.1.4-2.el5.rf dag 235 k
perl-rrdtool x86_64 1.4.4-1.el5.rf dag 54 k
rrdtool x86_64 1.4.4-1.el5.rf dag 909 k
ruby x86_64 1.8.5-5.el5_4.8 base 274 k
ruby-libs x86_64 1.8.5-5.el5_4.8 base 1.6 M

Transaction Summary
============================================================================================================================
Install 6 Package(s)
Upgrade 0 Package(s)

Total download size: 3.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): perl-rrdtool-1.4.4-1.el5.rf.x86_64.rpm | 54 kB 00:00
(2/6): lua-5.1.4-2.el5.rf.x86_64.rpm | 235 kB 00:00
(3/6): ruby-1.8.5-5.el5_4.8.x86_64.rpm | 274 kB 00:00
(4/6): rrdtool-devel-1.4.4-1.el5.rf.x86_64.rpm | 295 kB 00:00
(5/6): rrdtool-1.4.4-1.el5.rf.x86_64.rpm | 909 kB 00:01
(6/6): ruby-libs-1.8.5-5.el5_4.8.x86_64.rpm | 1.6 MB 00:02
----------------------------------------------------------------------------------------------------------------------------
Total 571 kB/s | 3.4 MB 00:06
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
dag/gpgkey | 1.6 kB 00:00
Importing GPG key 0x6B8D79E6 "Dag Wieers (Dag Apt Repository v1.0) <dag@wieers.com>" from http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lua 1/6
Installing : ruby-libs 2/6
Installing : ruby 3/6
Installing : rrdtool 4/6
Installing : perl-rrdtool 5/6
Installing : rrdtool-devel 6/6

Installed:
rrdtool-devel.x86_64 0:1.4.4-1.el5.rf

Dependency Installed:
lua.x86_64 0:5.1.4-2.el5.rf perl-rrdtool.x86_64 0:1.4.4-1.el5.rf rrdtool.x86_64 0:1.4.4-1.el5.rf
ruby.x86_64 0:1.8.5-5.el5_4.8 ruby-libs.x86_64 0:1.8.5-5.el5_4.8

Complete!
[root@uranus xymon-4.3.0-beta2]#

[root@uranus ~]# useradd -m xymon

[root@uranus ~]# wget http://downloads.sourceforge.net/project/xymon/hobbitserver/4.3.0-beta2/xymon-4.3.0-beta2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fxymon%2Ffiles%2F&ts=1282678595&mirror=heanet
[1] 3626
[2] 3627
[root@uranus ~]# --2010-08-24 19:36:27-- http://downloads.sourceforge.net/project/xymon/hobbitserver/4.3.0-beta2/xymon-4.3.0-beta2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fxymon%2Ffiles%2F
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://sunet.dl.sourceforge.net/project/xymon/hobbitserver/4.3.0-beta2/xymon-4.3.0-beta2.tar.gz [following]
--2010-08-24 19:36:27-- http://sunet.dl.sourceforge.net/project/xymon/hobbitserver/4.3.0-beta2/xymon-4.3.0-beta2.tar.gz
Resolving sunet.dl.sourceforge.net... 194.71.11.73
Connecting to sunet.dl.sourceforge.net|194.71.11.73|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2405826 (2.3M) [application/x-gzip]
Saving to: `xymon-4.3.0-beta2.tar.gz'

100%[==================================================================================>] 2,405,826 690K/s in 3.4s

2010-08-24 19:36:31 (690 KB/s) - `xymon-4.3.0-beta2.tar.gz' saved [2405826/2405826]


[1]- Done wget http://downloads.sourceforge.net/project/xymon/hobbitserver/4.3.0-beta2/xymon-4.3.0-beta2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fxymon%2Ffiles%2F
[2]+ Done ts=1282678595
[root@uranus ~]# cd /usr/src
[root@uranus src]# tar xzf /root/xymon-4.3.0-beta2.tar.gz
[root@uranus src]# cd xymon-4.3.0-beta2/
[root@uranus xymon-4.3.0-beta2]#

[root@uranus xymon-4.3.0-beta2]# ./configure

Configuration script for Xymon

This script asks a few questions and builds a Makefile to compile Xymon

Checking your make-utility
Checking pre-requisites for building Xymon

Checking for fping ...
Hobbit has a built-in ping utility (hobbitping)
However, it is not yet fully stable and therefore it
may be best to use the external fping utility instead.
I could not find fping on your system
Do you want to use hobbitping [Y/n] ?
y
OK, I will use hobbitping.

Checking for RRDtool ...
test-rrd.c: In function âmainâ:
test-rrd.c:30: error: too few arguments to function ârrd_graphâ
make: *** [test-compile] Error 1
Not RRDtool 1.0.x, checking for 1.2.x
Found RRDtool include files in /usr/include
Found RRDtool libraries in /usr/lib64
Linking RRD with PNG library: -L/usr/lib64 -lpng

Checking for PCRE ...
Found PCRE include files in /usr/include
Found PCRE libraries in /usr/lib64

Checking for OpenSSL ...
Found OpenSSL include files in /usr/include
Found OpenSSL libraries in /usr/lib64

Xymon can use the OpenSSL library to test SSL-enabled services
like POP3S, IMAPS, NNTPS and TELNETS. If you have the OpenSSL
library installed, I recommend that you enable this.

Do you want to be able to test SSL-enabled services (y) ?
y

Checking for LDAP ...
test-ldap.c: In function âmainâ:
test-ldap.c:25: warning: implicit declaration of function âldap_initâ
test-ldap.c:25: warning: assignment makes pointer from integer without a cast
Found LDAP include files in /usr/include
Found LDAP libraries in /usr/lib64

Xymon can use your OpenLDAP LDAP client library to test LDAP servers.

Do you want to be able to test LDAP servers (y) ?
y
Enable experimental support for LDAP/SSL (OpenLDAP 2.x only) (y) ?
y

Checking for clock_gettime() requiring librt ...
clock_gettime() requires librt

Checking for Large File Support ...
Large File Support OK

Setting up for a Xymon server

What userid will be running Xymon [xymon] ?

Found passwd entry for user xymon:x:2412:2412::/home/xymon:/bin/bash

Where do you want the Xymon installation [/home/xymon] ?
/opt/monitor/xymon
WARNING: /opt/monitor/xymon does not exist.

What URL will you use for the Xymon webpages [/xymon] ?

Where to put the Xymon CGI scripts [/opt/monitor/xymon/cgi-bin] ?
(Note: This is the filesystem directory - we will get to the URL shortly)

What is the URL for the Xymon CGI directory [/xymon-cgi] ?
(Note: This is the URL - NOT the filesystem directory)

********************** SECURITY NOTICE ****************************
If your Xymon server is accessible by outsiders, then you should
restrict access to the CGI scripts that handle enable/disable of
hosts, and acknowledging of alerts. The easiest way to do this is
to put these in a separate CGI directory and require a password to
access them.
Even if your Xymon server is on a secured, internal network, you
may want to have some operations (like disabling a host) be password-
protected - that lets you see who disabled or acknowledged an alert.

Where to put the Xymon Administration CGI scripts [/opt/monitor/xymon/cgi-secure] ?
(Note: This is the filesystem directory - we will get to the URL shortly)

What is the URL for the Xymon Administration CGI directory [/xymon-seccgi] ?
(Note: This is the URL - NOT the filesystem directory)

** Note that you may need to modify your webserver configuration.
** After installing, see /opt/monitor/xymon/server/etc/hobbit-apache.conf for an example configuration.

To generate Xymon availability reports, your webserver
must have write-access to a directory below the Xymon
top-level directory. I can set this up if you tell me
what group-ID your webserver runs with. This is typically
'nobody' or 'apache' or 'www-data'

What group-ID does your webserver use [nobody] ?
apache

Where to put the Xymon logfiles [/var/log/xymon] ?

What is the name of this host [uranus.solarsystem.lan] ?

What is the IP-address of this host [127.0.0.1] ?
44.128.168.1

Where should I install the Xymon man-pages (/usr/local/man) ?

Using Linux Makefile settings

Created Makefile with the necessary information to build Xymon
Some defaults are used, so do look at the Makefile before continuing.

Configuration complete - now run make (GNU make) to build the tools
[root@uranus xymon-4.3.0-beta2]#


Build complete. Now run 'make install' as root

[root@uranus xymon-4.3.0-beta2]# make install
....

Installation complete.

You must configure your webserver for the Hobbit webpages and CGI-scripts.
A sample Apache configuration is in /opt/monitor/xymon/server/etc/hobbit-apache.conf
If you have your Administration CGI scripts in a separate directory,
then you must also setup the password-file with the htpasswd command.

To start Hobbit, as the xymon user run '/opt/monitor/xymon/server/bin/hobbit.sh start'
To view the Hobbit webpages, go to http://uranus.solarsystem.lan/xymon
[root@uranus xymon-4.3.0-beta2]#
[root@uranus xymon-4.3.0-beta2]# su - xymon -c '/opt/monitor/xymon/server/bin/hobbit.sh start'
[root@uranus xymon-4.3.0-beta2]# chkconfig --level 2345 httpd on
[root@uranus xymon-4.3.0-beta2]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@uranus xymon-4.3.0-beta2]#
system-config-securitylevel-tui

[root@uranus xymon-4.3.0-beta2]# wget http://gejanssen.com/howto/monitoring/xymon.centos5
--2010-08-24 20:01:17-- http://gejanssen.com/howto/monitoring/xymon.centos5
Resolving gejanssen.com... 62.75.168.92
Connecting to gejanssen.com|62.75.168.92|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1176 (1.1K) [text/plain]
Saving to: `xymon.centos5'

100%[==================================================================================>] 1,176 --.-K/s in 0.006s

2010-08-24 20:01:17 (207 KB/s) - `xymon.centos5' saved [1176/1176]

[root@uranus xymon-4.3.0-beta2]# mv xymon.centos5 /etc/rc.d/
init.d/ rc0.d/ rc2.d/ rc4.d/ rc6.d/ rc.sysinit
rc rc1.d/ rc3.d/ rc5.d/ rc.local
[root@uranus xymon-4.3.0-beta2]# mv xymon.centos5 /etc/rc.d/init.d/xymon
[root@uranus xymon-4.3.0-beta2]# chmod a+x /etc/rc.d/init.d/xymon
[root@uranus xymon-4.3.0-beta2]# chkconfig --add --level 2345 xymon
[root@uranus xymon-4.3.0-beta2]# chkconfig --list xymon
xymon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@uranus xymon-4.3.0-beta2]# service xymon restart
restarting xymon: Hobbit stopped
Hobbit started
Hobbit client not running, continuing to start it
Hobbit client for linux started on uranus.solarsystem.lan
[root@uranus xymon-4.3.0-beta2]#

[root@uranus etc]# cp hobbit-apache.conf /etc/httpd/conf.d/xymon-apache.conf
[root@uranus etc]# vi /etc/httpd/conf.d/xymon-apache.conf

Alias /xymon "/opt/monitor/xymon/server/www"
<Directory "/opt/monitor/xymon/server/www">

[root@uranus etc]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
[root@uranus etc]#

todo messages


[root@uranus etc]# vi /etc/logrotate.d/syslog
...
postrotate
/bin/chmod go+r /var/log/messages
...
[root@uranus etc]# /bin/chmod go+r /var/log/messages
[root@uranus etc]#

ToDo:

xymon 4.30 Beta3


SMS

Na wat gespeel heb ik sms aan de gang gekregen met wammu en gammu. Op CentOS is alleen maar Gammu te verkrijgen. Het ontvangen en uitlezen van sms'jes kost veel knutselwerk en in smstools3 zit dit allemaal al in. Vandaar dat ik wel gammu geconfigureerd heb, maar uiteindelijk toch smstools3 gebruik in samenwerking van mijn Huawei E160.

gammu en wammu

[root@uranus ~]# yum install gammu
Loaded plugins: fastestmirror
--> Running transaction check
---> Package gammu.x86_64 0:1.11.0-1.el5.rf set to be updated
--> Finished Dependency Resolution

============================================================================================================================
Package Arch Version Repository Size
============================================================================================================================
Installing:
gammu x86_64 1.11.0-1.el5.rf dag 1.4 M

Transaction Summary
============================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
gammu-1.11.0-1.el5.rf.x86_64.rpm | 1.4 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : gammu 1/1

Installed:
gammu.x86_64 0:1.11.0-1.el5.rf

Complete!
[root@uranus ~]#

Voor de Huawei E160G

# cd
# vi .gammurc
[gammu]
port=/dev/ttyUSB1
connection=at115200
name=huawei E160G T-Mobile
model=

[root@localhost ~]# gammu --entersecuritycode PIN 9275
[root@localhost ~]# gammu --getallsms
Location 1, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number : "+31653131313"
Sent : Wed 02 Jun 2010 06:56:06 PM CET +0200
Coding : Default GSM alphabet (no compression)
Remote number : "+316xxxxxxxxx"
Status : Read
......

Verzenden van sms:

[root@localhost ~]# echo "Dit is een test sms" | gammu --sendsms TEXT 06xxxxxxxxx
If you want break, press Ctrl+C...
Sending SMS 1/1....waiting for network answer..OK, message reference=8
#

Voor de Huawei E1550 (deze werkt nog niet!!!!)

Download de source rpm, installeer de source rpm, compileer en installeer usb_modeswitch
[root@uranus ~]# wget ftp://ftp.pbone.net/mirror/rpms.arrfab.net/centos/testing/i386/usb_modeswitch/usb_modeswitch-0.9.7-1.el5.test.src.rpm
...
[root@uranus ~]# rpm -i usb_modeswitch-0.9.7-1.el5.test.src.rpm
...
[root@uranus redhat]# cd /usr/src/redhat/SOURCES
[root@uranus SOURCES]# ls
usb_modeswitch-0.9.7.tar.bz2
[root@uranus SOURCES]# rpmbuild -tb usb_modeswitch-0.9.7.tar.bz2
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.28745
+ umask 022
...
+ cd usb_modeswitch-0.9.7
+ rm -rf /var/tmp/usb_modeswitch-0.9.7-1-root-root
+ exit 0
[root@uranus SOURCES]# ls -la
total 24
drwxr-xr-x 2 root root 4096 Sep 19 13:51 .
drwxr-xr-x 7 root root 4096 Sep 8 17:08 ..
-rw-r--r-- 1 root root 14106 Apr 17 2009 usb_modeswitch-0.9.7.tar.bz2
[root@uranus SOURCES]# cd ../RPMS/x86_64/
[root@uranus x86_64]# ls -la
total 32
drwxr-xr-x 2 root root 4096 Sep 19 13:52 .
drwxr-xr-x 4 root root 4096 Sep 8 17:08 ..
-rw-r--r-- 1 root root 18683 Sep 19 13:52 usb_modeswitch-0.9.7-1.x86_64.rpm
-rw-r--r-- 1 root root 1571 Sep 19 13:52 usb_modeswitch-debuginfo-0.9.7-1.x86_64.rpm
[root@uranus x86_64]# rpm -ivh usb_modeswitch-0.9.7-1.x86_64.rpm
Preparing... ########################################### [100%]
1:usb_modeswitch ########################################### [100%]
[root@uranus x86_64]#



Steek de umts stick in de server

[root@uranus rules.d]# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 002: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552 (HSPA modem)
Bus 001 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000


[root@uranus ~]# usb_modeswitch -v 12d1 -p 1446 -d 1

* usb_modeswitch: tool for controlling "flip flop" mode USB devices
* Version 0.9.7 (C) Josua Dietze 2009
* Works with libusb 0.1.12 and probably other versions

Looking for default devices ...
Found default devices (1)
Prepare switching, accessing device 002 on bus 001 ...
Only detaching storage driver for switching ...
Looking for active driver ...
OK, driver found ("usb-storage")
OK, driver "usb-storage" detached
-> Run lsusb to note any changes. Bye

[root@uranus ~]# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 002: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552 (HSPA modem)
Bus 001 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000

werkt dus niet....

Code:# Huawei E1550
DefaultVendor = 0x12d1
DefaultProduct = 0x1446
MessageEndpoint = 0x01
MessageContent = "55534243000000000000000000000011060000000000000000000000000000"


cd /etc/usb_modeswitch
/etc/usb_modeswitch.conf

of

vi /etc/udev/rules.d/15-huawei-e1550.rules
SUBSYSTEM=="usb",SYSFS{idProduct}=="1446",SYSFS{idVendor}=="12d1",RUN+="/lib/udev/modem-modeswitch --vendor 0x12d1 --product 0x1446 --type option-zerocd"
(dit werkt nog niet!!!)

SMSTools3

Downloaden en uitpakken van de tools:
[root@uranus Downloads]# wget http://smstools3.kekekasvi.com/packages/smstools3-3.1.14.tar.gz
--2010-10-26 16:04:51-- http://smstools3.kekekasvi.com/packages/smstools3-3.1.14.tar.gz
Resolving smstools3.kekekasvi.com... 89.236.101.38
Connecting to smstools3.kekekasvi.com|89.236.101.38|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 299379 (292K) [application/x-gzip]
Saving to: `smstools3-3.1.14.tar.gz'

100%[===============================================================================================================================>] 299,379 220K/s in 1.3s

2010-10-26 16:04:53 (220 KB/s) - `smstools3-3.1.14.tar.gz' saved [299379/299379]

[root@uranus Downloads]# cd /usr/src/
[root@uranus src]# tar xzf /home/gej/Downloads/smstools3-3.1.14.tar.gz
[root@uranus src]# cd smstools3
[root@uranus smstools3]# make
cd src && make -
make[1]: Entering directory `/usr/src/smstools3/src'
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o extras.o extras.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o locking.o locking.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o cfgfile.o cfgfile.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o logging.o logging.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o alarm.o alarm.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o smsd_cfg.o smsd_cfg.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o charset.o charset.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o stats.o stats.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o blacklist.o blacklist.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o whitelist.o whitelist.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o modeminit.o modeminit.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o pdu.o pdu.c
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -o smsd smsd.c extras.o locking.o cfgfile.o logging.o alarm.o smsd_cfg.o charset.o stats.o blacklist.o whitelist.o modeminit.o pdu.o
make[1]: Leaving directory `/usr/src/smstools3/src'
[root@uranus smstools3]# make install
cd src && make -
make[1]: Entering directory `/usr/src/smstools3/src'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/smstools3/src'
./install.sh /usr/local/bin

Installing binary program files
/usr/local/bin/smsd
Installing some scripts
/usr/local/bin/sendsms
/usr/local/bin/sms2html
/usr/local/bin/sms2unicode
/usr/local/bin/unicode2sms
Installing config file
/etc/smsd.conf
Creating minimum spool directories
Skipped /var/spool, directory already exists
Creating directory /var/spool/sms
Creating directory /var/spool/sms/incoming
Creating directory /var/spool/sms/outgoing
Creating directory /var/spool/sms/checked
Installing start-script
/etc/init.d/sms3

Example script files are not installed automatically.
Please dont forget to edit /etc/smsd.conf.
[root@uranus smstools3]#


Aanpassen van de config: ([GSM1] is de originele setup en [surfstick] is mijn Huawei E160 en [GSM2] is mijn Siemens sx65)
Met devices geef je aan welke gebruikt wordt. De logging heb ik maar na een initiele setup gelijk op 5 gezet. Ik hoef niet alle commando's te zien.

[root@uranus smstools3]# vi /etc/smsd.conf

# Example smsd.conf. Read the manual for a description

devices = surfstick
logfile = /var/log/smsd.log
loglevel = 5
#loglevel = 7

[GSM1]
device = /dev/ttyS0
incoming = yes
#pin = 1111

[surfstick]
#http://smstools3.kekekasvi.com/topic.php?id=331
device = /dev/ttyUSB1
baudrate = 115200
incoming = yes
voicecall_vts_list = yes
check_network = 1
init = AT^CURC=0
init2 = AT^BOOT=0,0
check_memory_method = 2
pin = 9275

[GSM2]
init = AT+CPMS="ME","ME","ME"
init2 = AT+CNMI=1,1,0,2
incoming = high
eventhandler = /usr/local/bin/smsevent
report = yes
baudrate = 115200
send_delay = 20
rtscts = yes
device = /dev/ttyUSB1
incoming = yes
#pin = 1111


[root@uranus init.d]#vi /etc/init.d/sms3

voeg/vervang de volgende regels toe bij

### BEGIN INIT INFO
# chkconfig: 234 95 5
# description: starts smstools
# procesname: smsd
### END INIT INFO

Toevoegen aan de autostart en controleren:
[root@uranus init.d]# chkconfig --add --level 2345 sms3
[root@uranus init.d]# chkconfig --list sms3
sms3 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@uranus init.d]# ./sms3 start
Starting SMS Daemon: smsd.
[root@uranus init.d]# tail -f /var/log/smsd.log
2010-10-26 16:23:49,2, smsd: Smsd v3.1.14 started.
2010-10-26 16:23:49,2, smsd: Running as root:root.
2010-10-26 16:23:49,4, smsd: File mode creation mask: 022 (0644, rw-r--r--).
2010-10-26 16:23:49,5, surfstick: Modem handler 0 has started. PID: 10264.
2010-10-26 16:23:49,3, surfstick: Couldn't open serial port /dev/ttyUSB1, error: No such file or directory, waiting 30 sec.
2010-10-26 16:23:49,5, smsd: Outgoing file checker has started. PID: 10263.
2010-10-26 16:24:19,5, surfstick: Using check_memory_method 2: CMGD is used.
2010-10-26 16:24:19,3, surfstick: Unexpected input: ^BOOT:28196592,0,0,0,76
2010-10-26 16:24:20,5, surfstick: Modem needs PIN, entering PIN...
2010-10-26 16:24:25,5, surfstick: CGSN: 359390028196592
2010-10-26 16:24:25,5, surfstick: IMSI: 204163703153398

Testen van sms:


[root@uranus init.d]# /usr/local/bin/sendsms 316123456789 "groot testbericht"
--
Text: groot testbericht
To: 316123456789
[root@uranus init.d]# tail -f /var/log/smsd.log
...
2010-10-26 16:25:49,5, smsd: Moved file /var/spool/sms/outgoing/send_o10570 to /var/spool/sms/checked
2010-10-26 16:26:00,5, surfstick: SMS sent, Message_id: 11, To: 316123456789, sending time 6 sec.
2010-10-26 16:26:31,5, surfstick: SMS received, From: 316123456789

[root@uranus init.d]# cat /var/spool/sms/incoming/surfstick.zs2qrJ
From: 316123456789
From_TOA: 91 international, ISDN/telephone
From_SMSC: 31653131313
Sent: 10-10-26 18:28:04
Received: 10-10-26 16:26:31
Subject: surfstick
Modem: surfstick
IMSI: 204163703153398
Report: no
Alphabet: ISO
Length: 11

Test gelukt

[root@uranus init.d]#

rsync

Installeer rync en de eventuele tools

[root@saturn ~]# yum install grsync.x86_64 duplicity.x86_64 rsync.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
...
Complete!

Controleer of xinetd automatisch gestart wordt.

[root@saturn ~]# chkconfig --list xinetd
xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
[root@saturn ~]#

Zet rsync aan (disable = np)

[root@saturn ~]# vi /etc/xinetd.d/rsync

# default: off
# description: The rsync server is a good addition to an ftp server, as it #   allows crc checksumming etc.
service rsync
{
    disable = no
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/rsync
    server_args     = --daemon
    log_on_failure  += USERID
}

en restart de xinetd:
[root@saturn ~]# service xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
[root@saturn ~]#



Voorbeelden:

rsync met ssh/scp protocol (rsync server inrichten niet noodzakelijk:)
# rsync --verbose  --progress --stats --compress --rsh=/usr/bin/ssh --recursive --times --perms --links --delete --recursive --times --perms --links --delete --exclude "*bak" --exclude "*~" gej@saturn:/home/gej/* /media/rsync/

 

Virtualisatie

Met de versie 6.0 van RedHat heeft redhat oftewel rhel6 XEN losgelaten als hypervisor, dus als ik el cheapo wil virtualiseren, zal ik verder moeten met KVM of Virtualbox.

bla

back