Skip to content

Instantly share code, notes, and snippets.

@dominicsayers
Last active December 27, 2015 18:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominicsayers/7369360 to your computer and use it in GitHub Desktop.
Save dominicsayers/7369360 to your computer and use it in GitHub Desktop.
Basic setup of Ubuntu server

This is my personal memo for setting up new Ubuntu servers in my environment. It may not be appropriate for your environment but feel free to use it as a starting point.

During setup

  1. Accept all defaults except as listed here.
  2. For the machine name use the full name including the local domain, e.g. new-server.local.domain
  3. Add a user for all build tasks, name is Build, username is build
  4. Do not encrypt the home directory.
  5. Do not use LVM
  6. Obviously you need to accept the suggested changes to the partition table.
  7. Install security updates automatically

After setup

In the console:

sudo su
passwd root
apt-get install ssh openssh-server

Now you can continue from a more comfortable SSH connection:

sudo pico /etc/network/interfaces

and add

auto eth0
iface eth0 inet static
        address 192.168.1.123
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.254
        dns-nameservers 192.168.1.6

(obviously substitute your actual intended static IP address for 192.168.1.123). Add this server to your DNS server.

sudo service networking restart
sudo pico /etc/hosts

and make it look like this:

127.0.0.1       localhost.localdomain   localhost
192.168.1.123   new-server.local.domain     new-server

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Then

sudo su
echo new-server.local.domain > /etc/hostname
/etc/init.d/hostname restart
hostname
hostname -f
apt-get update
apt-get dist-upgrade
reboot

After rebooting:

sudo su
/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils
apt-get install ntp ntpdate dkms htop iptables-persistent
echo 'Europe/London' | sudo tee /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata
exit

Webmin

sudo pico /etc/apt/sources.list.d/webmin.list and enter:

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Then

wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
sudo apt-get update && sudo apt-get install webmin
  1. Go to https://xyzn.xenapto.net:10000/ (use your own instance of course)
  2. Navigate to Webmin | Webmin configuration | Webmin themes | Install theme | From ftp or http URL
  3. Enter https://webmin-theme-stressfree.googlecode.com/files/theme-stressfree-2.10.tar.gz and click Install theme
  4. Click Return to themes list, select StressFree theme and click change
  5. Refresh the browser a few times until all is well.
  6. Navigate to System | Software package updates and configure Webmin to install all updates.

New Relic server monitoring

sudo su
wget -O /etc/apt/sources.list.d/newrelic.list http://download.newrelic.com/debian/newrelic.list
apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF
apt-get update && sudo apt-get install newrelic-sysmond
nrsysmond-config --set license_key=cf7a3f63ff072ed553adb3c45af33051c1300a5f
/etc/init.d/newrelic-sysmond start
exit

Virtualbox Guest Additions

If this is a Virtualbox VM then mount the Guest Additions CD using the menu Devices | Install Guest Additions.... Then

sudo su
apt-get install build-essential
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
/mnt/cdrom/VBoxLinuxAdditions.run
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment