Upgrades

From

Jump to: navigation, search

This page is an aid to me to remember what I have done during upgrades. They may be out-of-date (take them with a grain of salt).

Contents

Karmic to Lucid

Basic steps

  • Shrank the Windows XP partition using this info. This took about 1 hour.
  • Used GParted on an Ubuntu (or Kubuntu Natty or later) LiveCD to move my 100 Mb boot partition to the left.
  • Used GParted to expand the extended partition into the free space.
  • Used GParted to move the swap partition to the left.
  • Used GParted to move the main partition to the left. This took 2 hours.
  • Used GParted to create a new ext4 partition using the remaining free space.
  • Downloaded and burned a 64-bit server version of the new OS. (Remembered to chmod 777 /dev/sr0 to make sure K3b works.) I prefer the server version mostly because it gives the quickest installation. On my computer 64-bit runs significantly faster than 32-bit.
  • Changed the BIOS to allow booting from a CD/DVD.
  • Connected with a wired Ethernet connection. Installed the new OS to the free space, using a manual partition installation to the recently created ext4. Because I already had formatted the partition with GParted, I did not format it again and "kept the existing data." I did not encrypt my home directory because the email server cannot tolerate an encrypted home directory. No automatic updates, because automatic updates have made certain packages dysfunctional in the past. (Instead, I periodically review the proposed updates manually and then do supervised updates from time to time.) I did not install any extra packages at this time, in the interest of speed. I did not install Grub2 to the Master Boot Record (nor to the boot partition), but installed Grub only to the new partition (e.g. on /dev/sda7). This is because I have a boot partition (with Grub Legacy) that controls the boot menu and OS selection.
  • Wrote down the user name and password (as well as the name of the server), on a piece of paper which I taped to the inside of the computer case for future reference.
  • Rebooted into the first OS, from which (using sudo dolphin) I edited (in the boot partition) Grub Legacy's /boot/grub/menu.lst (opening it with the text editor kate). Used the absolute position of the partition (hd0,6) for /dev/sda7 as the rootnoverify location, and then chainloaded. Made sure the new OS was the first in the menu. Made sure there was a Grub Legacy password. Added the Grub Legacy password to the paper taped to the inside of the case. Rebooted.
  • Logged on and set a root user password (sudo passwd root). Added this root password to the piece of paper taped to the inside of the case.
  • Updated the repositories (sudo apt-get update) and upgraded the existing packages (sudo apt-get upgrade). Rebooted (sudo reboot).
  • Changed the BIOS to set the Hard Drive as the first boot device and disabled all other boot devices.
  • Added a KDE (Kubuntu) desktop (sudo apt-get install kubuntu-desktop). This took 45 minutes. Rebooted (sudo reboot).
  • Removed extraneous desktop and taskbar widgets. Customized my desktop wallpaper. Changed to a Classic menu. Using Settings -> System Settings, turned off audible notifications for the KDE System Notifications, chose the Oxygen theme from the Style -> Workspace menu, and chose Centered Placement for the Window Behavior:Advanced setting. Customized the Advanced: Login Manager: Theme to the one one I like.
  • Installed the Internet: Mozilla Firefox Browser. Customized Firefox, installing NoScript and AdBlock plus.
  • Customized the menu, including Kubuntuguide and Ubuntuguide.
  • Customized Dolphin, Dolphin as root, Kate, and Kate as root. Added Konsole Terminal, Dolphin, and Dolphin as root to Panel bar and customized panel bar.
  • Edited the Grub2 settings, including those to add a Grub2 password:
sudo kate /etc/default/grub
sudo update-grub
  • Installed important packages:
sudo apt-get install kubuntu-restricted-extras
  • Installed libdvdcss.
  • Installed the LAMP server (LINUX, Apache2, MySQL, PHP):
sudo tasksel install lamp-server
Set the root superuser MySQL password and wrote the MySQL superuser password on the paper taped to the inside of the case.
  • Installed multiple packages I like:
sudo apt-get install firestarter filezilla krdc x11vnc thunderbird php5-cli phpmyadmin 

Selected apache2 during the phpadmin installation and allow the database to be configured for phpmyadmin with database-common (Yes). Use the root superuser's MySQL password for phpmyadmin configuration.

  • Set up remote connections with the KRDC client (notably to the old system, through the LAN).
  • Set up X11VNC Server (-forever, Enable launch feedback, Place in System Tray) and opened firewall ports for LAN only.
  • Installed (then customised) multiple optional packages I sometimes use:
sudo apt-get install vlc kaffeine audacious k9copy ffmpeg choqok konversation
  • Configured the screensaver and set the primary user for automatic login. Made sure the BIOS allowed for automatic re-power-on after a power failure.
  • Removed the network-manager modules.
sudo apt-get --purge remove network-manager-kde network-manager-pptp network-manager knm-runtime network-manager-pptp-gnome
  • Edited the /etc/network/interfaces configuration file for use with a static IP.
  • Added a (root user) cron event for reloading the network interface daily. (This is a failsafe for flaky networking hiccoughs.)
