Use sysctl to change the hostname
use sysctl to change the variable kernel.hostname:
Use:
sysctl kernel.hostname
to read the current hostname, and
sysctl kernel.hostname=NEW_HOSTNAME
to change it. To survive a reboot of course, put it here in /etc/sysctl.conf:
kernel.domainname = NEW HOSTNAME
Fix locale error when installing new software
dpkg-reconfigure locales
and choose these locales
[*] en_US.UTF-8 UTF-8
[*] en_ZA ISO-8859-1
[*] en_ZA.UTF-8 UTF-8
and then edit the following file and add the content as shown below:
vi /etc/default/locale
with this content
# File generated by update-locale
LANGUAGE = "en_US", LC_ALL = "en_US.UTF-8" LANG = "en_US.UTF-8"
Add non-free sources in apt sources for things like figlet motd stuff
csdeb ~ # grep non /etc/apt/sources.list
deb http://ftp.us.debian.org/debian squeeze non-free
deb http://ftp.sun.ac.za/ftp/debian/ squeeze non-free
Install some basic proggies
aptitude install ntpdate rsync screen vim grub2 sudo
Make Prettiness
cat >>/etc/motd <<EOF
`TERM=linux setterm -default -foreground green`
On second thought, I like green better.
`TERM=linux setterm -default`
EOF
Turn syntax highlighting on
uncomment ;syntax on in /etc/vim/vimrc
Make vim default
Put alias vi=vim in .bashrc
Put History into /etc/bash.bashrc:
export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
Change PS1 to ubuntu style in /etc/bash.bashrc
(Cap H gives fqdn)
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\H\[\033[01;34m\] \W \$\[\033[00m\] '
To install Grub 2 on both mirrored drives (in raid 1 configuration) on Debian 6 Squeeze, type this:
grub-mkdevicemap
grub-install "(hd0)"
grub-install "(hd1)"
W: Possible missing firmware /lib/firmware/tigon/tg3_tso5.bin for module tg3
Add the “non-free” repository to the sources file
deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free
Update apt-get and install the “firmware-linux-nonfree” package.
apt-get update apt-get install firmware-linux-nonfree
Clone packages
host1:~# dpkg --get-selections > /tmp/dpkg.txt
host1:~# head /tmp/dpkg.txt
a2ps install
acpi install
acpi-support install
acpi-support-base install
acpid install
adduser install
adobe-flashplugin install
adobereader-enu install
akregator install
alien install
Transfer this (dpkg.txt) file to the target system (already installed as a minimal) and run:
host2:~# dpkg --set-selections < /tmp/dpkg.txt
host2:~# apt-get -u dselect-upgrade
Iptables
Note the sport for udp 53 for hostname lookups.
root:~# cat firewall
# Generated by iptables-save v1.4.2 on Mon Apr 9 14:46:46 2012
*filter
:INPUT DROP [1413:135327]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [6496:13896371]
:LOGGING - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p tcp -m tcp --dport 50022 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 21 -j ACCEPT
-A INPUT -p udp -m udp --sport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 25 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -m limit --limit 100/min --limit-burst 100 -j ACCEPT
-A INPUT -j LOGGING
-A LOGGING -j DROP
-A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables Packet Dropped: " --log-level 7
COMMIT
# Completed on Mon Apr 9 14:46:46 2012
Setting up network interfaces
Static:
root@mail:/etc/postfix# cat /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
auto eth0
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
gateway 192.168.0.1
post-up /etc/network/if-up.d/zapop_IPTABLES.sh
post-up /etc/network/if-up.d/zapop_ROUTING.sh
auto eth0:0
iface eth0:0 inet static
address 10.100.0.27
network 10.100.0.0
netmask 255.255.0.0
DHCP:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
Check package versions
roo:~# aptitude search apt-show
p apt-show-source - Shows source-package information
p apt-show-versions - lists available package versions with distribution
roo:~# apt-show-versions | grep ldap
ldap-utils/squeeze upgradeable from 2.4.23-7 to 2.4.23-7.2
libaprutil1-ldap/squeeze uptodate 1.3.9+dfsg-5
libldap-2.4-2/squeeze upgradeable from 2.4.23-7 to 2.4.23-7.2
libnss-ldap/squeeze uptodate 264-2.2
libpam-ldap/squeeze uptodate 184-8.5
sudo-ldap/squeeze uptodate 1.7.4p4-2.squeeze.2