Ubuntu Feisty setup - page 2

In page 1 of the Ubuntu Feisty setup, we completed the ssh configuration along with a basic iptables install.

Let's move on and install some personal configuration files to make our life easier. Once done, we can update the install and create a solid base for the 'meat' of the server.


OS check and Free

First thing is to confirm what OS we're using. We know we should be using Ubuntu Feisty (we have just upgraded from LTS after all) but let's see:

cat /etc/issue

You should get an output similar to this:

#Ubuntu 7.04 LTS \n \l

Memory usage should be very low at this point, let check using 'free -m' (the -m suffix displays the result in MB's which I find easier to read):

free -m

It's nice to know what is going on so let's look at that output:

.                  total       used       free     shared    buffers     cached
Mem:             254       111        142          0          3            74
-/+ buffers/cache:      34           220
Swap:            511        0           511

The line to take notice of is the second one as the first line includes cached memory - in this demo slice I have 254MB memory in total with 34MB actually used, 220MB free and no swap used. Nice.

.bash_profile

Let's make the terminal a bit more attractive and a bit more informative by adding a few lines to our .bash_profile file.

nano ~/.bash_profile

Add the next few lines at the end of the existing text. The following line will make the terminal show the server name in colour and display the working directory (the directory we are in) in a different colour:

export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: '

Now we can add aliases to the file. Aliases are short cuts to commands or sequences of commands. I've included a few below but you can have as many or as few as you want.

alias free="free -m"
alias update="sudo aptitude update"
alias install="sudo aptitude install"
alias upgrade="sudo aptitude upgrade"
alias remove="sudo aptitude remove"

The examples above are pretty simple. Instead of typing 'free -m' every time I want to look at the memory usage, I just type 'free. Typing 'sudo aptitude install' can get tedious, so I just type 'install'.

I still need to provide my password for the sudo command to work, but it is more productive/quicker/easier to have short cuts.

To activate the changes we can either log out and log in again (which is far too much like hard work!) or issue the following command:

source ~/.bash_profile

You should now see the slice name in purple and the working directory in brown.

To change the colours to your choosing, adjust the 0;35m and the 0;33m values in the 'export PS1' line of your .bash_profile. For example:

export PS1='\[\033[0;32m\]\h\[\033[0;36m\] \w\[\033[00m\]: '

would give you a green and blue output.

sources.list

We updated the sources.list when we upgraded from Ubuntu LTS to Ubuntu Feisty but let's have a check to see what sources we are using:

sudo nano /etc/apt/sources.list

Yup, these are the ones that should be there. As with the LTS install, be careful when adding repositories, not all are officially supported so they may not get security updates. Certainly something to be aware of anyway:

deb http://archive.ubuntu.com/ubuntu/ feisty main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted universe

deb http://archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe

deb http://security.ubuntu.com/ubuntu feisty-security main restricted universe
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted universe

update

Again, we updated the sources when we upgraded to Feisty but it will do no harm to do so again:

sudo aptitude update

NOTE: If you have used the .bash_profile shown above you just need to enter 'update' as the alias will use the entire command. I've put the whole thing here so you know what is happening.

locales

Remember the upgrade to Feisty left us with a bare bones install so we need install locales and set the system language:

sudo aptitude install localeconf

NOTE: Again, if you use the .bash_profile aliases, you only need to type in 'install package_name' and not the whole command shown above.

Answer 'yes' to both questions.

Now we can reconfigure the system locales:

sudo locale-gen en_GB.UTF-8

Change the suffix of the first command (en_GB.UTF-8) to your desired locale. For example you could use en_US.UTF-8 and so on.

Now a quick:

sudo dpkg-reconfigure localeconf

Follow the on screen instructions to select your preferred language:

upgrade

Not a lot should happen with the upgrade command as we did that during the upgrade from LTS:

sudo apt-get upgrade

screen

Now we can install 'screen'. This is a great utility that allows us many 'virtual' terminals in our single terminal window.

It also has the ability to start a process and be left to it. The connection could drop or you can log out from work and log in again later from home to see how the process is doing. A 'normal' ssh connection will not do that - if the connection drops, the process stops which is very annoying when you're an hour into compiling GCC, as you have to start again!

So, let's install screen:

sudo aptitude install screen -y

Did you notice the -y at the end of the command? This tells the install to go ahead and not ask if I want to carry on. Not always recommended but it's safe here.

If you've never used screen before, have a look at this screen tutorial which also includes how to create a .screenrc file so it starts exactly how you want it to (my screen session starts with 3 terminals, one running 'top, one main work terminal and a spare terminal for other use).

Let's start screen:

screen

Press the 'Space Bar' and it looks just like the normal terminal, except the .bash_profile has not been initiated... Issue the 'source' command:

source ~/.bash_profile

Now we are back to using our aliases and useful bash prompt.

build essentials

Ok, last thing to do is install some common programmes that will save time and, possibly, frustration later on.

Feisty has some handy meta-packages that include a set of pre-defined programmes needed for one purpose.

So instead of installing a dozen different package names, you can install just one meta-package. One such package is called 'build-essential'. Issue the command:

sudo aptitude install build-essential

Notice the programmes that are to be installed include gcc, make, patch and so on. All these are needed for many other programmes to install properly. A neat system indeed. Click 'Y' and install them.

done

Quite a lot happening here but now we have a secured slice.

The console is now informative and less drab and we can use the handy 'screen' tool. Locales have been configured and the meta-package build-essential has been installed.

If you do this more than once or twice it doesn't take long at all and we now have the ideal base to install the 'meat' of our server.

PickledOnion.

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)