Posts Tagged ‘suse’

Linux - Suse 10.1: Cloning a VM and installing VMware Tools

Monday, February 11th, 2008

Overview

If we have a working Virtual Machine, all setup nicely and having had the disk resized perhaps, and partitions enlarged, it may be easier to use this as the basis for a new VM for another user. The cloned machine requires to be configured as follows.

Steps.

  1. Physically copy the VM files to a new folder.
  2. The VM filenames may wish to be changed to reflect a change in hostname, for example. Open the main .vmx VMware configuration file and change the names of files inside from e.g. suse-somac8 to suse01, whilst at the same time renaming the config files referred to in Explorer.
  3. There may be a .vmxf extended configuration file also, for which the above process should be performed.
  4. Start the VM and login.
  5. Su to root and
    • change the root password
    • delete any unwanted user accounts
    • Launch Yast
  6. In Yast, we require to rename the VM and set the correct network information.
  7. Also one must manually set the IP number and default route or the network card does not work (Bridged networking - IP number on SML subnet, not DHCP etc)
    > ifconfig eth2 137.195.80.82 netmask 255.255.255.0 up
    > route add default gw137.195.80.90
    where the above 80.82 respresents the guest IP number and 80.90 is our default gateway.

Installing VMware Tools

Vmware tools are basically drivers that work well in the Virtual environment - e.g. graphics drivers. One chooses to install them from the Vmware software and this appears as a Virtual CD (which can be mounted) and on which the vmware tools RPM is found.

There is a gotcha. Vmware Tools requires the kernel source code - just a folder which contains the source code. On the version of Suse in use here, the running kernel and source-code folder do not match for some reason, and VMware tools does not install. The steps to remedy this are

  1. Run command uname -r to return the running kernel version 2.6.16.21-0.13-default
  2. Yast - Software manager - search for kernel-source and examine the versions. Version 2.6.16.21-025 is installed, hmm.
  3. From this RPM repository, search for the correct kernel-source and download it (to a USB stick, say). Actually I found this kernel here: http://mirror.math.temple.edu/suse-install/update-10.1/rpm/i586/
  4. Install the above kernel-source

The kernel-source now matches the running kernel (you may have to remove the existing kernel-source within Yast, amidst many warning and protests!)

  1. Now with the Vmware Tools virtual CD, copy the vmware-tools.x.tar.gz file to and install folder of your choice (where x represents a lot of numbers I’m too lazy to type).
  2. Run command
    > gunzip vmware-tools.x.tar.gz
    > tar -xvf vmware-tools.x.tar
  3. Change to the newly created vmware-tools-distrib folder
  4. Type ./vmware-install.pl to run the installation script.
  5. Accept the defaults and when asked if you want to run a config script, accept. Here’s where a problem comes, because at some stage a default answer will not suffice. You’ll get an error message if you accept the default to question "what is the location of the C header files that match your running kernel [/usr/src/linux/include]?"
    You require to locate a folder such as /usr/src/linux-2.6.16.21-0.13 which should match your running kernel version, or the script will loop here. This is why the kernel-source was corrected earlier

Post Installation

It was found that the screen resolution was not able to be changed, even after a restart.

  1. Enter single-user mode
    > su
    > init 1
  2. Login as root and start the graphics configuration routine:
    > sax2
  3. The X-windows environment should start. Under Monitor, change the monitor’s resolution to what matches your system (here 1280×1024).

Suse Linux 10.1: System: Disk Checking

Friday, July 6th, 2007

Checking non-root partitions

To be added.

Checking the root partition

The root partition should not be mounted in order to check it, which means we must

Reference:

  1. Invalid Superblock Error:
    • "If mounting a file system fails due to an invalid
      superblock, the e2fsck program would probably
      fail, too. If this were the case, your superblock may be corrupted, too.
      There are copies of the superblock located every 8192 blocks (8193, 16385,
      etc.). If your superblock is corrupted, try one of the copies instead. This
      is accomplished by entering the command e2fsck -f -b 8193
      /dev/damaged_partition
      . The -f option forces
      the file system check and overrides e2fsck’s
      error so that, since the superblock copy is intact, everything is fine.
      " (Reference)
  2. The dd command - http://www.debianhelp.co.uk/ddcommand.htm
    • Backup the MBR partition with syntax: dd if=/dev/hdx of=/path/to/image count=1 bs=512
    • Example: dd if=/dev/hda of=backup-of-hda-mbr count=1 bs=512 (from this Ref).
    • The actual command used were:
    • > fdisk -l [to check partitions, reports sda1 as swap and sda2 as root /]
    • > dd if=/dev/sda1 of=backup_of_sda1_mbr count=1 bs=512 [in root folder]

Linux - Suse 10.1: Apache - making case insensitive

Thursday, July 5th, 2007

Making Apache case-insensitive:

Scenario:

