Linux/Tipps/Fedora

Aus VivaLV
< Linux‎ | Tipps
Zur Navigation springen Zur Suche springen

Kernel-Source installieren (FC1)

  • Kernel-Source-RPM installieren
  • in /usr/src/linux-2.4/Makefile "custom" am Ende von EXTRAVERSION entfernen
cp /boot/config-[KERNELNAME] /usr/src/linux-2.4/.config
  • in /boot/grub/menu.lst default auf 0 setzen

Kernel-Source compilieren (FC1)

Dies sollte man als normaler Benutzer machen können. Falls nicht:

su -
chown -R Benutzer.Gruppe /usr/src/linux-2.4

Compilieren:

cd /usr/src/linux-2.4
make mrproper
make oldconfig
make dep

Kernel-Source installieren und compilieren (FC2/FC3)

su -
cd /usr/src/redhat
chmod 777 BUILD
chmod 777 RPMS/i386
chmod 777 RPMS/i586
chmod 777 SOURCES
chmod 777 SPECS
chmod 777 SRPMS
chmod 777 /usr/src

Als normaler Benutzer:

  • Kernel-Source-RPM downloaden
rpm -ivh Kernel-Source-RPM
rpmbuild -bp --target=noarch  /usr/src/redhat/SPECS/kernel-2.6.spec
cd /usr/src
ln -s redhat/BUILD/kernel-2.6.10/linux-2.6.10 linux
ln -s redhat/BUILD/kernel-2.6.10/linux-2.6.10 linux-2.6.10
cd linux
mv .config .config.orig
cp /boot/config-[KERNELNAME] .config
make mrproper
make oldconfig
make

Power-Button soll den Rechner ordentlich runterfahren, anstatt hart auszuschalten

Dafür ist es zunächst einmal notwendig, dass "/proc/acpi" existiert. Falls nicht, hat Fedora nicht erkannt, dass der Rechner ACPI-fähig ist. In diesem Fall hilft evtl. ein acpi=on als Bootparameter in "/boot/grub/grub.conf". Ist das der Fall, müsste auch der acpid laufen (zu prüfen mit "ps -afe | grep acpid"). Falls nicht, kann man dies erreichen mit "chkconfig acpid on" und "service acpid start".

In "/etc/acpi/events/power.conf" muss dann folgendes stehen:

event=button/power.*
action=/sbin/shutdown -h now

Mailserver einrichten (FC5)

Angaben in <> müssen entsprechend ersetzt werden.

Mail für root umleiten
su -
  • /etc/aliases:
root:    <local user>
newaliases
exit
fetchmail
touch $MAIL
su -
chmod 777 /var/spool/mail
yum install fetchmail
  • /etc/fetchmailrc:
set postmaster "<local user>"
set no bouncemail
set no spambounce
set properties ""
set daemon 300
poll <POP3 server> with proto POP3
      user '<POP3 user>' there with password '<POP3 password>' is '<local user>' here
chmod 600 /etc/fetchmailrc
  • /etc/rc.local:
fetchmail -f /etc/fetchmailrc --syslog
fetchmail -f /etc/fetchmailrc --syslog
exit
uwimap mit SSL
su -
yum install openssl xinetd uw-imap
  • /etc/c-client.cf:
set mail-subdirectory mail
cd /etc/pki/tls/certs
openssl req -new -x509 -nodes -out imapd.pem -keyout imapd.pem -days 3650
  • Common Name = IP oder DNS-Name
  • /etc/xinetd.d/imap:
disable = no
  • /etc/xinetd.d/imaps:
disable = no
service xinetd restart
exit
Postfix statt Sendmail
su -
yum intall postfix
alternatives --config mta
  • Postfix auswählen und beenden
chkconfig sendmail off
chkconfig postfix on
service sendmail stop
service postfix start
exit
Postfix mit TLS
su -
yum install postfix
  • Server-Zertifikate erstellen (siehe entsprechender Punkt auf dieser Seite)
cd /etc/pki/tls/misc
cp newcert.pem /etc/postfix/
cp newkey.pem /etc/postfix/
  • Ändern /etc/postfix/main.cf:
myhostname = <hostname>.localhost.localdomain
mydomain = localhost.localdomain
myorigin = <maildomain.de>
inet_interfaces = all
  • Hinzufügen zu /etc/postfix/main.cf:
relayhost = <relay host>
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtp_sasl_auth_enable = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_use_tls = yes
smtpd_sasl_local_domain =
#smtpd_tls_auth_only = yes
smtpd_tls_key_file = /etc/postfix/newkey.pem
smtpd_tls_cert_file = /etc/postfix/newcert.pem
smtpd_tls_CAfile = /etc/pki/tls/cert.pem
smtpd_tls_loglevel = 1
#smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtp_use_tls = no
  • /usr/lib/sasl2/smtpd.conf:
mech_list: PLAIN LOGIN
chkconfig saslauthd on
service saslauthd start
postfix reload
exit
Postfix SMTP-Authentication zum Provider
su -
  • /etc/postfix/sasl_passwd:
