[Linuxcommand-announce] [LinuxCommand.org: Tips, News And Rants] Project: Getting Ready For Ubuntu
Brought to you by:
bshotts
|
From: William S. <bs...@pa...> - 2010-05-18 19:47:42
|
For our final installment, we're going to install and perform some
basic configuration on our new Ubuntu 10.04 system.
Downloading The Install Image And Burning A Disk
We covered the process of getting the CD image and creating the install
media in installment 3. The process is similar. You can download the CD
image here. Remember to verify the MD5SUM of the disk you burn. We
don't want to have a failed installation because of a bad disk. Also,
be sure to read the 10.04 release notes to avoid any last minute
surprises.
Last Minute Details
There may be a few files that we will want to transfer to the new
system immediately, such as the package_list.old.txt file we created in
installment 4 and each user's .bashrc file. Copy these files to a flash
drive (or use Ubuntu One, if you're feeling adventuresome).
Install!
We're finally ready for the big moment. Insert the install disk and
reboot. The install process is similar to previous Ubuntu releases.
Apply Updates
After the installation is finished and we have rebooted into our new
system, the first thing we should do is apply all the available
updates. When I installed last week, there were already 65 updates.
Assuming that we have a working Internet connection, we can apply the
updates with the following command:
me@linuxbox ~$ sudo apt-get update; sudo apt-get upgrade
Since the updates include a kernel update, reboot the system after the
updates are applied.
Install Additional Packages
The next step is to install any additional software we want on the
system. To help with this task, we created a list in installment 4 that
contained the names of all of the packages on the old system. We can
compare this list with the new system using the following script:
#!/bin/bash
# compare_packages - compare lists of packages
OLD_PACKAGES=~/package_list.old.txt
NEW_PACKAGES=~/package_list.new.txt
if [[ -r $OLD_PACKAGES ]]; then
dpkg --list | awk '$1 == "ii" {print $2}' > $NEW_PACKAGES
diff -y $OLD_PACKAGES $NEW_PACKAGES | awk '$2 == "<" {print $1}'
else
echo "compare_packages: $OLD_PACKAGES not found." >&2
exit 1
fi
This scripts produces a list of packages that were present on the old
system but not yet on the new system. You will probably want to capture
the output of this script and store it in a file:
me@linuxbox ~ $ compare_packages > missing_packages.txt
You should review the output and apply some editorial judgement as it
is likely the list will contain many packages that are no longer used
on the new system in addition to the packages that you do want to
install. As you review the list, you can use the following command to
get a description of a package:
apt-cache show package_name
Once you determine the final list of packages to be installed, you can
install each package using the command:
sudo apt-get install package_name
or, if you are feeling especially brave, you can create a text file
containing the list of desired packages to install and do them all at
once:
me@linuxbox ~ $ sudo xargs apt-get install < package_list.txt
Create User Accounts
If your old system had multiple user accounts, you will want to
recreate them before restoring the user home directories. You can
create accounts with this command:
sudo adduser user
This command will create the user and group accounts for the specified
user and create the user's home directory.
Restore The Backup
If you created your backup using the usb_backup script from installment
4 you can use this script to restore the /usr/local and /home
directories:
#!/bin/bash
# usb_restore - restore directories from backup drive with rsync
BACKUP_DIR=/media/BigDisk/backup
ADDL_DIRS=".ssh"
sudo rsync -a $BACKUP_DIR/usr/local /usr
for h in /home/* ; do
user=${h##*/}
for d in $BACKUP_DIR$h/*; do
if [[ -d $d ]]; then
if [[ $d != $BACKUP_DIR$h/Examples ]]; then
echo "Restoring $d to $h"
sudo rsync -a "$d" $h
fi
fi
done
for d in $ADDL_DIRS; do
d=$BACKUP_DIR$h/$d
if [[ -d $d ]]; then
echo "Restoring $d to $h"
sudo rsync -a "$d" $h
fi
done
# Uncomment the following line if you need to correct file ownerships
#sudo chown -R $user:$user $h
done
You should adjust the value of the ADDL_DIRS constant to include hidden
directories you want to restore, if any, as this script does not
restore any directory whose name begins with a period to prevent
restoration of configuration files and directories.
Another issue you will probably encounter is the ownership of user
files. Unless the user ids of each of the users on old system match the
user ids of the users on the new system, rsync will restore them with
the user ids of the old system. To overcome this, uncomment the chown
line near the end of the script.
If you made your backup using the usb_backup_ntfs script, use this
script to restore the /usr/local and /home directories:
#!/bin/bash
# usb_restore_ntfs - restore directories from backup drive with tar
BACKUP_DIR=/media/BigDisk_NTFS/backup
cd /
sudo tar -xvf $BACKUP_DIR/usrlocal.tar
for h in /home/* ; do
user=${h##*/}
sudo tar -xv \
--seek \
--wildcards \
--exclude="home/$user/Examples" \
-f $BACKUP_DIR/home.tar \
"home/$user/[[:alnum:]]*" \
"home/$user/.ssh"
done
To append additional directories to the list to be restored, add more
lines to the tar command using the "home/$user/.ssh" line as a
template. Since tar restores user files using user names rather than
user ids as rsync does, the ownership of the restored files is not a
problem.
Enjoy!
Once the home directories are restored, each user should reconfigure
their desktop and applications to their personal taste. Other than
that, the system should be pretty much ready-to-go. Both of the backup
methods provide the /etc directory from the old system for reference in
case it's needed.
Further Reading
Man pages for the following commands:
- apt-cache
- apt-get
- adduser
- xargs
--
Posted By William Shotts to LinuxCommand.org: Tips, News And Rants at
5/18/2010 03:47:00 PM |