Samstag, 1. November 2008

Linux - Debian - Lenny - eeePC1000H

ist noch nicht 100% verifiziert, bin mir nicht sicher ob das alles funzt...

Schritt 1-3 bei
http://mixed-it.de/blog/2008/10/05/debian-auf-dem-asus-eee-1000h/

danach:
aptitude install module-assistant
# aptitude install dh_testdir
aptitude install debhelper

weiter mit Schritt 4

Linux - Debian - Kernel Headers installieren

aptitude install build-essential kernel-package

Montag, 6. Oktober 2008

Linux - Debian - Etch - Oracle XE - Listener Port ändern

Ändern des Listener-Ports für eine Oracle XE Datenbank.

Voraussetzungen:
HOST=dev001
aktueller Port=1521
neuer Port=1591
oracle-user=oracle

1.Schritt: Ports in den oracle-config-dateien ändern
auf den user oracle wechseln, nur er sollte folgene files bearbeiten: su oracle
in den dateien listener.ora und tnsnames.ora alle vorkommenden PORT=1521 einträge
auf PORT=1591 umändern.
Pfade:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora

2.Schritt: mittels SQLPLUS als sysdba zur Datenbank verbinden:
- auf den oracle user wechseln:
su oracle

- mit sqlplus verbinden:
sqlplus / as sysdba

- nacheinander folgende 2 commandos eingeben und mit Enter bestätigen:
ALTER SYSTEM SET LOCAL_LISTENER = "(ADDRESS=(PROTOCOL=TCP)(HOST=dev001)(PORT=1591))";

ALTER SYSTEM REGISTER;

mit exit aus sqlplus wieder aussteigen

3.Schritt: rechner neustarten
Einstellungen werden sonst nicht ordentlich übernommen, man müsste
mit diversen befehlen alles mögliche hoch und niederfahren.

Linux - Debian - Etch - Apache als Serverportal

Einrichten eines Serverportals mit automatischem Redirect auf
unterschiedliche Applikationen

Ausgangslage:
mehrere Applikationen laufen im internen Netz auf verschiedenen tomcat-ports und sollen vom internet alle über Port 80 erreichbar sein.
die Applikationen laufen alle auf einem Server (Serverportal) gemeinsam in einer dort laufenden virtuellen Maschine
zb.:
- Serverportal 192.168.0.20
- VmWare-Server (VMS1) am Serverportal: 192.168.0.91
- Applikation1 auf VMS1: Port 8081
- Applikation2 auf VMS1: Port 8082


1.Schritt: Anlegen eines domainnames pro Applikation
zb. via DYNDNS.org: app1.dyndns.org, app2.dyndns.org


2.Schritt: Weiterleitung in der Router-Firewall einstellen
Port 80 auf Port 8080 aufs Serverportal 192.168.0.20


3.Schritt: Installieren von Apache
apt-get install apache2
aptitude: hinzufügen von libapache2-mod-proxy-html
oder
apt-get install libapache2-mod-proxy-html

4.Schritt: Module aktivieren
a2enmod proxy
a2enmod proxy_html
a2enmod proxy_http


5.Schritt: proxy.conf-Link löschen
löschen des links proxy.conf aus dem verzeichnis /etc/apache2/mods-enabled


6.Schritt: sites-available erstellen
im Ordner "/etc/apache2/sites-available"
- datei anlegen "appname1"
- datei anlegen "appname2"

Inhalt appname1:
<VirtualHost *:8080>
ProxyRequests Off

DocumentRoot /var/www/
CustomLog /var/log/www/appname1.log combined

ServerName appname1.dyndns.org

ProxyVia On

ProxyPass / http://192.168.0.91:8081/
ProxyPassReverse / http://192.168.0.91:8081/

</VirtualHost>


Inhalt appname2:
<VirtualHost *:8080>
ProxyRequests Off

DocumentRoot /var/www/
CustomLog /var/log/www/appname1.log combined

ServerName appname2.dyndns.org

ProxyVia On

ProxyPass / http://192.168.0.91:8082/
ProxyPassReverse / http://192.168.0.91:8082/

</VirtualHost>


7.Schritt: links im apache-verzeichnis erstellen
a2ensite appname1
a2ensite appname2


8.Schritt: default-site deaktivieren
a2dissite default


9.Schritt: apache.conf anpassen
/etc/apache2/apache2.conf

vor "# Include the virtual host configurations" folgende zeilen einfügen:
ProxyRequests off
NameVirtualHost *:8080

NameVirualHost * suchen und auskommentieren oder löschen


10.Schritt: Listen Port ändern
/etc/apache2/ports.conf
ändern: Listen 80 auf Listen 8080
erste zeile löschen: NameVirtualHost *:80


11.Schritt: log-verzeichnis anlegen:
cd /var/log
mkdir www


12.Schritt: apache neu starten
/etc/init.d/apache2 restart

Montag, 15. September 2008

Linux - Debian - Etch - VmWare - Mouse-Wheel aktivieren

Um das Scrollen per Mausrad zu aktivieren muss in
der Datei /etc/X11/xorg.conf der Eintrag für die Maus
auf folgendes ergänzt/verbessert werden:

Section "InputDevice"
Identifier "Configured Mouse"
Driver "vmmouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection

Sonntag, 18. Mai 2008

Linux - Debian - Etch - Oracle 11g - Installation

Partitionierung:
- Swap: ~2 GB
- TMP: ~2 GB
- /: Rest (mind. 6 GB frei nach Installation)

Anleitung von http://www.pythian.com/blogs/549/installing-oracle-11g-on-ubuntu-linux-704

Step Zero

Make sure your system is up-to-date. A simple apt-get update followed by a apt-get upgrade will do the trick, although you may prefer using the GUI Synaptic Package Manager — it’s entirely up to you what method you choose. However, I much prefer to use the command line.

As you go through updates, sometimes a reboot will be needed (usually to boot from a newer, recently-updated kernel). Sometimes it’ll just ask you to restart your web browser or some other program as a new version is installed.

It’s important to have a few gigabytes of free disk space and a total of 1 GB of memory before starting this. This 1 GB of memory can be RAM alone or the combination of RAM and swap space. Of course, since everything runs faster when in RAM, the more of it, the better.

Very important: get Java running before trying to move on. My guess is that almost any JRE (java runtime) or JDK (java development kit) will work. I’m not sure which is the minimum version required: I used Sun JDK 1.5.

Step One

Install some system requirements. There are a few packages that I had to install on this box (it was a recently installed system which didn’t have all these packages). After several attempts of installing Oracle, the equivalent command-line for installing all the necessary packages at once was something like this:

# apt-get install gcc make binutils lesstif2 libc6 libc6-dev rpm libmotif3 libaio1 libaio-dev libstdc++5 gawk alien libg++2.8.1.3-glibc2.2 ksh gcc-3.3 g++-3.3 libstdc++5

It’s possible that when installing the packages mentioned above, the installer will install some other prerequisites as well, as these packages themselves may have prerequisites.

Step Two

Choose where you are going to install your Oracle 11g server and create the ORACLE_BASE directory. This is the place where Oracle will be installed. Make sure there is at least 3 GB on the partition/mount point before moving to the next step. After installed, my basic installation took about 3.4 GB on disk (without the starter database!). As your database grows, it will need more space. Reserve a total of at least 6 GB for the unpacked installer and the basic installation. You can get rid of the installer files afterwards.

# mkdir -p /u01/app/oracle

Step Three

Add a few users and change groups to make the installer more comfortable. Remember, we are tricking the installer to think it’s installing on a Red Hat box.

# addgroup oinstall
# addgroup dba
# addgroup nobody
# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
# usermod -g nobody nobody

The usermod command is needed since because when running, the installer looks for a user called nobody which is part of a group named nobody (in Ubuntu, the user nobody it’s assigned to nogroup by default).

Step Four

Make some symlinks. Apparently, the installer uses absolute paths, so it must find the binaries in the right places.

# ln -s /usr/bin/awk /bin/awk
# ln -s /usr/bin/rpm /bin/rpm
# ln -s /usr/bin/basename /bin/basename

Step Five

We need to mimic the /etc/rc.d directory structure of a Red Hat box. We do this with more symlinks:

# mkdir /etc/rc.d
# ln -s /etc/rc0.d /etc/rc.d/rc0.d
# ln -s /etc/rc2.d /etc/rc.d/rc2.d
# ln -s /etc/rc3.d /etc/rc.d/rc3.d
# ln -s /etc/rc4.d /etc/rc.d/rc4.d
# ln -s /etc/rc5.d /etc/rc.d/rc5.d
# ln -s /etc/rc6.d /etc/rc.d/rc6.d
# ln -s /etc/init.d /etc/rc.d/init.d

Step Six

I’ve created a file called /etc/redhat-release and put only one line on it. The same can be achieved by issuing the following as root:

echo "Red Hat Linux release 4" > /etc/redhat-release

Step Seven

We tweak the system default limits on a few items. The shared-memory are specially important, since Oracle relies on shared memory for process communications. There is a file called /etc/sysctl.conf and it should have these lines on it:

fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144


Now that they are in a config file, these limits will be issued automatically at the next boot sequence. For now, we need to make the system re-read the config file:

# sysctl -p

Now, what do those parameters and values actually mean?

  • fs.file-max sets the maximum number of open files that can be handled by the Linux kernel.
  • kernel.shmall determines the total amount of shared memory to be allocated in pages. In this example, I’ve set it to 8GB, which is way above the amount of memory I can handle in my box, even with swap.
  • kernel.shmmax controls the maximum amount of memory to be allocated for shared memory which in this example is 2GB.
  • kernel.shmmni defines the maximum number of segments system-wide.
  • net.core.rmem_default and net.core.rmem_max define the default and maximum read buffer queue for network operations (1 MB in this example)
  • net.core.wmem_default and net.core.wmem_max define the default and maximum write buffer queue for network operations (256 KB in this example)
  • net.ipv4.ip_local_port_range tells the kernel the port ranges that will be used for outbound connections.
  • kernel.sem has four parameters:
    1. SEMMSL - semaphores per array
    2. SEMMNS - max semaphores system-wide (SEMMNI*SEMMSL)
    3. SEMOPM - max operations per semop call
    4. SEMMNI - max number of semaphore arrays

To check your current semaphores configuration, you can run cat /proc/sys/kernel/sem or ipcs -ls. On my machine, after the modifications on sysctl.conf, these commands output:

# cat /proc/sys/kernel/sem
250 32000 100 128

# ipcs -ls

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767

(I really don’t know if these are enough or too much, but I’ll keep you posted.)

For a better understanding of these kernel-tweaking settings, I’d recommend these resources:

Step Eight

Add these lines to /etc/security/limits.conf, letting the oracle user use more resources than the defaults allowed. You may notice that all these values are a power of 2 minus one. When soft limits are exceeded, you’ll get a warning; the hard limits can’t be exceeded in any situation: you’ll get an error. I’m not completely sure, but I think these limits apply to each session/login (and since Oracle doesn’t exactly log in to the machine, my best guess is these limits apply per instance running).

oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535

Step Nine

Make sure the limits.conf is being interpreted as the oracle user logs in by adding these lines to /etc/pam.d/login. You will want to make sure that is actually happening, since the defaults are way lower and you may get all sorts of problems.

session required /lib/security/pam_limits.so
session required pam_limits.so

Step Ten

Unpack and prepare the installation.

# cd /path/to/zipfile
# unzip linux_11gR1b5_database.zip

(And wait… wait a bit more… go get a cup of coffee…)

After your second cup of coffee, you should have a multi-gigabyte set of files; this is our installer.

# chown -R oracle:oinstall database
# chown -R oracle:oinstall /u01/app/oracle

Step Eleven

Fire up the installer as the oracle user itself. This is what you will probably see on the output window:

# su - oracle
$ cd /path/to/extracted/zip/file
$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 80 MB. Actual 58633 MB Passed
Checking swap space: must be greater than 150 MB. Actual 2900 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2007-07-11_04-38-56PM. Please wait ...
Oracle Universal Installer, Version 11.1.0.2.0 Production
Copyright (C) 1999, 2007, Oracle. All rights reserved.

ulimit: 1: Illegal option -u
ulimit: 1: Illegal option -u
rpm: To install rpm packages on Debian systems, use alien. See README.Debian.
error: cannot open Packages index using db3 - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
rpm: To install rpm packages on Debian systems, use alien. See README.Debian.
error: cannot open Packages index using db3 - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm

Dienstag, 29. April 2008

Linux - Debian - Etch - XServer

neu konfigurieren des x-servers

dpkg-reconfigure xserver-xorg

Linux - Debian - Etch - Partitionierung

Ein mögliches Partitionierungsszenario für Debian-Linux:

Auf der Festplatte werden zwei Partitionen angelegt:

/boot ... für die Kernel-Dateien und Initrd-Images

Der restliche Bereich wird als *LVM-Partition* mit Typ 8e, "Linux LVM" angelegt.
Die restlichen Partitionen werden dann innerhalb der LVM-Partition angelegt. Dies
hat den zusätzlichen Vorteil, daß man von der recht geringen möglichen Anzahl
primärer Partitionen unabhängig ist:

