Setting up Ubuntu Server 14.04 LTS

Install

This guide is primarily for my own reference; I run a basic server at home for Git repositories and test sites.

My preference is to run the Long Term Support version of Ubuntu Server. For my new machine I’ll be running 14.04 LTS which will have 5 years of support, so until 2019.

Basically I want to set it up and forget about it – what I don’t want to forget is how it’s set up.


Network

First things first – because this is a server and will primarily be accessed by applications and via SSH/sFTP, let’s make a few networking changes.

Static IP address

To make life easier I want the server to have a static IP address that is easy to remember – I have chosen 192.168.1.150

This number is based on my Plusnet routers addressing of 192.168.1.254

iface eth0 inet static
                address  192.168.1.150
                netmask  255.255.255.0
                gateway  192.168.1.254
                dns-nameservers  8.8.8.8  8.8.4.4

The snippet above is placed in your interfaces configuration:

sudo vi /etc/network/interfaces

This was based on the information from the Unixmen page:

To restart your interface use:

sudo ifdown eth0 && sudo ifup eth0

Your new IP address should be active. If not then you can also try rebooting the machine.

sudo reboot

SSH

From another machine you can log in to your server using OpenSSH as installed during the Ubuntu installation.

Log in

From Terminal:

ssh username@192.168.1.150

Type in your password when it prompts you and agree to any other messages.

Passwordless entry

Generate your key on a client machine, in my case a Mac Pro, though this is pretty much the same as most Linux distributions:

ssh-keygen -t rsa -b 4096

Follow the key generation instructions until you are returned to the command prompt.

To transfer the key to the servers authorised hosts file use the command below:

cat ~/.ssh/id_rsa.pub | ssh username@192.168.1.150 "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

This key can now also be used in applications such as Filezilla and Tower 2 as well.

Now that we have access to our server remotely and it can use passwordless entry, we can disable password access in the SSH config file:

sudo vi /etc/ssh/sshd_config

Change the value of the line below to:

PasswordAuthentication no

To apply the new configuration, restart the SSH server:

sudo service ssh restart

Logging more detail

To log more detail about what SSH is doing, change the value of the line below to:

LogLevel VERBOSE

To apply the new configuration, restart the SSH server:

sudo service ssh restart

To view the log use:

sudo vi /var/log/auth.log

 

Commands useful with SSH

Turn the machine off – shutting down and power off:

sudo shutdown -h now

Reboot the machine – shutting down and restart:

sudo reboot

Determine where you are in the file structure:

pwd

Clear the terminal window:

clear

LAMP

 


Git

Open Terminal and run the following command:

sudo apt-get install git-core

You’ll need to create a Git configuration file in your home directory – I’ll use vi, because it’s just so user friendly:

sudo vi ~/.gitconfig

You should now be starting from a fresh/empty file, close vi and run the following commands to add details to your configuration file:

git config --global user.name "gitUserName"
git config --global user.email user.email@domain.co.uk

If you use GitHub use the same details you use to access the web site. Git is now installed and your user details should be saved in the configuration file.

Get the latest updates

Adding the latest version of Git from their package repository – useful on Ubuntu LTS versions where the Ubuntu Universe version is older than the Git version:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get upgrade

Mirror existing repositories

Mirroring your existing repositories to the new server

Connect Ubuntu to a Samsung M2022w printer

Setting up your Samsung M2022w wireless printer can be a pain if you don’t know where to look – luckily someone has taken that pain upon themselves so you don’t have to.

The Samsung Unified Linux Driver Repository is the place to get your Samsung driver for Ubuntu (or Linux in general).

Start by adding the repository – in Ubuntu Terminal:

sudo wget -O - http://www.bchemnet.com/suldr/suldr.gpg | sudo apt-key add -

Then refresh your updates cache:

sudo apt-get update

Install the driver:

sudo apt-get install suld-driver2-1.00.06

Setting up the printer

With the driver installed you can now set up the printer – find the Printers applet, click ‘Add’.

printer-setup-1

Open ‘Network Printer’, after a short while a whole bunch of options will appear like below. Click on the option titled ‘Samsung M2022 Ser…’ and then ‘Forward’.

printer-setup-2

Some screens will pass that are very self explanatory, you really can’t go wrong. The last screen allows you the option to do a test print, feel free.

printer-setup-3

Click ‘OK’.

Random Terminal commands

A place for Terminal/CLI commands that don’t merit a whole post to themselves. I’ll move the snippet if I do a longer post on the related subject.

Dropbox

Dropbox losses its notification icon on some Ubuntu installs, for me that version is 13.10 – to get it back run the following:

sudo apt-get install libappindicator1
sudo dropbox stop && dropbox start

This adds the icon back into the notification area. Continue reading “Random Terminal commands”

Setting up IMAP from NamesCo on Mozilla Thunderbird

Setting up Mozilla Thunderbird to use with your NamesCo IMAP email account is fairly straight-forward. Anywhere I have used yourdomain.co.uk’, use your domain as used in your email address after the @ symbol. Where I use ‘your.name’ replace with your name.

Open Thunderbird and open the ‘Account Settings’ – on Ubuntu 13.10 that can be found in the ‘Edit’ menu.

Account settings screen

At the bottom of this screen on the left you’ll see a dropdown menu labelled ‘Account Actions’.

thunderbird-account-action-dropdown

Click on the dropdown and choose ‘Add Mail Account…’ – a new screen will open requesting your name, email address & password.

thunderbird-account-setup-step-1

Fill in the details and click ‘Continue’.

Thunderbird will attempt to find your account setting from Mozillas email database. When it fails it will display a configuration screen where you can add the correct details.

thunderbird-account-setup-step-2

The details for the NamesCo server are:

                   Server hostname    Port   SSL       Authentication
Incoming:   IMAP   imap.hosts.co.uk   993    SSL/TLS   Normal password
Outgoing:   SMTP   smtp.hosts.co.uk   465    SSL/TLS   Normal password

The username for your account should have been supplied to you – it is usually in a format as below:

Username:   yourdomain.co.uk_your.name

Fill in the details and click ‘Continue’ again. Thunderbird should connect to the NamesCo server, close the setup window and show you the ‘Account Settings’ window again.

Click on you email address on the left hand side. On the right you can update your account name with something easier to read:

thunderbird-change-account-name

You can also add your organisation name and a signature on the same screen:

thunderbird-add-organisation-and-signature

On the left under your account name you can see ‘Server Settings’ – click on that and check the box labelled ‘Clean up (“Expunge”) Inbox on Exit’:

thunderbird-expunge-inbox-on-exit

On the left under your account name you can see ‘Junk Settings’ – click on that and check the box labelled ‘Move new junk messages to:’:

thunderbird-junk-settings

On the left click ‘Outgoing Server (SMTP)’. Highlight the SMTP entry that corresponds to your new email account and click ‘Edit…’

thunderbird-smtp-details

The details for your SMTP server should mostly be correct as we set them up earlier – you will need to change the username though as it is different to your email user:

thunderbird-smtp-edit-screen

The settings should be:

Description:              Optional/Leave empty
Server Name:              smtp.hosts.co.uk
Port:                     465

Connection security:      SSL/TLS
Authentication method:    Normal password
User Name:                yourdomain.co.uk

Click ‘OK’.

SMTP password

Assuming all has gone well you should be able to receive email. From another device or from an online email provider test this by sending yourself an email.

When the email arrives reply to it – you will be asked for the SMTP password:

thunderbird-smtp-password

Enter your SMTP password, check the box labelled ‘Use password Mana…’ and click ‘OK’.