Html
files are held on the Scratch drive of a Novell NetWare 6.0 server, currently
served by a Apache32 which is case-insensitive. A Linux solution is
naturally case sensitive, so we need a way around this if we are to replace the Windows Apache server with a Linux one.

Versions:

  • Novell NetWare 6.0
  • Suse Linux 10.1 with Apache 2.2.0-21.7

Links:

Here’s the Plan

  1. Mount the Novell server volume holding the Apache htdocs folder using ncpmount
  2. Create a Virtual Host on Apache which will use this htdocs as it’s document root
  3. Use mod_speling in this vhost to ignore case.

And here’s what actually worked

  1. Mount the Novell server volume holding the Apache htdocs folder using ncpmount
  2. When
    creating a vhost to serve the Novell htdocs folder, Apache will not,
    for some reason, serve html documents. It will serve text files, but
    not .htm or .html files and nothing appears in the error logs. Quite
    bizarre.
    • As a workaround, create a normal directory for
      the Vhost in question and use rsync to copy the Novell directory
      contents into this vhost directory. Long file names are copied just
      fine.
  3. Load the mod_speling module into the Vhost config file and indeed, URLs are now case insensitive.

Important: DNS and Name Resolution in this article

In using the Vhost name of sml2.som.hw.ac.uk it’s important to remember that, in this test, this name is not actually DNS registered. To get the Linux machine to resolve this one must add this to the /etc/hosts file, with the same IP number as the suse01.som.hw.ac.uk host itself. On Windows, one must edit the hosts file under C:WINDOWSsystem32driversetc by including the line:
137.195.80.104 sml2.som.hw.ac.uk itc.som.hw.ac.uk

The Files Involved in this article:

a) The Novell Server mount point

  • > mkdir /mnt/somfs2 [as root]
  • > chown wwwrun.nwaccess /mnt/somfs2 [so that the Apache process - wwwrun- can access the folder]
  • > chmod a+rx /mnt/somfs2 [so all Linux users can read this mount]
  • > cd /mnt/somfs2
  • > chown wwwrun.nwaccess . [so that Apache owns the folders/files actually mounted here]
  • > chmod a+rx . [so all Linux users can read this mount, makes things easier]

The SCRATCH volume of Novell server SOMFS2 is mounted via the command

  • ncpmount
    -S somfs2 -A somfs2.som.hw.ac.uk -V SCRATCH -U somweb.som.staff.hw -P
    thepassword -u 30 -g 1000 /mnt/somfs2 -d 0755 -f 0755

Here, somweb is the Novell webserver login, whose password is given after -P. The -u and -g
options specify that the mount process is to be owned by the user with
uid 30 (wwwrun) and group having guid 1000 (nwaccess); both can be
determined by viewing /etc/passwd /etc/group.

The -d and -f options
specify the file permissions with which the folder is to be mounted;
the first digit - a zero - indicates … I’ve forgotten, but 755 is
u=rwx,g=rx,o=rx.

In testing, the above command was
saved as a Bash shell script in /home/somdjp/apache_mount.sh and called
by root but ncpmount is flagged suid. Thus, the command runs with
privilieges of the file ownership, which is root, so it need not be
called by root. Check this with ‘>whereis ncpmount’ and ‘ls -l
/usr/bin/ncpmount’ which will return -rwsr-x—.

After mounting, we have this directory structure (where the red text represents folders on the Novell folder): /mnt/somfs2/Apache/htdocs/

b) The Apache Virtual Host: Config File

A virtual host (Vhost) was created by means of creating file /etc/apache2/vhosts.d/vhost-sml2.som.hw.ac.uk.conf

The contents of this file are below, the most important parts being documentroot and mod_speling.

<VirtualHost 137.195.80.104>
ServerAdmin D.Potter@hw.ac.uk
ServerName sml2.som.hw.ac.uk

# Duncan: Enable mod_speling

LoadModule speling_module /usr/lib/apache2/mod_speling.so
CheckSpelling On

DocumentRoot /srv/www/vhosts/sml2.som.hw.ac.uk/htdocs

ErrorLog /var/log/apache2/sml2-error.log
CustomLog /var/log/apache2/sml2-access.log combined

HostnameLookups On
UseCanonicalName Off
ServerSignature On

ScriptAlias /cgi-bin/ "/srv/www/vhosts/sml2.som.hw.ac.uk/Apache/cgi-bin/"

<Directory "/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>

<IfModule mod_userdir.c>
UserDir public_html
Include /etc/apache2/mod_userdir.conf
</IfModule>

<Directory "/srv/www/vhosts/sml2.som.hw.ac.uk/htdocs">
Options Indexes FollowSymLinks Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# Duncan added the following lines:
<ifModule mod_dir.c>
DirectoryIndex index.html index.htm
</IfModule>

# Default MIME typer - for text and html documents
DefaultType text/plain
Loglevel error
Alias /icons/ /srv/www/vhosts/sml2.som.hw.ac.uk/Apache/icons/
</VirtualHost>

