Ubuntu server 12.04

From Attie's Wiki
Jump to: navigation, search

Setup exFAT
Setup node.js
Setup network interfaces

Contents

Packages

As root, install the following (all are optional of course)...

# sort out 'sudo' (don't do this on a production server!)
echo "attie ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
 
# use bash you idiot
dpkg-reconfigure -plow dash
 
# Xterm (always useful with Xming)
apt-get install xterm x11-xserver-utils
 
# install SSH
apt-get install openssh-server
# configure SSH
sed -re 's/^#?( *GSSAPIAuthentication ).*$/\1 no/' -i /etc/ssh/ssh_config -i /etc/ssh/sshd_config
sed -re 's/^#?( *UsePAM ).*$/\1 yes/' -i /etc/ssh/ssh_config -i /etc/ssh/sshd_config
echo "auth required pam_listfile.so item=group sense=allow file=/etc/ssh/sshd.group.allow onerr=fail" >> /etc/pam.d/sshd
addgroup --system ssh-pwaccess
echo "ssh-pwaccess" >> /etc/ssh/sshd.group.allow
 
# install samba
apt-get install samba-common samba-common-bin
smbpasswd attie
 
# install libraries
apt-get install libncurses5-dev
 
# install man pages
apt-get install manpages-posix manpages-posix-dev
 
# c++ toolchain and libraries
apt-get install g++ g++-multilib libreadline6-dev
 
# install ctags, cscope & vim
apt-get install ctags cscope vim
 
# install 32-bit libs and headers (if on a 64-bit host)
apt-get install ia32-libs libc6-dev-i386
 
# install tools
apt-get install apt-file python-software-properties
apt-get install subversion git mercurial bzr tree minicom shed valgrind lzop screen uboot-mkimage ethtool htop p7zip-full
 
# install dos2unix & unix2dos
apt-get install tofrodos
ln -s /usr/bin/fromdos /usr/bin/dos2unix
ln -s /usr/bin/todos /usr/bin/unix2dos
 
# install nfs
apt-get install nfs-common
 
# remove AppArmor
/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils
 
# install NTP
apt-get install ntp ntpdate
 
# sort out the 'ohh.. did you mean this?'
dpkg -r command-not-found command-not-found-data
 
# if you have just copied a 'fresh' VM, you'll want to clean out the udev network rules
nano /etc/udev/rules.d/70-persistent-net.rules
 
# turn off the infuriating MOTD
sed -re 's/^([^#].*pam_motd.so)/#\1/' -i /etc/pam.d/login -i /etc/pam.d/sshd
 
# remove landscape
apt-get remove --purge landscape-common
 
# install kernel headers
apt-get install linux-headers-$(uname -r)
 
# install the java runtime environment and optional dev tools
apt-get install openjdk-7-jre openjdk-7-jdk
 
# turn off that stupid auto completion for 'mount'
chmod 000 /etc/bash_completion.d/mount

Tidy up with:

apt-get autoremove

Services

Management

apt-get install sysv-rc-conf

Reccomended

The marks are for recommended installations, you don't have to listen to them ;)

Server Development Package
X - RPC bind
X X Samba
X - Apache
X - * GitWeb
X - MySQL
X - DNS
X - DHCP
X - FTP
X - NFS
X - TFTP
X - DynDNS Client
X - APCupsd
X - Mail Archiver
X - GMail Backup

Other

User Setup

Run the following as your user, e.g: attie

# generate an SSH keypair
ssh-keygen
 
# make a 'Downloads' directory
mkdir ~/Downloads

Proxy Setup

cat >/etc/profile.d/proxy.sh <<"EOF"
export http_proxy=http://10.1.1.1:8080/
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
EOF
 
cat >>/etc/sudoers <<EOF
Defaults env_keep="http_proxy https_proxy ftp_proxy"
EOF

Set the Hostname

OLD_HOSTNAME=$(hostname)
echo "${NEW_HOSTNAME}" > /etc/hostname
hostname "${NEW_HOSTNAME}"
sed -re "s/${OLD_HOSTNAME}/${NEW_HOSTNAME}/g" -i /etc/hosts

SSH Won't Connect?

rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
/etc/init.d/ssh restart

Set the Time Zone

dpkg-reconfigure tzdata

Set the Time According to time.nist.gov

service ntp stop
ntpdate -s time.nist.gov
service ntp start

Using the Hardware Clock

Display RTC's Time

hwclock -r

Set the System Time to that of the RTC

hwclock -s

Set the RTC's time to that of the System

hwclock -w
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox