CentOS

Setup a simple host-to-host VPN with openvpn

A VPN between two hosts is pretty easy to setup. You just need to install openvpn on server and client, generate a static key (just keep in mind that anybody who gets access to this key can compromise your vpn) which needs to be copied to the client (if generated on the server) and put a small configuration in place on client and server.

Install openvpn on server and client with

Creating a swap file

From time to time you might have the need to create some extra swap space. Instead of creating a separate partition (maybe there is no more free space on the disk) you can create a swap file. This can also easily be removed after it is not needed anymore.

In this example we will add a swap file of 64 MB which 65536 * 1024k blocks.

autofsck behaviour after unclean shutdown

If a system goes down without proper shutdown it will tell you so during reboot and asks if you want to check the filesystem integrity. Unfortunately the prompt will stay there forever if you do not enter anything. To avoid unnecessary dowwntime due to system waiting for input the behaviour can be configured in the file /etc/sysconfig/autofsck (create it if it does not exist):

Installing dependencies when installing a downloaded rpm

If you download an RPM its installation instructions (if there are any) will tell you to install the packge via

rpm -ivh rpm-file

This will work if the RPM has no further dependencies. But if there are some dependencies RPM will complain about missing libraries. Now you have to determine which package(s) you need to install to get these libraries.

Automatically login with Gnome

Depending on the Gnome version there are two ways to login automatically. You need to edit /etc/gdm/custom.conf and append the following section:

  • This is working with Gnome version 2.22 and higher (eg. Fedora 9/10)

    [daemon]
    TimedLoginEnable=true
    TimedLogin=user
    TimedLoginDelay=0

Saving iptables rules in CentOS

Within CentOS saving firewall rules created with iptables is easy - just enter

/sbin/service iptables save

Keep CentOS up-to-date automatically

CentOS can automatically be updated with latest fixes. With the following settings yum updates the system to latest level even if you are away for any reason. This might prevent a hack due to unsecure packages installed on your system.
But you need to be aware that this might also break your system while you are away! So you need to consider if uptime or security is your focus.

Running a CentOS server with Lighttpd, PHP, MySQL, Exim with virtual users, Dovecot, and Squirrelmail

This is a tutorial how to setup a server for mail and web.

It is based on the following components:
OS: Linux CentOS 5.2
HTTP Server: Lighttpd 1.4.19, PHP 5.1.6
Database: MySQL 5.045
Mailserver: Exim 4.63 with Vexim 2.2.1, Spamassassin 3.2.4, Clamav 0.94
IMAP/Pop3 Server: 1.07