c) The Apache Virtual Host Document Root

Remember, this is a real directory whose contents will be served by the Apache vhost. The contents of this folder are the same as the Novell mounted htdocs folder, and the rsync program will be used to copy the contents across. For some unknown reason, despite much effort, the Apache vhost cannot serve html documents from the Novell mounted htdocs folder, so we have to use this mechanism to get past this.

The documentroot is /srw/www/vhosts/sml2.som.hw.ac.uk/htdocs.

Using Rsync

In testing, only one folder under the Novell mounted htdocs was copied, and this was gb6.

  • Novell: \somfs2scratchapachehtdocsgb6
  • Suse: ncpmount’ed as /mnt/somfs2/Apache/htdocs/gb6
  • Suse: rsync’ed to /srv/www/vhosts/sml2.som.hw.ac.uk/htdocs/gb6

The rsync command was [rsync options source destination]

  • > rsync -avr /mnt/somfs2/Apache/htdocs/gb6 /srv/www/vhosts/sml2.som.hw.ac.uk/htdocs/gb6

which duly populated our Vhost htdocs documentroot. To remove files in the destination which are no longer in the source one would use the –delete option:

  • > rsync -avr –delete /mnt/somfs2/Apache/htdocs/gb6/ /srv/www/vhosts/sml2.som.hw.ac.uk/htdocs/gb6/

Making Apache Case Insensitive

The subject of this article! All that’s required is

  1. Track down where the Apache modules are held
  2. Add the following lines to the Vhost.conf file in question (vhost-sml2….conf):
    • LoadModule speling_module /usr/lib/apache2/mod_speling.so
      CheckSpelling On
  3. Restart Apache
    • > rcapache2 restart

Apache is now case-insensitive. Actually, when you type in a URL using the wrong case, Apache finds the file anyway and serves that so the web-browser location shows the proper, Linux filename. However, the case-insensitivity only applies to file names - not directory names. Example

  • Correct URL is: http://sml2.som.hw.ac.uk/gb6/BroughtonRD/Tour.htm
  • Changing the filename case works: http://sml2.som.hw.ac.uk/gb6/BroughtonRD/toUR.htm
  • Changing the directory case fails!: http://sml2.som.hw.ac.uk/gb6/broughtonrd/Tour.htm

Linux - Suse 10.1: Public Private Keys Created

Monday, July 2nd, 2007

Overview: PKK Pair

On the suse-somac8 Virtual Machine (Suse 10.1, KDE 3.5.4, 6Gb) a pair of public-private keys was created for user somdjp to allow secure remote connection and transfer of files.

Reference: Suse Linux 10 Bible p428, great ssh link.

Steps:

  1. Login as somdjp and type
    • > ssh-keygen -t dsa (and use a passphrase - hint: same as Duncan always uses)
  2. This creates folder ~/.ssh where ~ represent the home folder of somdjp, under which are found the public key (id_dsa.pub) and private key (id_dsa).
  3. On any machine to which somdjp wishes to login securely the folder ~/.ssh/authorized_keys must contain the public key; both keys were copied to a USB memory stick.
  4. On host suse-somac8, for which the root user is not going to be somdjp but somac8, the private key was deleted from the somdjp/.ssh home folder for security. The private key must always be - yes - private.
  5. Powering up host suse01, the main VM for this Suse project, account somdjp had the PPK pair copied across.
    NB: VMware Workstation 6.0 cannot use bridged networking for two guests at the same time, the network of one will not be operational.

Linux - Suse 10.1: Evolution Connector

Monday, June 25th, 2007

Background:

The OpenSource Ximinian Evolution Connector allows the Evolution mail client to connect to an Exchange server. The latest stable version is believed to be 2.0 (

download page).

Links:

  1. See http://www.gnome.org/projects/evolution/ for details
  2. See Novell Announces Evolution 2.0 and Release of Connector for Microsoft Exchange Server Under Open Source License for an overview.
  3. Evolution User Manual for 2.0x - the best place to start.

Installation:

  1. The VM chosen was that of Atanas (somac8).
  2. Evolution 2.6.0-49.23.rpm and Evolution-Connector were selected from Yast-Software Management; a large number of required/dependent packages were also installed.
  3. Using the above user guide, Evolution was started and the user details (my own credentials were entered)
  4. Exchange was chosen as the mail host and the following information is required:
    • Global Catalog Server: ex1.mail.win.hw.ac.uk
    • Username: hw-mail/somdp [in this case my username is somdp]
    • OWA URL: https://webmail.hw.ac.uk/exchange
  5. Exchange then connects perfectly to the University Exchange mail service!

Problems:

The Calendar doesn’t appear to show any information, that’s all.

September 2010
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
27282930  

Copyright © 2010 Duncansapien’s Techblog. Search Engine Optimization by Star Nine. Distributed by Wordpress Themes