Root (200 - 500MB, je nach Anzahl installierter Kernel)
Swap (2facher - 4facher Hauptspeicher)
/usr (200MB - 6 GB, je nach installierter Software)
/usr/local (optional, für Software, die nicht über das Paketmanagement der Distribution installiert wird)
/var (200MB - mehrere GB je nach Nutzung (s.o.))
/tmp (200MB - 1GB, bzw. DVD-Größe)
/home oder /srv (oder /var) teilen sich den Rest, je nach eingesetzten Diensten
bzw. je nach Ausrichtung des Systems.

Samstag, 26. April 2008

Linux - Debian - Etch - Oracle XE - Bugfixes

Fehlermeldung:
Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=12519)(ERROR_STACK=(ERROR=(CODE=12519)(EMFI=4))))

[...] If you run a process that opens and closes connections very fast, the Oracle 10g XE listener fails with the shown error. To fix this problem, simple change the number of processes in the SPFILE to a large number (see example below). [...]

1.Schritt: einloggen in sqlplus als sysdba
sqlplus / as sysdba

2.Schritt: anpassen der Anzahl der Prozesse
ALTER SYSTEM SET PROCESSES=250 SCOPE=SPFILE


3.Schritt: Datenbank neu starten
/etc/init.d/oracle-xe restart


Fehlermeldung:
ORA-01033 ORACLE initialization or shutdown in progress
und
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [],

1.Schritt: einloggen mit user oracle in sqlplus als sysdba
su oracle
sqlplus / as sysdba

2.Schritt: auf der sql-konsole datenbank-recovery durchführen
SQL> recover database

3.Schritt: sqlplus verlassen und nochmals einloggen und db neustarten
SQL> shutdown
SQL> startup

Sonntag, 9. März 2008

Linux - Debian - Etch - Subversion mit Apache2

1.Schritt: SSH-Packages installieren
apt-get update
apt-get install ssh

2.Schritt: Apache2-Packages installieren
apt-get install apache2

3.Schritt: Subversion-Packages installieren
apt-get update
apt-get install subversion
apt-get install libapache2-svn
apt-get install subversion-tools

4.Schritt: Erstellen der SVN-Repositories
mkdir /home/svn
mkdir /home/svn/repositories

svnadmin create --fs-type fsfs /home/svn/repositories/myproject1
svnadmin create --fs-type fsfs /home/svn/repositories/myproject2
...

5.Schritt: Benutzerrechte der Repositories anpassen
chown -R www-data:www-data /home/svn/*
chmod -R 770 /home/svn/*

6.Schritt: Sicherstellen, dass svn unter apache bereits läuft
a2enmod dav
a2enmod dav_svn

7.Schritt: SVN-Benutzer erstellen
htpasswd -c /etc/apache2/svn_myproject1.passwd usera
--> ACHTUNG!!! -c löscht das passwd-file, falls bereits vorhanden
...also nur beim ersten mal verwenden!
htpasswd /etc/apache2/svn_myproject1.passwd userb

htpasswd -c /etc/apache2/svn_myproject2.passwd usera
--> ACHTUNG!!! -c löscht das passwd-file, falls bereits vorhanden...also nur beim ersten mal verwenden!
htpasswd /etc/apache2/svn_myproject2.passwd userd

...

8.Schritt: Erzeugen neuer Webfolder für SVN
einfügen der folgenden Codezeilen in: /etc/apache2/mods-available/dav_svn.conf
<Location /myproject1>
DAV svn
SVNPath /home/svn/repositories/myproject1
AuthType Basic
AuthName "Subversion Repository Project1"
AuthUserFile /etc/apache2/svn_myproject1.passwd
Require valid-user
# SSLRequireSSL <-- kann bei bedarf einkommentiert werden wenn SSL installiert ist </Location>

<Location /myproject2>
DAV svn
SVNPath /home/svn/repositories/myproject2
AuthType Basic
AuthName "Subversion Repository Project2"
AuthUserFile /etc/apache2/svn_myproject2.passwd
Require valid-user
# SSLRequireSSL <-- kann bei bedarf einkommentiert werden wenn SSL installiert ist </Location>

9.Schritt: Apache neu starten
/etc/init.d/apache2 restart
testen unter http:///myproject1

10. SSL hinzufügen
apt-get install openssl ssl-cert

11. Zertifikat generieren
openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
-> im Zertifikatserstellungsdialog die gewünschten Infos eintragen

12. Berechtigungen für Zertifikat ändern
chmod 600 /etc/apache2/apache.pem

13. SSL in der config aktivieren
editieren von /etc/apache2/mods-available/dav_svn.conf und einkommentieren von:
SSLRequireSSL

14.Schritt: neue Seite für SSL hinzufügen
cd /etc/apache2/sites-available/
cp default ssl
a2ensite ssl
a2enmod ssl

editieren von /etc/apache2/sites-available/ssl

ändern auf:
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/apache.pem
...
</VirtualHost>

15.Schritt: Apache neustarten
/etc/init.d/apache2 restart
testen unter https:///myproject1_site

Samstag, 8. März 2008

Linux - Debian - Etch - Oracle XE - Import/Export

umsetzen des character set vor import/export:
set NLS_LANG=GERMAN_GERMANY.WE8ISO8859P1

Linux - Debian - Etch - Oracle XE - Installation

Voraussetzungen:
Man muss darauf achten, dass die SWAP-Partition mindestens 1GB gross ist, sonst
wird die Installation abgebrochen.

1.Schritt: apt-sources erweitern
ee /etc/apt/sources.list
deb http://oss.oracle.com/debian unstable main non-free

2.Schritt: Oracle GPG-Key hinzufügen
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle
apt-key add RPM-GPG-KEY-oracle
apt-get update

3.Schritt: Installation

standard-DB:

aptitude install oracle-xe oracle-xe-client

universelle-DB:
aptitude install oracle-xe-universal oracle-xe-client

/etc/init.d/oracle-xe configure

weiteres siehe unter:
- Globale Parameter
- Oracle XE Bugfixes

Linux - Debian - Etch - Netzwerk

Festlegen einer statischen IP-Adresse

1.Schritt: Feststellen der aktuellen Einstellungen
mittels ifconfig erhält man den aktuellen netzwerk-adress-status
zb.
eth2 Protokoll:Ethernet Hardware Adresse 00:0C:29:F2:89:E9
inet Adresse:192.168.0.13 Bcast:192.168.0.255 Maske:255.255.255.0
inet6 Adresse: fe80::20c:29ff:fef2:89e9/64 Gültigkeitsbereich:Verbindung
-> in diesem Fall laufen alle Verbindungen über eth2

2.Schritt: editieren der netzwerkeinstellungen
ee /etc/network/interfaces

-> Einstellungen für Betrieb in VmWare
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

auto eth2
iface eth2 inet static
address 192.168.0.91
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

3.Schritt: neustarten der konfiguration
/etc/init.d/networking restart


Ändern des Hostnamens
  1. In der /etc/hostname den Namen ändern.
  2. Sofern in der /etc/hosts auch entsprechende Einträge vorhanden sind, müssen diese ebenfalls abgeändert werden.
  3. Als letzten Schritt noch den Befehl "hostname [name]" absetzen.
  4. Reboot

Freitag, 7. März 2008

Linux - Debian - Etch - Mount

Installation notwendiger packages für smbmount:
apt-get install smbclient
apt-get install smbfs


Windows-Share kurzfristig mounten:
Variante 1: mount -t cifs -o user=fileshare-benutzername //ip-adresse/fileshare /mnt/mountordner
Variante 2: smbmount //ip-adresse/fileshare /mnt/mountordner -o username=fileshare-benutzername

Windows-Share automatisch mounten:
1.Schritt: erzeugen einer .smbcredentials im home-verzeichnis eines users
ee /home/username/.smbcredentials

username=fileshare-benutzername
password=kennwort

2.Schritt: hinzufügen des mount-befehls in die datei fstab
ee /etc/fstab

//ip-adresse/fileshare /mnt/mountordner smbfs defaults,users,credentials=/home/username/.smbcredentials,uid=1000,gid=1000,dmask=770,fmask=770 0 0

Freitag, 29. Februar 2008

Linux - Debian - Etch/Lenny - Alias

Nützliche Aliase:

editieren der globalen einstellungen:
vim /etc/bash.bashrc

hinzufügen von:
alias ..="cd .."
alias ...="cd ../.."
alias cd..="cd .."
alias dir="ls -l -a --color=auto"
alias ll="ls -l -a --color=auto"

Achtung: folgende Einstellung ab Debian Squeeze (6.0.5) nicht
mehr verwenden, das führt dazu, dass man sich nicht mehr einloggen kann...
einstellungen sollen immer verwendet werden:
öffnen der Datei "/etc/profile"
am Ende der Datei folgende Zeile hinzufügen:
. /etc/bash.bashrc