sudo crontab -e

and added:

03 03 * * * /etc/init.d/networking restart
  • Installed the network printer.
  • Installed Enigmail for Thunderbird. Installed Lightning if using 32-bit, or Sunbird for 64-bit.
  • Enabled the Firestarter firewall:
  • Incoming ports: 80, custom SSH port, 143, 993, 25, 587, 5900 from selected LAN IPs
  • Outgoing ports: 80, 443, 143, 993
  • Incoming/outgoing connections to network printer(s) and NAS.
  • Increased the php.ini filesize limits:
sudo kate /etc/php5/apache2/php.ini
sudo kate /etc/php5/cli/php.ini
and changed:
memory_limit = 256M
upload_max_filesize = 20M
post_max_size = 30M

Mail Server

  • Created users on the new system for each emailusername.
  • Copied the /home/emailusername/Maildir directories from the old system to the new one.
sudo mkdir /home/mailuser1/Maildir/
sudo mkdir /home/mailuser2/Maildir/
...
sudo chown mailuser1:mailuser1 /home/mailuser1/Maildir/
sudo chown mailuser2:mailuser2 /home/mailuser1/Maildir/
...
sudo cp -pr /media/olddisk/home/mailuser1/Maildir/* /home/mailuser1/Maildir/
sudo cp -pr /media/olddisk/home/mailuser2/Maildir/* /home/mailuser2/Maildir/
...

This has to be done separately for .folders:

sudo cp -pr /media/olddisk/home/mailuser1/Maildir/.* /home/mailuser1/Maildir/
sudo cp -pr /media/olddisk/home/mailuser2/Maildir/.* /home/mailuser2/Maildir/
...

I'm not sure what the required permissions for the mail is, so I initially made them chmod 777.

sudo chmod 777 -R /home/mailuser1/Maildir/
sudo chmod 777 -R /home/mailuser2/Maildir
...

Once I determined the correct user (e.g. emailuser, root, postfix, or vmail, depending on the system) I then changed the owner to the correct owner (chown user:user) and chmod to 700 for all the Maildir directories.

  • Remove exim4:
sudo apt-get remove exim4

This works through the command line but not through the package manager (which will try to remove drupal6 as well if drupal6 was installed).

  • Install postfix:
sudo apt-get install postfix
sudo apt-get install -f
  • Install dovecot-postfix:
sudo apt-get install dovecot-postfix
sudo apt-get install -f
  • Copied postfix settings files from old system to new system:
  • /etc/postfix/main.cf
and made sure the correct dovecot processor was being used.

Also, email files in Maildir folders are designated with the name of the original server. When moving to a new server, it may be necessary to include the name of the old server as a destination in the Postfix main.cf configuration file:

mydestination = oldserver.oldomain.org, newserver.newdomain.org 
  • Edited the dovecot settings to match the old system
  • /media/olddisk/etc/dovecot/dovecot-postfix.conf -> /etc/dovecot/conf.d/01-dovecot-postfix.conf
  • Ensured all the certificates match:
sudo ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-mail.pem
sudo ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/ssl-mail.key
  • Restarted dovecot and postfix and checked the firewall for open ports.

WebDAV

WebDAV is an easy way to transfer files. Setting this up allows a central place for file transfers (other than as email attachments).

  • The old server had a WebDAV folder, which I add to Dolphin on the new system:
Dolphin -> Right-click on Places column --> Add Entry... -> Label: WebDavOldSystem
-> Location: webdav://mydomain.org/webdav
This allowed files to be initially transferred from the old system.
  • Set up a WebDav folder on the new system in a similar location and with identical permission settings to the old one. (This is important because I have WebDAV settings on many clients and do not want to have to change all their settings.)
sudo chown www-data:user /home/user/WebDAV1
sudo chmod 660 /home/user/WebDAV1
  • (Using VNC (KRDC) to access the old system on one side) I opened the WebDAV1 folder on both the old system and the new system using Dolphin. I copied the contents of the old system's WebDAV1 folder to the new system's WebDAV1 folder (including the digestpasswd.dav file), maintaining the correct permissions.
  • Created a symbolic link to the WebDAV1 folder in /var/www:
sudo ln -s /home/user/WebDAV1 /var/www/WebDAV1
  • Enabled the Apache2 Digest Authentication and dav filesystem modules on the new system:
sudo a2enmod auth_digest
sudo a2enmod dav_fs
  • Copied Apache2 /etc/apache2/conf.d/webdav from the old system to the new system.
  • Note: The Alias for the WebDAV folder is found in the /etc/apache2/sites-available/mydomain file, with the format:
 Alias /webdav1 /var/www/WebDAV1/subfolder
 #
 <Directory /var/www/WebDAV1/>
   Options Indexes MultiViews
   AllowOverride None
   Order allow,deny
   allow from all
 </Directory>
 #
  <Location /webdav1>
    DAV On
    AuthType Digest
    AuthName "webdav1digest"
    AuthUserFile /var/www/WebDAV1/digestpasswd.dav
    Require valid-user
  </Location>
 </VirtualHost>
 #

Copy Apache2 files

  • Backed up the new system's Apache2 folder.
  • Copied the /etc/apache2/sites-available folder from the old system to the new system.
  • Enabled the rewrite module:
sudo a2enmod rewrite
  • Enable the proxy pass modules:
sudo a2enmod proxy_http
sudo a2enmod proxy
  • Restarted Apache2:
sudo /etc/init.d/apache2 restart

ddclient

This is not needed, of course, if your ISP issues your site a Static IP address. However, I have always had a Dynamic IP address from my ISP.

  • Copied the /etc/ddclient.conf from the old system to the new system.
  • Installed ddclient, using the variables from the old system's ddclient.conf file:
sudo apt-get install ddclient
  • Edited the newly created /etc/default/ddclient and /etc/ddclient.conf files to contain the settings from the old system's /etc/ddclient.conf file.
  • Added a once-daily cron event to force an update.

home files

  • Moved (through WebDAV) the /home/user files from the old system to a /home/user/oldsystembackup folder on the new system.

Copy MySQL databases

  • Made a list of databases and stored it in a text file. (I used phpMyAdmin to display the list of databases.)
  • On the new server, created an identical set of databases using the command:
sudo mysqladmin --user=root --password='rootmysqlpw' create userdb1
sudo mysqladmin --user=root --password='rootmysqlpw' create userdb2
...
  • Using the list of database user names and database user passwords, re-created the database users. The database user/password for each database must match any configuration files (e.g. for MediaWiki, Drupal, etc.) Generally it is worthwhile to keep this list in a file for future reference and upgrades.
sudo mysql --user=root --password='rootmysqlpw'
mysql> GRANT ALL PRIVILEGES ON userdb1 TO userdb1user@localhost IDENTIFIED BY 'userdb1userpw'; 
mysql> GRANT ALL PRIVILEGES ON userdb2 TO userdb2user@localhost IDENTIFIED BY 'userdb2userpw';
...
mysql> flush privileges; 
mysql> \q
  • On the old system, backed up the database for each wiki using mysqldump (or phpMyAdmin):
sudo mysqldump --user=root --password='rootmysqlpw' userdb1 > userdb1.sql
sudo mysqldump --user=root --password='rootmysqlpw' userdb2 > userdb2.sql
...
  • Stored them in a folder. Copied the folder to the new system.
  • Restored the databases on the new system with mysql:
sudo mysql --user=root --password='rootmysqlpw' userdb1 < userdb1.sql
sudo mysql --user=root --password='rootmysqlpw' userdb2 < userdb2.sql
...
For large databases that are balky to import, use:
sudo mysql --user=root --password='rootmysqlpw'
mysql> use userdb95
mysql> source userdb95.sql
mysql> \q


Mediawiki

For direct moves of Mediawiki, the versions must be identical. My old version is MW 1.16.1, PHP 5.2.10-2, and MySQL 5.1.37. My new system has MW 1.15.1, PHP 5.3.2, and MySQL 5.1.41.

  • Install Mediawiki 1.15.1. This is done mostly to make sure that all dependencies are satisfied.
sudo apt-get install mediawiki
  • Copied all the Mediawiki folders from the old system to the new system:
  • /etc/mediawiki
  • /var/lib/mediawiki
  • /usr/share/mediawiki

This worked best using a direct copy method. Note the -p (include permissions) and -r (recursive). Because most USB/Flash/Thumb drives are formatted with FAT32 and FAT32 does not keep the file permissions intact (even when copying with -p), it is best to backup on a hard drive, to a CD/DVD, or to another location with rsync. It is also tricky to maintain file permissions when using NFS or SMB networked folders, since root permissions (root squashing) are disabled by default and recent protocols do not easily permit the "no_root_squash" function. MediaWiki is very finicky about file permissions; if you do not keep them intact moving a website will be difficult because you will then be required to recreate the correct permissions manually. This example is for directly backing up from one partition to another on a hard drive:

sudo cp -pr /olddrive/etc/mediawiki/* /etc/mediawiki/
sudo cp -pr /olddrive/var/lib/mediawiki/* /var/lib/mediawiki/
sudo cp -pr /olddrive/usr/share/mediawiki/* /usr/share/mediawiki/


Copy symbolic links

  • Re-created all the folders and symbolic links in the old system's /var/www folder to the new system's /var/www folder by using a batch file or copying the entire folder:
sudo cp -pr /olddrive/var/www/* /var/www/
  • Copied the /etc/apache2/sites-available folder and re-created the symbolic links of the /etc/apache2/sites-enabled folder using a batch file (or manually) or by copying the folders:
sudo cp -pr /olddrive/etc/apache2/sites-available/* /etc/apache2/sites-available/
sudo cp -pr /olddrive/etc/apache2/sites-enabled/* /etc/apache2/sites-enabled/
Personal tools
DONATE