This is the second installment in my Ubuntu Server Project series which documents my efforts to get a working copy of WordPress running on Ubuntu Server 7.10. It’s summarized, with links to past articles, on my Linux page or go to the previous article about installing Ubuntu Server 7.10.
Most of my experience with the *nix command line is limited as there’s always been a GUI. I think the most I did was over 10 years ago when I did some work on HP-UX. So I’ll be starting with the very basics, and will
probably get some things wrong.
First up I’ll be needing some command line basics.
The commands I’ll be using have man (think manual) pages on the system (at least the ones I’ll be using at first will). So first up I’ll need to know how to use man. The syntax of man couldn’t be simpler, it’s:
where command is the Ubuntu command for which you want the manual page.
I’ll be using aptitude to update my Ubuntu install so I issue the command:
and the man page for aptitude is loaded. To navigate use the <spacebar> to move forward and the <b> key to move back. Hit the <q> key to exit. Man also has a bunch of switches to search and use numerous other features but I don’t need those now.
You can also get help for most commands by typing the command followed by the -h parameter. The text will probably be more than a screen can handle and some of it will scroll off the top. To scroll up use <shift>-<pageup> and use <shift>-<pagedown> to head back down. I’ve read that shift-uparrow and shift-downarrow can be used but they don’t work for me. Could be a Mac/Parallels thing rather than bad info. To get to the command prompt release the shift key and start typing your command or just hit any key to get there (be sure to delete anything that was typed). I’ve either started typing the command or just hit <return> to get to the command prompt.
Ubuntu, and Linux in general, has virtual consoles even when at the command prompt. There are 6 of them. To switch virtual consoles type the keys <alt>-<Fn> where n is a number 1-6. For Mac users the alt key is the option key. Also, for fellow users of the new Mac keyboards the function keys default to their special features (Dashboard, Spaces, volume, etc…) so you’ll need to hold the <fn> key too. Or, you can do like I did and go into the keyboard section of System Preferences and enable standard function keys as shown below (click to enlarge).
Then you’ll have to use <fn> for the special functions but not any apps or to switch consoles.
With virtual consoles I can use one for the man page and another for the actual commands. In addition, each console requires it’s own logon so different IDs could be used. Long commands can run in one console while I work in another.
Aptitude vs. Apt-Get
Ubuntu uses Debian’s Advanced Packaging Tool (apt). I came across two commands for managing this from the command line. They are aptitude and apt-get. They seemed similar but different so I figured I needed to pick one and stay with it. I decided to go with aptitude. I did read that mixing in apt-get after using aptitude could cause problems with aptitude because aptitude wouldn’t know about all the dependencies.
Aaron Toponce has a recent article with well laid out logic for aptitude which is based on this older explanation of aptitude. But there does seem to be a minor religious war over the best package management system.
Since I’m starting with a fresh system it seems aptitude is the way to go. It just made sense. Besides, if I get tired of the command line aptitude has a curses interface (menu system).
Apt-get does have super cow powers while aptitude does not, which is the only reason I considered using apt-get.
Updating Ubuntu Server 7.10 – It’s Why We’re Here
The whole goal here was to update my original Ubuntu installation and now I’m finally ready.
I’m logged onto the console with my ID and I need to enter two commands. I’ll be starting each command by specifying sudo which will run the command as the superuser. I’m using the default configuration so I’ll be asked to authenticate with my password which is the id/password created during the Ubuntu Server installation.
The two commands are:
sudo aptitude update
As a mentioned, sudo means run as superuser, aptitude is the package manager I’m using and update is the action that aptitude will perform. Update tells aptitude to get a list of new/upgradable package.
sudo aptitude safe-upgrade
The safe-upgrade action tells aptitude to upgrade packages to their latest version. Packages will not be removed unless they are unused. Packages which are not currently installed will not be installed. If it’s necessary to remove of install one package in order to upgrade another this action may not be able to handle it. Full-Upgrade can be used in this situation. Aaron Toponce has an article describing the difference between safe-upgrade vs. full-upgrade. As the name implies, safe is more conservative. If it fails to update a package I can do further research and make a decision. Full-upgrade was formerly called dist-upgrade.
I issue the update command and the package info is quickly update. The safe-upgrade command upgraded 16 packages without error.
I then re-issued each command to make sure there weren’t any further updates. There weren’t so I’m done. I saved a snapshot in Parallels and shut things down.
Even though this was the basics it does cover the things I had to learn to get going. Rather than following a book and having it set the agenda I figure I’ll learn as I go. Good idea or not?
If you think you’d prefer apt-get due to the super cow powers type apt-get moo to see if you want the feature.