<relay host> <SMTP user>:<SMTP password>
chmod 600 /etc/postfix/sasl_passwd
postmap hash:/etc/postfix/sasl_passwd
  • /etc/postfix/main.cf:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
postfix reload
exit
Procmail/Spamassassin
mkdir ~/procmail
  • ~/procmail/rc.spam:
:0 E fw: spamassassin.lock
| /usr/bin/spamassassin

:0:
* ^X-Spam-Flag: YES
mail/Spam

:0:
$DEFAULT
su -
apt-get install procmail spamassassin
mkdir /etc/procmailrcs
  • /etc/procmailrcs/<user>:
SHELL=/bin/sh
PMDIR=$HOME/procmail
LOGFILE=$PMDIR/pmlog
LOG="
"
#VERBOSE=YES
MAILDIR=$MAIL
INCLUDERC=$PMDIR/rc.spam
chown <user>.<group> /etc/procmailrcs/<user>
chmod 600 /etc/procmailrcs/<user>
  • /etc/postfix/main.cf:
mailbox_command = /bin/nice /usr/bin/procmail -t -m /etc/procmailrcs/$USER $SENDER $RECIPIENT
postfix reload
exit
Squirrelmail
su -
yum install squirrelmail
ln -s /usr/share/squirrelmail /var/www/html/squirrelmail
exit
POP before SMTP (SMTP after POP)
su -
apt-get install perl-File-Tail perl-Net-Netmask perl-TimeDate
  • pop-before-smtp-conf.pl: Zeilen mit $grace und $file_tail einkommentieren und anpassen
cp pop-before-smtp-conf.pl /etc/
cp pop-before-smtp.init /etc/init.d/pop-before-smtp
cp pop-before-smtp /usr/sbin/

Test (abbrechen mit CTRL-C):

pop-before-smtp --debug --reprocess

Wenn Fehlermeldungen mit "Net::Netmask::imaxblock" kommen, ist evtl. der mynetworks Parameter in Postfix nicht ganz OK oder nicht gesetzt. Dies kann mit "postconf mynetworks" geprüft werden. Sowas z.B. kann pop-before-smtp nicht verarbeiten:

mynetworks = 127.0.0.0/8 192.168.0.0/24 [::1]/128

In diesem Fall wird in "/etc/postfix/main.cf" eingetragen:

mynetworks = 127.0.0.0/8 192.168.0.0/24

Anschließend "postfix reload".


/etc/init.d/pop-before-smtp start
chkconfig pop-before-smtp on
ls -la /etc/postfix/pop-before-smtp* (pop-before-smtp.db muss es geben)
  • vi /etc/postfix/main.cf:
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,check_client_access  hash:/etc/postfix/pop-before-smtp,reject_unauth_destination
postfix reload
exit
Sendmail statt Postfix (alt)
su -
cd /etc/mail
cp sendmail.mc sendmail.mc.orig
cp sendmail.cf sendmail.cf.orig
  • sendmail.mc:
