The Perfect Server - Mandriva 2007 Spring Free - Page 4

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2007-05-22 17:16. ::

4 Adjust /etc/hosts

Next we edit /etc/hosts. Make it look like this:

vi /etc/hosts

127.0.0.1               localhost.localdomain localhost
192.168.0.100           server1.example.com server1

 

5 Configure Additional IP Addresses

(This step is totally optional and is needed only if you want to add more IP addresses to your network interface eth0!)

Let's assume our network interface is eth0. Then there is a file /etc/sysconfig/network-scripts/ifcfg-eth0 which looks like this:

cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no
DNS1=145.253.2.75
DNS2=193.174.32.18
RESOLV_MODS=yes
IPV6INIT=no
IPV6TO4INIT=no

Now we want to create the virtual interface eth0:0 with the IP address 192.168.0.101. All we have to do is to create the file /etc/sysconfig/network-scripts/ifcfg-eth0:0 which looks like this:

vi /etc/sysconfig/network-scripts/ifcfg-eth0:0

DEVICE=eth0:0
BOOTPROTO=static
IPADDR=192.168.0.101
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no
MS_DNS1=145.253.2.75
MS_DNS2=193.174.32.18
RESOLV_MODS=yes
IPV6INIT=no
IPV6TO4INIT=no

Afterwards we have to restart the network:

/etc/init.d/network restart

You might also want to adjust /etc/hosts after you have added new IP addresses, although this is not necessary.

Now let's run

ifconfig

to see if our new IP address is working. The output should look like this:

[root@server1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:EC:09:F4
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feec:9f4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:356 errors:0 dropped:0 overruns:0 frame:0
          TX packets:319 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32160 (31.4 KiB)  TX bytes:64191 (62.6 KiB)
          Interrupt:17 Base address:0x1400

eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:EC:09:F4
          inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:17 Base address:0x1400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:82 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6508 (6.3 KiB)  TX bytes:6508 (6.3 KiB)

 

6 Setting The Hostname

(This step is also optional.)

This is not necessary if you have set the correct hostname during the installation. You can check the current hostname with the commands

hostname
hostname -f

Both commands should show server1.example.com.

If the output shows a wrong hostname, you can set the correct one like this:

echo server1.example.com > /etc/hostname
/bin/hostname -F /etc/hostname

 

7 Configure urpmi

You can use the wizard on http://easyurpmi.zarb.org/ to find out how to configure urpmi so that urpmi uses online package repositories:

For me the wizard gave back these commands that I run on the command line:

urpmi.addmedia main ftp://ftp.tu-chemnitz.de/pub/linux/mandrakelinux/official/2007.1/i586/media/main/release with media_info/hdlist.cz

urpmi.addmedia --update main_updates ftp://ftp.tu-chemnitz.de/pub/linux/mandrakelinux/official/2007.1/i586/media/main/updates with media_info/hdlist.cz

urpmi.addmedia contrib ftp://ftp.tu-chemnitz.de/pub/linux/mandrakelinux/official/2007.1/i586/media/contrib/release with media_info/hdlist.cz

urpmi.addmedia --update contrib_updates ftp://ftp.tu-chemnitz.de/pub/linux/mandrakelinux/official/2007.1/i586/media/contrib/updates with media_info/hdlist.cz

Now we create a script /etc/cron.daily/software_update that will autmatically be run by cron daily and looks for and installs the latest software updates on your Mandriva 2007 Spring system. The script looks like this:

vi /etc/cron.daily/software_update

#!/bin/bash
urpmi.update updates
urpmi --auto --update --auto-select

Make the script executable:

chmod 755 /etc/cron.daily/software_update

 

8 Install Some Packages

Now we install a few packages that are needed later on:

urpmi fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp flex libxorg-x11-devel gcc gcc-c++

 

9 Quota

To install the quota package, run

urpmi quota

Edit /etc/fstab to look like this (I added ,usrquota,grpquota to the partition with the mount point /):

vi /etc/fstab

/dev/sda6 / ext3 defaults,usrquota,grpquota 1 1
/dev/sda1 /boot ext3 defaults 1 2
/dev/hdc /media/cdrom auto umask=0,users,iocharset=utf8,noauto,ro,exec 0 0
none /media/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=utf8,sync 0 0
none /proc proc defaults 0 0
/dev/sda5 swap swap defaults 0 0

Then run:

touch /aquota.user /aquota.group
chmod 600 /aquota.*
mount -o remount /
quotacheck -avugm
quotaon -avug

 

10 DNS Server

To install The BIND DNS server, run:

urpmi bind

Mandriva 2007 Spring's BIND is running chrooted by default, therefore we need to create a few symlinks so that ISPConfig (if you want to install it) can deal with it:

cd /var/lib/named/var
mkdir -p lib/named/var
cd lib/named/var
ln -s ../../../named/ named
ln -s ../../../run/ run

Then start BIND:

/etc/init.d/named start


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.