In page 1 of the Redhat setup, we finalized the configurations for ssh and iptables on our slice.
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 Redhat but let's see:
You should get an output similar to this:
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
Good. Memory usage should be very low at this point but let's check using 'free -m' (the -m suffix displays the result in MB's which I find easier to read):
It's nice to know what is going on so let's look at that output:
. total used free shared buffers cached Mem: 256 103 152 0 4 40 -/+ buffers/cache: 58 197 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 256MB memory in total with 58MB actually used, 197MB free and no swap used. Nice.
Let's make the terminal a bit more attractive and a bit more informative by adding a few lines to our .bash_profile file.
Add the next few lines at the end of the existing text. The following line will make the terminal display 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 yum update" alias install="sudo yum install" alias upgrade="sudo yum upgrade" alias remove="sudo yum 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 yum 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 enter this command:
You should now see the slice name in purple and the working directory in brown.
To change the colors to your choosing, adjust the 0;35m and the 0;33m values in the 'export PS1' line of your .bash_profile.
export PS1='\[\033[0;32m\]\h\[\033[0;36m\] \w\[\033[00m\]: '
would give you a green and blue output.
As with CentOS, you can define software repositories for your slice in the /etc/yum.repos.d directory.
In this folder you will find the RHEL5 debuginfo repository which is disabled by default. The packages contained in this repository can assist in debugging application crashes, but are not for the normal user.
However, examining this file will give us a good indicator of how repos work:
sudo nano /etc/yum.repos.d/rhel-debuginfo.repo
As you scroll through the file, you will see this repository has a set of definitions including which baseurl to use and what gpg key to use (and actually whether to check the package signature at all).
You can, of course, add more repositories whenever you want to but I would just give a word of caution: Any added repositories are not officially supported and may not receive any security updates should a flaw be discovered.
The RHEL Slice comes with a unique subscription to the Redhat Satelite Network, which explains the added monthly fee.
The necessary repositories are then pulled on the fly from the network by a package called yum-rhn-plugin based on your current subscription.
To list the enabled repositories we issue the following command:
sudo yum repolist enabled
The output is as follows:
Loaded plugins: rhnplugin, security repo id repo name status rhel-x86_64-server-5 Red Hat Enterprise Linux (v. 5 for 64-bi enabled : 6,813 repolist: 6,813
Now we can update the package list that yum uses.
The command will also offer to install any updated packages. As with all installs have a careful look at the list and, once happy, press 'y' to continue:
sudo yum update
NOTE: If you have used the .bash_profile aliases 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.
That's really the basics for the Slice.
Once any updates have been installed, we can move on to installing some essential packages.
Redhat has some handy meta-packages that include a set of pre-defined programs needed for a single purpose.
So instead of installing a dozen different package names, you can install just one meta-package. One such package is called 'Development Tools'. Issue the command:
sudo yum groupinstall 'Development Tools'
Notice the programs that are to be installed include gcc, patch as well as many other packages. All these are needed for many other programs to install properly. A neat system indeed.
Enter 'Y' and install them.
Now we have the necessary packages should we want to build an application from source.
We'll go on and install a very useful package that I recommend called 'screen'.
This is a great application that allows 'virtual' terminals to be opened in one console. Switching between them is done with the press of a key.
The advantages are that you can be working on more than one shell at a time, say one installing software and another monitoring network activity - all without having more than one physical shell open. If the SSH connection is cut for some reason or you have to leave the room then close the terminal and the work will still carry on in the background.
I recommend getting used to using screen. This screen tutorial gives an excellent introduction.
sudo yum install screen
To start a screen session simply enter the command:
Not much appears to have changed, but you can open another virtual terminal with a:
Ctl-A and then press 'c'
Enter a simple command such as:
Then nip back to the other virtual terminal with:
Ctl-A and then press 'p'
You can have several processes running at the same time using this technique.
One thing to note, is that the bash aliases we setup previously in this article, will not work in Screen.
Quite a lot happening here but now we have a more secured Slice with updated packages ready for the meat of the server to be installed.