17c17,18
< define(`SMART_HOST',`smtp.your.provider')
---
> dnl define(`SMART_HOST',`smtp.your.provider')
> define(`SMART_HOST',`<SMTP server>')
30c31,34
< define(`confAUTH_OPTIONS', `A')dnl
---
> dnl define(`confAUTH_OPTIONS', `A')dnl
> define(`confAUTH_OPTIONS', `Ay')dnl
> TRUST_AUTH_MECH(`LOGIN PLAIN')dnl
> define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl
84c88,89
< DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
---
> dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
> DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl
140a146,147
> FEATURE(`authinfo',`hash /etc/mail/authinfo') dnl
> define(`confLOG_LEVEL',`13')
make
  • authinfo:
AuthInfo:<SMTP server> "U:<SMTP user>" "P:<SMTP password>"
makemap hash authinfo.db < authinfo
service sendmail restart
exit

Hostname ändern

  • in /etc/hosts bei 127.0.0.1 eintragen
  • in /etc/sysconfig/network-scripts/ifcfg-eth0 als DHCP_HOSTNAME eintragen
  • in /etc/sysconfig/network als HOSTNAME eintragen

Mondoarchive unter Fedora Core 3

Man kann die RPMs (afio, buffer, mindi, mondo) von Fedora Core 2 verwenden.

Eine unter Fedora Core 3 erstellte Mondoarchive Backup-DVD bricht beim Booten ab mit der Meldung, dass "mount" und "grep" nicht gefunden wurden. Dies kann man verhindern, indem man vor Erstellen des Backups folgende Zeilen in "/etc/mindi/deplist.txt" hinzufügt:

/lib/ld-linux.so.2
/lib/ld-2.3.4.so

Außerdem sollte man dafür sorgen, dass die Swap-Partition in /etc/fstab nicht per Label, sondern direkt (/dev/hdxy) angesprochen wird, da sonst beim Restore die Swap-Partition manuell angelegt werden muss.

Server-Zertifikate erstellen

su -
yum install openssl openssl-devel
cd /etc/pki/tls
  • openssl.cnf:
default_days    = 3650

Optional: Zeilen mit *_default auf eigene Werte ändern, um später Tipparbeit zu sparen.

cd misc/
cp CA CA_nodes
  • CA_nodes:

Search for "# create a certificate" and add "-nodes" to the line below that begins with "$REQ". When you are done with this search for "# create a certificate request" and do the same again.

./CA_nodes -newca
./CA_nodes -newreq
./CA_nodes -sign
chmod 600 newkey.pem

Apache2 mit SSL

su -
yum install mod_ssl
  • Server-Zertifikate erstellen (siehe entsprechender Punkt auf dieser Seite)
cd /etc/pki/tls/misc
mv /etc/pki/tls/certs/localhost.crt /etc/pki/tls/certs/localhost.crt.orig
cp newcert.pem /etc/pki/tls/certs/localhost.crt
mv /etc/pki/tls/private/localhost.key /etc/pki/tls/private/localhost.key.orig
cp newkey.pem /etc/pki/tls/private/localhost.key
  • /etc/httpd/conf.d/ssl.conf: DocumentRoot und ServerName einkommentieren/editieren
service httpd restart

Apache2 mit Basic Authentication

su -
htpasswd -c /etc/httpd/.htpasswd <user>
  • in /etc/httpd/conf/httpd.conf bzw. /etc/httpd/conf.d/ssl.conf folgendes eintragen:
<Directory "/var/www/html/<directory>">
AllowOverride None
order allow,deny
allow from all
AuthType Basic
require user <user>
AuthUserFile /etc/httpd/.htpasswd
AuthName "Restricted"
</Directory>
service httpd restart

rinetd (Portumleitungsdämon) für Fedora

wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
tar -xzvf rinetd.tar.gz
cd rinetd
make
su -
cp rinetd /usr/sbin/
  • /etc/rinetd.conf:
0.0.0.0 <source port> <destination address> <destination port>
/usr/sbin/rinetd
  • /etc/rc.local:

/usr/sbin/rinetd

exit

Mailserver und Webserver mit niedriger Priorität

su -
  • Ändern in /etc/rc.local:
nice fetchmail -f /etc/fetchmailrc --syslog
killall fetchmail
nice fetchmail -f /etc/fetchmailrc --syslog
  • Ändern in /etc/init.d/xinetd:
daemon nice $prog -stayalive -pidfile /var/run/xinetd.pid "$EXTRAOPTIONS"
service xinetd restart
  • Ändern in /etc/init.d/postfix:
nice /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure
service postfix restart
  • Ändern in /etc/init.d/httpd:
LANG=$HTTPD_LANG daemon nice $httpd $OPTIONS
service httpd restart
exit

MythTV SRPMs von atrpms compilieren

su -
  • /etc/rpm/macros:
%_varlibdir /var/lib
%_varcachedir /var/cache
%_initdir /etc/rc.d/init.d
%_sysconfigdir /etc/sysconfig
%_logrotatedir /etc/logrotate.d
%_logdir /var/log
cd /usr/src/redhat
chmod 777 BUILD
chmod 777 RPMS/i386
chmod 777 RPMS/i586
chmod 777 SOURCES
chmod 777 SPECS
chmod 777 SRPMS
exit

Als normaler Benutzer:

rpm -ivh <Name des SRPMs>
rpmbuild -bb --define 'atrelease() %1.rhfc3.at' --define 'eversion=0.19' --define '_without_debug=1' /usr/src/redhat/SPECS/mythtv.spec

Die Binaries in den so erzeugten RPMs (in /usr/src/redhat/RPMS/i386) sind fast doppelt so groß, wie die originalen von atrpms. Warum das so ist, weiß ich noch nicht. Um eigene Patches hinzuzufügen, müssen diese nach /usr/src/redhat/SOURCES gelegt und an 2 Stellen im .spec File (wie die bereits vorhandenen) eingetragen werden (PatchX und patchX).

Microsoft Sidewinder Gamepad (am Gameport) und xmame

In /etc/rc.local oder modprobe.conf folgende Kernel-Module laden:

  • joydev
  • sidewinder

Zur Kommandozeile von xmame hinzufügen:

-jt 1 -jdev /dev/input/js0

Während ein Spiel geladen ist, die TAB-Taste drücken und die Buttons des Gamepads global (Input general, Player 1 Controls) konfigurieren. Das Steuerkreuz und die A/B/C Buttons funktionieren bereits, man sollte aber noch Buttons für Credit, Player 1 Start und Exit definieren. Eine xmame-Taste kann mehrfach belegt werden (also z.B. eine Taste der Tastatur und ein Button des Gamepads), indem man bei der entsprechenden Taste RETURN drückt, dann die zu belegende Taste, dann warten und dann nochmal von vorne. Eine vorhandene Belegung löscht man mit RETURN und dann ESC.