This is a bit different than the other posts as I won’t actually be installing any major software. Instead I’ll be customizing Ubuntu to make it easier for me to use and finding programs to monitor my server.
First I’ll want some commands that tell me about the system. Since there’s only 256MB of memory allocated to this Ubuntu Server virtual machine I’ll want to keep tabs on memory usage. I can do this with the free command and use -m to have the info displayed as easy to read megabytes.
This will display the amount of memory used.
The first line includes cached memory so I’m more concerned with the second line which shows I’m using 16MB and have 233MB free. The third line shows I’m not using any swap space which is nice. This will be my baseline and I can monitor it as I install software.
If I want more detailed memory usage I can use
If I need a reminder of the version I’m using I can use
cat /etc/issue which will display the Ubuntu version.
lsb_release -a can also be used to display version information.
top command displays information on running processes and system resources. It’s updated in real time and you can exit by typing
q. Pressing <shift>-<m> while top is running will sort the processes based on memory usage.
uname -a prints the machine name and kernel information along with a few other things.
As the above output shows it was necessary for me to use a different kernel in order to run Ubuntu under Parallels.
df -h can be used to display disk usage in MB. -h means human readable as opposed to blocks.
Screen is a terminal multiplexer that allows multiple sessions in one terminal window much as the console does. In addition, it provides the ability to disconnect a session and return to it later, or continue processing if a session is interrupted.
To install screen I execute:
sudo aptitude install screen
As a side note: Even though I left the Ubuntu Server CD image connected to the VM I had to mount it manually for aptitude to use it. I issued
mount /cdrom to mount it.
There’s a good screen tutorial at Linux Journal so I won’t go into it here.
Build-Essentials is a Ubuntu meta-package of programs that are frequently needed to properly install other programs so I want to install it. I run:
sudo aptitude install build-essential
The install is problem free.
There’s some commands I’m going to be using a lot. To save time typing, especially since my typing is pretty bad, I set up some aliases. I open my bash configuration file in the nano editor so that I can add some aliases.
I scroll down until I find the Alias Definitions section.
I uncomment the last 3 lines shown above so that I can put the aliases in a file. I could add the aliases in this file but I like the idea of using a separate file just for the aliases. Remove the # to uncomment the lines. I save the file then use nano to create the ~/.bash_aliases file.
I add the following aliases to the file:
alias free="free -m"
alias install="sudo aptitude install"
alias newalias="nano ~/.bash_aliases"
alias remove="sudo aptitude remove"
alias update="sudo aptitude update"
alias upgrade="sudo aptitude safe-upgrade"
The first one makes it slightly easier to get free memory, the third opens the alias file for editing while the other simplify the aptitude command line. To run the command I can just type the alias, adding any necessary command-line options after it. It’s necessary to logout and login when making these changes since the bash configuration is only read during logon.
Well, I’ve got aliases to make my life easier and I’ve got system utilities to monitor resource usage as I install new software. Next on the agenda is the MySQL installation.