Debian 6 setup and configuration as a basic server

Home » Computer Articles » Linux » Debian 6 setup and configuration as a basic server
November 28, 2012 Linux No Comments

Debian 6

Download ISO from Debian, click here

 

Debian 6 setup and configuration

Do a default install, or change to your requirements.

 

Update server

# apt-get update

# apt-get upgrade

Install sudo

# apt-get install sudo

 

Static IP address setup

Edit the nano /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.101
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

 

 

Firewall Setup

Create a rules file.

# touch /etc/iptables.rules

# chmod +x /etc/iptables.rules

#  nano /etc/network/interfaces

add this to bottom of file: pre-up iptables-restore < /etc/iptables.rules

# touch /home/username/iptables.rules
# chmod +x /home/username/iptables.rules 
Add this information to your /home/username/iptables.rules file.
# Reset all (block all) and start from zero
iptables -F INPUT
iptables -F FORWARD
iptables -F OUTPUT
 
# Reject incoming traffic
iptables -P INPUT DROP
 
# Reject forwarded traffic
iptables -P FORWARD DROP
# Accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT
iptables -A FORWARD -o lo -j ACCEPT
# Accept all connections started by us
# (this can be dangerous if you install shitty stuff on your server)
iptables -P OUTPUT ACCEPT
 
# Accept data related to our requests
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED
  
# http port can be setup with limits or without - here's the example with:
# (not used right now so commented out - 2 lines, should be in 2):
# iptables -A INPUT -p tcp --dport 80 -m state --state NEW
# -m limit --limit 50/minute --limit-burst 5 -j ACCEPT
# Open ports related to our services (http, https, ssh, etc)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT # Example: ssh port
iptables -A INPUT -p tcp --dport 80 -j ACCEPT # Example: http port
#Use either a policy of DROP or DROP the rest
iptables -A INPUT -p tcp --dport 80 -j DROP
# After executing and checking, to save rules, perform (as su) command:
# iptables-save > /etc/iptables.rules
You will execute /home/username/iptables.rules and you can still connect to the server then run iptables-save > /etc/iptables.rules to save rules. So after a restart your firewall setting will be set.
Information from:

http://dev.mensfeld.pl/2012/02/simplifying-iptables-management-on-a-debian-squeeze-server/

 

Problems:

I keep getting this error every time I wanted to format some drives.

# mkfs.ext3 -j /dev/sdb1

mke2fs 1.41.12 (17-May-2010)
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

 

# mdadm --detail /dev/md127

# mdadm --stop /dev/md127

# mdadm --remove /dev/md127

 

This removes mdadm

# apt-get purge mdadm

 

Now I could finally run my format command.

Now this was a new installation, So after some searches I found an article that fixed the problem. Seems like the installation automatically created a raid. So this what I had to do to fix it.

This is the website that helped me out.

http://www.overclockers.com/forums/showthread.php?t=667317

 

 

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *