Archive

Posts Tagged ‘slackware’

FreeBSD Handbook - Chapter 22 Virtualization

January 6th, 2009

Warning: file_get_contents(http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1TJ8QTQ6ZFCVAJ3X1T02&AssociateTag=ii0c3-20&Operation=ItemSearch&SearchIndex=Books&ResponseGroup=Small,Images&Keywords=bsd) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/manusia2/public_html/wp-content/plugins/amazonfeed/php/amazonfeed.class.php on line 271

Contributed by Murray Stokely.

22.1 Synopsis

Virtualization software allows multiple operating systems to run simultaneously on the same computer. Such software systems for PCs often involve a host operating system which runs the virtualization software and supports any number of guest operating systems.

After reading this chapter, you will know:

  • The difference between a host operating system and a guest operating system.

  • How to install FreeBSD on an Intel-based Apple Macintosh computer.

  • How to install FreeBSD on Linux with Xen.

  • How to install FreeBSD on Microsoft Windows with Virtual PC.

  • How to tune a FreeBSD system for best performance under virtualization.

Before reading this chapter, you should:

  • Understand the basics of UNIX and FreeBSD (Chapter 3).

  • Know how to install FreeBSD (Chapter 2).

  • Know how to set up your network connection (Chapter 31).

  • Know how to install additional third-party software (Chapter 4).


22.2 FreeBSD as a Guest OS

22.2.1 Parallels on MacOS

Parallels Desktop for Mac is a commercial software product available for Intel based Apple Mac computers running Mac OS 10.4.6 or higher. FreeBSD is a fully supported guest operating system. Once Parallels has been installed on Mac OS X, the user must configure a virtual machine and then install the desired guest operating system.


22.2.1.1 Installing FreeBSD on Parallels/Mac OS® X

The first step in installing FreeBSD on Mac OS X/Parallels is to create a new virtual machine for installing FreeBSD. Select FreeBSD as the Guest OS Type when prompted:

And choose a reasonable amount of disk and memory depending on your plans for this virtual FreeBSD instance. 4GB of disk space and 512MB of RAM work well for most uses of FreeBSD under Parallels:

Select the type of networking and a network interface:

Save and finish the configuration:

After your FreeBSD virtual machine has been created, you will need to install FreeBSD on it. This is best done with an official FreeBSD CDROM or with an ISO image downloaded from an official FTP site. When you have the appropriate ISO image on your local Mac filesystem or a CDROM in your Mac’s CD drive, click on the disc icon in the bottom right corner of your FreeBSD Parallels window. This will bring up a window that allows you to associate the CDROM drive in your virtual machine with an ISO file on disk or with your real CDROM drive.

Once you have made this association with your CDROM source, reboot your FreeBSD virtual machine as normal by clicking the reboot icon. Parallels will reboot with a special BIOS that first checks if you have a CDROM just as a normal BIOS would do.

In this case it will find the FreeBSD installation media and begin a normal sysinstall based installation as described in Chapter 2. You may install, but do not attempt to configure X11 at this time.

When you have finished the installation, reboot into your newly installed FreeBSD virtual machine.


22.2.1.2 Configuring FreeBSD on Mac OS X/Parallels

After FreeBSD has been successfully installed on Mac OS X with Parallels, there are a number of configuration steps that can be taken to optimize the system for virtualized operation.

  1. Set boot loader variables

    The most important step is to reduce the kern.hz tunable to reduce the CPU utilization of FreeBSD under the Parallels environment. This is accomplished by adding the following line to /boot/loader.conf:

    kern.hz=100

    Without this setting, an idle FreeBSD Parallels guest OS will use roughly 15% of the CPU of a single processor iMac®. After this change the usage will be closer to a mere 5%.

  2. Create a new kernel configuration file

    You can remove all of the SCSI, FireWire, and USB device drivers. Parallels provides a virtual network adapter used by the ed(4) driver, so all other network devices except for ed(4) and miibus(4) can be removed from the kernel.

  3. Setup networking

    The most basic networking setup involves simply using DHCP to connect your virtual machine to the same local area network as your host Mac. This can be accomplished by adding ifconfig_ed0="DHCP" to /etc/rc.conf. More advanced networking setups are described in Chapter 31.


22.2.2 FreeBSD with Xen™ on Linux

Contributed by Fukang Chen (Loader).

The Xen hypervisor is an open source paravirtualization product which is now supported by the commercial XenSource company. Guest operating systems are known as domU domains, and the host operating system is known as dom0. The first step in running a virtual FreeBSD instance under Linux is to install Xen for Linux dom0. The host operating system will be a Slackware Linux distribution.


22.2.2.1 Setup Xen 3 on Linux dom0
  1. Download Xen 3.0 from XenSource

    Download xen-3.0.4_1-src.tgz from http://www.xensource.com/.

  2. Unpack the tarball

    # cd xen-3.0.4_1-src
    # KERNELS="linux-2.6-xen0 linux-2.6-xenU" make world
    # make install

    Note: To re-compile the kernel for dom0:

    # cd xen-3.0.4_1-src/linux-2.6.16.33-xen0
    # make menuconfig
    # make
    # make install

    Older version of Xen may need to specify make ARCH=xen menuconfig

  3. Add a menu entry into Grub menu.lst

    Edit /boot/grub/menu.lst and add the following lines:

    title Xen-3.0.4
    root (hd0,0)
    kernel /boot/xen-3.0.4-1.gz dom0_mem=262144
    module /boot/vmlinuz-2.6.16.33-xen0 root=/dev/hda1 ro
  4. Reboot your computer into Xen

    First, edit /etc/xen/xend-config.sxp, and add the following line:

    (network-script 'network-bridge netdev=eth0')

    Then, we can launch Xen:

    # /etc/init.d/xend start
    # /etc/init.d/xendomains start

    Our dom0 is running:

    # xm list
    Name                                      ID   Mem VCPUs      State   Time(s)
    Domain-0                                   0   256     1     r-----  54452.9

22.2.2.2 FreeBSD 7-CURRENT domU

Download the FreeBSD domU kernel for Xen 3.0 and disk image from http://www.fsmware.com/

  • kernel-current

  • mdroot-7.0.bz2

  • xmexample1.bsd

Put the configuration file xmexample1.bsd into /etc/xen/ and modify the related entries about where the kernel and the disk image are stored. It should look like the following:

kernel = "/opt/kernel-current"
memory = 256
name = "freebsd"
vif = [ '' ]
disk = [ 'file:/opt/mdroot-7.0,hda1,w' ]
#on_crash    = 'preserve'
extra = "boot_verbose"
extra += ",boot_single"
extra += ",kern.hz=100"
extra += ",vfs.root.mountfrom=ufs:/dev/xbd769a"

The mdroot-7.0.bz2 file should be uncompressed.

Next, the __xen_guest section in kernel-current needs to be altered to add the VIRT_BASE that Xen 3.0.3 requires:

# objcopy kernel-current -R __xen_guest
# perl -e 'print "LOADER=generic,GUEST_OS=freebsd,GUEST_VER=7.0,XEN_VER=xen-3.0,BSD_SYMTAB,VIRT_BASE=0xC0000000\x00"' > tmp
# objcopy kernel-current --add-section __xen_guest=tmp
# objdump -j __xen_guest -s kernel-current

kernel-current:     file format elf32-i386

Contents of section __xen_guest:
 0000 4c4f4144 45523d67 656e6572 69632c47  LOADER=generic,G
 0010 55455354 5f4f533d 66726565 6273642c  UEST_OS=freebsd,
 0020 47554553 545f5645 523d372e 302c5845  GUEST_VER=7.0,XE
 0030 4e5f5645 523d7865 6e2d332e 302c4253  N_VER=xen-3.0,BS
 0040 445f5359 4d544142 2c564952 545f4241  D_SYMTAB,VIRT_BA
 0050 53453d30 78433030 30303030 3000      SE=0xC0000000.

We are, now, ready to create and launch our domU:

# xm create /etc/xen/xmexample1.bsd -c
Using config file "/etc/xen/xmexample1.bsd".
Started domain freebsd
WARNING: loader(8) metadata is missing!
Copyright (c) 1992-2006 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 7.0-CURRENT #113: Wed Jan  4 06:25:43 UTC 2006
    kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
Xen reported: 1796.927 MHz processor.
Timecounter "ixen" frequency 1796927000 Hz quality 0
CPU: Intel(R) Pentium(R) 4 CPU 1.80GHz (1796.93-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf29  Stepping = 9
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,
  DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x4400<CNTX-ID,<b14>>
real memory  = 265244672 (252 MB)
avail memory = 255963136 (244 MB)
xc0: <Xen Console> on motherboard
cpu0 on motherboard
Timecounters tick every 10.000 msec
[XEN] Initialising virtual ethernet driver.
xn0: Ethernet address: 00:16:3e:6b:de:3a
[XEN]
Trying to mount root from ufs:/dev/xbd769a
WARNING: / was not properly dismounted
Loading configuration files.
No suitable dump device was found.
Entropy harvesting: interrupts ethernet point_to_point kickstart.
Starting file system checks:
/dev/xbd769a: 18859 files, 140370 used, 113473 free (10769 frags, 12838 blocks, 4.2% fragmentation)
Setting hostname: demo.freebsd.org.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
      inet6 ::1 prefixlen 128
      inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
      inet 127.0.0.1 netmask 0xff000000
Additional routing options:.
Mounting NFS file systems:.
Starting syslogd.
/etc/rc: WARNING: Dump device does not exist.  Savecore not run.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/X11R6/lib /usr/local/lib
a.out ldconfig path: /usr/lib/aout /usr/lib/compat/aout /usr/X11R6/lib/aout
Starting usbd.
usb: Kernel module not available: No such file or directory
Starting local daemons:.
Updating motd.
Starting sshd.
Initial i386 initialization:.
Additional ABI support: linux.
Starting cron.
Local package initialization:.
Additional TCP options:.
Starting background file system checks in 60 seconds.

Sun Apr  1 02:11:43 UTC 2007

FreeBSD/i386 (demo.freebsd.org) (xc0)

login:

The domU should run the FreeBSD 7.0-CURRENT kernel:

# uname -a
FreeBSD demo.freebsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #113: Wed Jan  4 06:25:43 UTC 2006
kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF  i386

The network can now be configured on the domU. The FreeBSD domU will use a specific interface called xn0:

# ifconfig xn0 10.10.10.200 netmask 255.0.0.0
# ifconfig
xn0: flags=843<UP,BROADCAST,RUNNING,SIMPLEX> mtu 1500
    inet 10.10.10.200 netmask 0xff000000 broadcast 10.255.255.255
    ether 00:16:3e:6b:de:3a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
      inet6 ::1 prefixlen 128
      inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
      inet 127.0.0.1 netmask 0xff000000

On dom0 Slackware, some Xen dependant network interfaces should show up:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:E9:A0:02:C2
          inet addr:10.10.10.130  Bcast:0.0.0.0  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:815 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1400 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:204857 (200.0 KiB)  TX bytes:129915 (126.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:99 errors:0 dropped:0 overruns:0 frame:0
          TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9744 (9.5 KiB)  TX bytes:9744 (9.5 KiB)

peth0     Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:1853349 errors:0 dropped:0 overruns:0 frame:0
          TX packets:952923 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2432115831 (2.2 GiB)  TX bytes:86528526 (82.5 MiB)
          Base address:0xc000 Memory:ef020000-ef040000 

vif0.1    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:1400 errors:0 dropped:0 overruns:0 frame:0
          TX packets:815 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:129915 (126.8 KiB)  TX bytes:204857 (200.0 KiB)

vif1.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:157 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:140 (140.0 b)  TX bytes:158 (158.0 b)

xenbr1    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:112 (112.0 b)  TX bytes:0 (0.0 b)
# brctl show
bridge name     bridge id           STP enabled         interfaces
xenbr1          8000.feffffffffff   no                  vif0.1
                                                        peth0
                                                        vif1.0

22.2.3 Virtual PC on Windows

Virtual PC for Windows is a Microsoft software product available for free download. See system requirements. Once Virtual PC has been installed on Microsoft Windows, the user must configure a virtual machine and then install the desired guest operating system.


22.2.3.1 Installing FreeBSD on Virtual PC/Microsoft® Windows

The first step in installing FreeBSD on Microsoft Windows /Virtual PC is to create a new virtual machine for installing FreeBSD. Select Create a virtual machine when prompted:

And select Other as the Operating system when prompted:

Then, choose a reasonable amount of disk and memory depending on your plans for this virtual FreeBSD instance. 4GB of disk space and 512MB of RAM work well for most uses of FreeBSD under Virtual PC:

Save and finish the configuration:

Select your FreeBSD virtual machine and click Settings, then set the type of networking and a network interface:

After your FreeBSD virtual machine has been created, you will need to install FreeBSD on it. This is best done with an official FreeBSD CDROM or with an ISO image downloaded from an official FTP site. When you have the appropriate ISO image on your local Windows filesystem or a CDROM in your CD drive, double click on your FreeBSD virtual machine to boot. Then, click CD and choose Capture ISO Image… on Virtual PC window. This will bring up a window that allows you to associate the CDROM drive in your virtual machine with an ISO file on disk or with your real CDROM drive.

Once you have made this association with your CDROM source, reboot your FreeBSD virtual machine as normal by clicking the Action and Reset. Virtual PC will reboot with a special BIOS that first checks if you have a CDROM just as a normal BIOS would do.

In this case it will find the FreeBSD installation media and begin a normal sysinstall based installation as described in Chapter 2. You may install, but do not attempt to configure X11 at this time.

When you have finished the installation, remember to eject CDROM or release ISO image. Finally, reboot into your newly installed FreeBSD virtual machine.


22.2.3.2 Configuring FreeBSD on Microsoft Windows/Virtual PC

After FreeBSD has been successfully installed on Microsoft Windows with Virtual PC, there are a number of configuration steps that can be taken to optimize the system for virtualized operation.

  1. Set boot loader variables

    The most important step is to reduce the kern.hz tunable to reduce the CPU utilization of FreeBSD under the Virtual PC environment. This is accomplished by adding the following line to /boot/loader.conf:

    kern.hz=100

    Without this setting, an idle FreeBSD Virtual PC guest OS will use roughly 40% of the CPU of a single processor computer. After this change the usage will be closer to a mere 3%.

  2. Create a new kernel configuration file

    You can remove all of the SCSI, FireWire, and USB device drivers. Virtual PC provides a virtual network adapter used by the de(4) driver, so all other network devices except for de(4) and miibus(4) can be removed from the kernel.

  3. Setup networking

    The most basic networking setup involves simply using DHCP to connect your virtual machine to the same local area network as your host Microsoft Windows. This can be accomplished by adding ifconfig_de0="DHCP" to /etc/rc.conf. More advanced networking setups are described in Chapter 31.


22.2.4 VMWare on MacOS

VMWare Fusion for Mac is a commercial software product available for Intel based Apple Mac computers running Mac OS 10.4.9 or higher. FreeBSD is a fully supported guest operating system. Once VMWare Fusion has been installed on Mac OS X, the user must configure a virtual machine and then install the desired guest operating system.


22.2.4.1 Installing FreeBSD on VMWare/Mac OS X

The first step is to start VMWare Fusion, the Virtual Machine Library will load. Click "New" to create the VM:

This will load the New Virtual Machine Assistant to help you create the VM, click Continue to proceed:

Select Other as the Operating System and FreeBSD or FreeBSD 64-bit, depending on if you want 64-bit support, as the Version when prompted:

Choose the Name of the VM Image and the Directory where you would like it saved:

Choose the size of the Virtual Hard Disk for the VM:

Choose the method you would like to install the VM, either from an ISO image or from a CD:

Once you click Finish, the VM will boot:

Install FreeBSD like you normally would, or by following the directions in Chapter 2:

Once the install is complete you can modify the settings of the VM, such as Memory Usage:

Note: The System Hardware settings of the VM cannot be modified while the VM is running.

The number of CPUs the VM will have access to:

The status of the CD-Rom Device. Normally you can disconnect the CD-Rom/ISO from the VM if you will not be needing it anymore.

The last thing to change is how the VM will connect to the Network. If you want to allow connections to the VM from other machines besides the Host, make sure you choose the Connect directly to the physical network (Bridged). Otherwise Share the host’s internet connection (NAT) is preferred so that the VM can have access to the Internet, but the network cannot access the VM.

After you have finished modifying the settings, boot the newly installed FreeBSD virtual machine.


22.2.4.2 Configuring FreeBSD on Mac OS X/VMWare

After FreeBSD has been successfully installed on Mac OS X with VMWare, there are a number of configuration steps that can be taken to optimize the system for virtualized operation.

  1. Set boot loader variables

    The most important step is to reduce the kern.hz tunable to reduce the CPU utilization of FreeBSD under the VMWare environment. This is accomplished by adding the following line to /boot/loader.conf:

    kern.hz=100

    Without this setting, an idle FreeBSD VMWare guest OS will use roughly 15% of the CPU of a single processor iMac. After this change the usage will be closer to a mere 5%.

  2. Create a new kernel configuration file

    You can remove all of the FireWire, and USB device drivers. VMWare provides a virtual network adapter used by the em(4) driver, so all other network devices except for em(4) can be removed from the kernel.

  3. Setup networking

    The most basic networking setup involves simply using DHCP to connect your virtual machine to the same local area network as your host Mac. This can be accomplished by adding ifconfig_em0="DHCP" to /etc/rc.conf. More advanced networking setups are described in Chapter 31.


22.3 FreeBSD as a Host OS

FreeBSD is not officially supported by any virtualization package as a host operating system at this time, but many people use older versions of VMware in this capacity. Work is also ongoing in getting Xen to work as a host environment on FreeBSD.

Tags: bsd, cron, domain, freebsd, FreeBSD Handbook, ftp, slackware, software, ssh, virtualization, vmware, xen

Related posts

FreeBSD Handbook , , , , , , , , , ,

Slackware Linux Essentials - Appendix A. The GNU General Public License

January 5th, 2009

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


A.1. Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software–to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author’s protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors’ reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone’s free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.


A.2. TERMS AND CONDITIONS

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.

    Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

  2. You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

    You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

  3. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

    1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

    2. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

    3. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

    These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

    Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

    In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

  4. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

    1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

    2. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

    3. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

    The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

    If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

  5. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

  6. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

  7. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

  8. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

    If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

    It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

    This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

  9. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

  10. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

    Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

  11. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

  12. NO WARRANTY

    BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS


A.3. How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
   Copyright (C) <year>  <name of author>

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307 USA

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year  name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w’ and `show c’ should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w’ and `show c’; they could even be mouse-clicks or menu items–whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.

Tags: protection, slackware, Slackware Linux Essentials, software, ssl

Related posts

Slackware Linux Essentials , , ,

Slackware Linux Essentials - Glossary

January 5th, 2009
Account

All of the information about a user, including username, password, finger information, UID and GID, and home directory. To create an account is to add and define a user.

Background

Any process that is running without accepting or controlling the input of a terminal is said to be running in the background.

Boot disk

A floppy disk containing an operating system (in our case, the Linux kernel) from which a computer can be started.

Compile

To convert source code to machine-readable “binary” code.

Daemon

A program designed to run in the background and, without user intervention, perform a specific task (usually providing a service).

Darkstar

The default hostname in Slackware; your computer will be called darkstar if you do not specify some other name.

One of Patrick Volkerding’s development machines, named after “Dark Star”, a song by the Grateful Dead.

Desktop Environment

A graphical user interface (GUI) that runs atop the X Window System and provides such features as integrated applications, cohesive look-and-feel between programs and components, file and window management capabilities, etc. A step beyond the simple window manager.

Device driver

A chunk of code in the kernel that directly controls a piece of hardware.

Device node

A special type of file in the /dev filesystem that represents a hardware component to the operating system.

DNS

Domain Name Service. A system in which networked computers are given names which translate to numerical addresses.

Domain name

A computer’s DNS name, excluding its host name.

Dot file

In Linux, files which are to be hidden have filenames beginning with a dot (’.').

Dotted quad

The format of IP addresses, so called because it consists of four numbers (range 0-255 decimal) separated by periods.

Dynamic loader

When programs are compiled under Linux, they usually use pieces of code (functions) from external libraries. When such programs are run, those libraries must be found and the required functions loaded into memory. This is the job of the dynamic loader.

Environment variable

A variable set in the user’s shell which can be referenced by that user or programs run by that user within that shell. Environment variables are generally used to store preferences and default parameters.

Epoch

A period of history; in Unix, “The Epoch” begins at 00:00:00 UTC January 1, 1970. This is considered the “dawn of time” by Unix and Unix-like operating systems, and all other time is calculated relative to this date.

Filesystem

A representation of stored data in which “files” of data are kept organized in “directories”. The filesystem is the nearly universal form of representation for data stored to disks (both fixed and removable).

Foreground

A program that is accepting or controlling a terminal’s input is said to be running in the foreground.

Framebuffer

A type of graphics device; in Linux, this most often refers to the software framebuffer, which provides a standard framebuffer interface to programs while keeping specific hardware drivers hidden from them. This layer of abstraction frees programs of the need to speak to various hardware drivers.

FTP

The File Transfer Protocol. FTP is a very popular method of transferring data between computers.

Gateway

A computer through which data on a network is transferred to another network.

GID

Group Identifier. The GID is a unique number attributed to a group of users.

Group

Users in Unix belong to “groups”, which can contain many other users and are used for more general access control than the existence of users alone can easily allow.

GUI

Graphical User Interface. A software interface that uses rendered graphical elements such as buttons, scrollbars, windows, etc. rather than solely text-based input and output

Home directory

A user’s “home directory” is the directory the user is placed in immediately upon logging in. Users have full permissions and more or less free reign within their home directories.

HOWTO

A document describing “how to” do something, such as configure a firewall or manage users and groups. There is a large collection of these documents available from the Linux Documentation Project.

HTTP

The Hypertext Transfer Protocol. HTTP is the primary protocol on which the World Wide Web operates.

ICMP

Internet Control Message Protocol. A very basic networking protocol, used mostly for pings.

Kernel

The heart of an operating system. The kernel is the part that provides basic process control and interfaces with the computer’s hardware.

Kernel module

A piece of kernel code, usually a driver of some sort, that can be loaded and unloaded from memory separately from the main body of the kernel. Modules are handy when upgrading drivers or testing kernel settings, because they can be loaded and unloaded without rebooting.

Library

A collection of functions which can be shared between programs.

LILO

The LInux LOader. LILO is the most widely-used Linux boot manager.

LOADLIN

LOADLIN is a program that runs under MS DOS or Windows and boots a Linux system. It is most commonly used on computers with multiple operating systems (including Linux and DOS/Windows, of course).

Man section

Pages in the standard Unix online manual ("man") are grouped into sections for easy reference. All C programming pages are in section 3, system administration pages in section 5, etc.

MBR

The Master Boot Record. A reserved space on a hard drive where information on what to do when booting is stored. LILO or other boot managers can be written here.

Motif

A popular programming toolkit used in many older X programs.

MOTD

Message of the Day. The motd (stored in Linux in /etc/motd is a text file that is displayed to all users upon logging in. Traditionally, it is used by the system administrator as a sort of “bulletin board” for communicating with users.

Mount point

An empty directory in a filesystem where another filesystem is to be “mounted”, or grafted on.

Nameserver

A DNS information server. Nameservers translate DNS names to numerical IP addresses.

Network interface

A virtual representation of a network device provided by the kernel. Network interfaces allow users and programs to talk to network devices.

NFS

The Network Filesystem. NFS allows the mounting of remote filesystems as if they were local to your computer and thus provides a transparent method of file sharing.

Octal

Base-8 number system, with digits 0-7.

Pager

An X program that allows the user to see and switch between multiple “desktops”.

Partition

A division of a hard drive. Filesystems exist on top of partitions.

PPP

Point-to-Point Protocol. PPP is used mainly for connecting via modem to an Internet Service Provider.

Process

A running program.

Root directory

Represented as “/”, the root directory exists at the top of the filesystem, with all other directories branching out beneath it in a “file tree”.

Root disk

The disk (usually fixed) on which the root directory is stored.

Routing table

The set of information the kernel uses in “routing” network data around. It contains such tidbits as where your default gateway is, which network interface is connected to which network, etc.

Runlevel

The overall system state as defined by init. Runlevel 6 is rebooting, runlevel 1 is “single user mode”, runlevel 4 is an X login, etc. There are 6 available runlevels on a Slackware system.

Secure shell

An encrypted (thus secure) method of logging in remotely to a computer. Many secure shell programs are available; both a client and server are needed.

Service

The sharing of information and/or data between programs and computers from a single “server” to multiple “clients”. HTTP, FTP, NFS, etc. are services.

Shadow password suite

The shadow password suite allows encrypted passwords to be hidden from users, while the rest of the information in the /etc/passwd file remains visible to all. This helps prevent brute-force attempts at cracking passwords.

Shell

Shells provide a commandline interface to the user. When you’re looking at a text prompt, you’re in a shell.

Shell builtin

A command built into the shell, as opposed to being provided by an external program. For instance, bash has a cd builtin.

Signal

Unix programs can communicate between each other using simple “signals”, which are enumerated and usually have specific meanings. kill -l will list the available signals.

SLIP

Serial Line Interface Protocol. SLIP is a similar protocol to PPP, in that it’s used for connecting two machines via a serial interface.

Software package

A program and its associated files, archived and compressed into a single file along with any necessary scripts or information to aid in managing the installation, upgrade, and removal of those files.

Software series

A collection of related software packages in Slackware. All KDE packages are in the “kde” series, networking packages in the “n” series, etc.

Source code

The (more or less) human-readable code in which most programs are written. Source code is compiled into “binary” code.

Standard Error (stderr)

The Unix-standard output stream for errors. Programs write any error messages on stderr, so that they can be separated from normal output.

Standard Input (stdin)

The Unix-standard input stream. Data can be redirected or piped into a program’s stdin from any source.

Standard Output (stdout)

The Unix-standard output stream. Normal text output from a program is written to stdout, which is separate from the error messages reported on stderr and can be piped or redirected into other programs’ stdin or to a file.

Subnet

An IP address range that is part of a larger range. For instance, 192.168.1.0 is a subnet of 192.168.0.0 (where 0 is a mask meaning “undefined”); it is, in fact, the “.1” subnet.

Superblock

In Linux, partitions are discussed in terms of blocks. A block is 512 bytes. The superblock is the first 512 bytes of a partition.

Supplemental disk

In Slackware, a floppy disk used during installation that contains neither the kernel (which is on the boot disk) nor the root filesystem (which is on the root disk), but additional needed files such as network modules or PCMCIA support.

Suspended process

A process which has been frozen until killed or resumed.

Swap space

Disk space used by the kernel as “virtual” RAM. It is slower than RAM, but because disk space is cheaper, swap is usually more plentiful. Swap space is useful to the kernel for holding lesser-used data and as a fallback when physical RAM is exhausted.

Symbolic link

A special file that simply points to the location of another file. Symbolic links are used to avoid data duplication when a file is needed in multiple locations.

Tagfile

A file used by the Slackware setup program during installation, which describes a set of packages to be installed.

Terminal

A human-computer interface consisting of at least a screen (or virtual screen) and some method of input (almost always at least a keyboard).

Toolkit, GUI

A GUI toolkit is a collection of libraries that provide a programmer with code to draw “widgets” such as scrollbars, checkboxes, etc. and construct a graphical interface. The GUI toolkit used by a program often defines its “look and feel”.

UID

User Identifier. A unique number that identifies a user to the system. UIDs are used by most programs instead of usernames because a number is easier to deal with; usernames are generally only used when the user has to see things happen.

VESA

Video Electronics Standards Association. The term “VESA” is often used to denote a standard specified by said Association. Nearly all modern video adapters are VESA-compliant.

Virtual terminal

The use of software to simulate multiple terminals while using only a single set of input/output devices (keyboard, monitor, mouse). Special keystrokes switch between virtual terminals at a single physical terminal.

Window manager

An X program whose purpose is to provide a graphical interface beyond the simple rectangle-drawing of the X Window System. Window managers generally provide titlebars, menus for running programs, etc.

Working directory

The directory in which a program considers itself to be while running.

Wrapper program

A program whose sole purpose is to run other programs, but change their behavior in some way by altering their environments or filtering their input.

X server

The program in the X Window System which interfaces with graphics hardware and handles the actual running of X programs.

X Window System

Network-oriented graphical interface system used on most Unix-like operating systems, including Linux.

Tags: account, archive, domain, domain name, ftp, manage, password, pop, raw, slackware, Slackware Linux Essentials, software

Related posts

Slackware Linux Essentials , , , , , , , , , ,

Slackware Linux Essentials - Chapter 19 ZipSlack

January 5th, 2009

19.1 What is ZipSlack?

ZipSlack is a special version of Slackware Linux. It’s an already installed copy of Slackware that’s ready to run from your DOS or Windows partition. It’s a basic installation, you do not get everything that comes with Slackware.

ZipSlack gets its name from the form it’s distributed in, a big .ZIP file. Users of DOS and Windows will probably be familiar with these files. They are compressed archives. The ZipSlack archive contains everything you need to get up and running with Slackware.

It is important to note that ZipSlack is significantly different from a regular installation. Even though they function the same and contain the same programs, their intended audiences and functions differ. Several advantages and disadvantages of ZipSlack are discussed below.

One last thing, you should always review the documentation included in the actual ZipSlack directory. It contains the latest information regarding installation, booting, and general use of the product.


19.1.1 Advantages
  • Does not require repartitioning of your hard disk.

  • Great way to learn Slackware Linux without stumbling through the installation process.


19.1.2 Disadvantages
  • Uses the DOS filesystem, which is slower than a native Linux filesystem.

  • Will not work with Windows NT.


19.2 Getting ZipSlack

Obtaining ZipSlack is easy. If you have purchased the official Slackware Linux CD set, then you already have ZipSlack. Just find the CD that contains the zipslack directory and place it in your CD-ROM drive. It’s usually the third or fourth disc, but always trust the labels over this documentation as the disk it resides on is prone to change.

If you want to download ZipSlack, you should first visit our “Get Slack” web page for the latest download information:

http://www.slackware.com/getslack/

ZipSlack is part of each Slackware release. Locate the release you want, and go to that directory on the FTP site. The latest release directory can be found at this location:

ftp://ftp.slackware.com/pub/slackware/slackware/

You’ll find ZipSlack in the /zipslack subdirectory. ZipSlack is offered as one big .ZIP file or floppy-sized chunks. The chunks are in the /zipslack/split directory.

Don’t stop at just the .ZIP files. You should also download the documentation files and any boot images that appear in the directory.


19.2.1 Installation

Once you’ve downloaded the necessary components, you’ll need to extract the .ZIP file. Be sure to use a 32-bit unzipper. The size and filenames in the archive are too much for a 16-bit unzipper. Examples of 32-bit unzippers include WinZip and PKZIP for Windows.

ZipSlack is designed to be extracted directly to the root directory of a drive (such as C: or D:). A \LINUX directory will be created that contains the actual Slackware installation. You’ll also find the files necessary to booting the system in that directory as well.

After you’ve extracted the files, you should have a \LINUX directory on the drive of your choosing (we’ll use C: from here on).


19.3 Booting ZipSlack

There are several ways to boot ZipSlack. The most common is to use the included LINUX.BAT to boot the system from DOS (or from DOS mode under Windows 9x). This file must be edited to match your system before it will work.

Start by opening the C:\LINUX\LINUX.BAT file in your favorite text editor. At the top of the file you will notice a large comment. It explains what you need to edit in this file (and also what to do if you are booting from an external Zip drive). Don’t worry if you don’t understand the root= setting. There are several examples, so feel free to pick one and try it. If it doesn’t work, you can edit the file again, comment out the line you uncommented, and pick another one.

After you uncomment the line you want by removing the “rem” at the beginning of the line, save the file and exit the editor. Bring your machine into DOS mode.

A DOS prompt window in Windows 9x will NOT work.

Type C:\LINUX\LINUX.BAT to boot the system. If all goes well, you should be presented with a login prompt.

Log in as root, with no password. You’ll probably want to set a password for root, as well as adding an account for yourself. At this point you can refer to the other sections in this book for general system usage.

If using the LINUX.BAT file to boot the system didn’t work for you, you should refer to the included C:\LINUX\README.1ST file for other ways to boot.

Tags: account, archive, ftp, password, slackware, Slackware Linux Essentials

Related posts

Slackware Linux Essentials , , , ,

Slackware Linux Essentials - Chapter 18 Slackware Package Management

January 5th, 2009

A software package is a bundle of related programs that are ready for you to install. When you download a source code archive, you have to configure, compile, and install it by hand. With a software package, this has already been done for you. All that you have to do is install the package. Another handy feature of using software packages is that it is very easy to remove and upgrade them, if you so desire. Slackware comes with programs for all your package management needs. You can install, remove, upgrade, make, and examine packages very easily.

There’s a myth that’s been going around ever since RedHat debuted RedHat Package Manager, that Slackware has no package management tool. This simply couldn’t be further from the truth. Slackware has always included a package manager, even before RedHat existed. While not as full-featured or as ubiquitous as rpm (or for that matter deb), pkgtool and its associated programs are every bit as good at installing packages as rpm. The truth about pkgtool is not that it doesn’t exist, but that it doesn’t do any dependency checking.

Apparently many people in the Linux community think that a packager manager must by definition include dependency checking. Well, that simply isn’t the case, as Slackware most certainly does not. This is not to say that Slackware packages don’t have dependencies, but rather that its package manager doesn’t check for them. Dependency management is left up to the sysadmin, and that’s the way we like it.


18.1 Overview of Package Format

Before learning the utilities, you should become familiar with the format of a Slackware package. In Slackware, a package is simply a tar archive file that has been compressed with gzip. Packages are built to be extracted in the root directory.

Here is a fictitious program and its example package:

./
usr/
usr/bin/
usr/bin/makehejaz
usr/doc/
usr/doc/makehejaz-1.0/
usr/doc/makehejaz-1.0/COPYING
usr/doc/makehejaz-1.0/README
usr/man/
usr/man/man1
usr/man/man1/makehejaz.1.gz
install/
install/doinst.sh

The package system will extract this file in the root directory to install it. An entry in the package database will be created that contains the contents of this package so that it can be upgraded or removed later.

Notice the install/ subdirectory. This is a special directory that can contain a postinstallation script called doinst.sh. If the package system finds this file, it will execute it after installing the package.

Other scripts can be embedded in the package, but those are discussed more in detail in Section 18.3.2 below.


18.2 Package Utilities

There are four main utilities for package management. They perform installation, removal, and upgrades of packages.


18.2.1 pkgtool

pkgtool(8) is a menu-driven program that allows installation and removal of packages. The main menu is shown in Figure 18-1.

Figure 18-1. Pkgtool’s main menu.

Installation is offered from the current directory, another directory, or from floppy disks. Simply select the installation method you want and pkgtool will search that location for valid packages to install.

You may also view a list of installed packages, as shown in Figure 18-2.

Figure 18-2. Pkgtool view mode

If you want to remove packages, select the remove option and you will be presented with a checklist of all the installed packages. Flag the ones you want to remove and select OK. pkgtool will remove them.

Some users prefer this utility to the command line utilities. However, it should be noted that the command line utilities offer many more options. Also, the ability to upgrade packages is only offered through the command line utilities.


18.2.2 installpkg

installpkg(8) handles installation of new packages on the system. The syntax is as follows:

# installpkg option package_name

Three options are provided for installpkg. Only one option can be used at a time.

Table 18-1. installpkg Options

Option

Effects

-m

Performs a makepkg operation on the current directory.

-warn

Shows what would happen if you installed the specified package. This is useful for production systems so you can see exactly what would happen before installing something.

-r

Recursively install all packages in the current directory and down. The package name can use wildcards, which would be used as the search mask when recursively installing.

If you pass the ROOT environment variable before installpkg, that path will be used for the root directory. This is useful for setting up new drives for your root directory. They will typically be mounted to /mnt or something other than /.

The installed package database entry is stored in /var/log/packages. The entry is really just a plain text file, one for each package. If the package has a postinstallation script, it is written to /var/log/scripts/.

You may specify several packages or use wildcards for the package name. Be advised that installpkg will not tell you if you are overwriting an installed package. It will simply install right on top of the old one. If you want to ensure that old files from the previous package are safely removed, use upgradepkg.


18.2.3 removepkg

removepkg(8) handles removing installed packages from the system. The syntax is as follows:

# removepkg option package_name

Four options are provided for removepkg. Only one option may be used at a time.

Table 18-2. removepkg Options

Option

Effects

-copy

The package is copied to the preserved packages directory. This creates a tree of the original package without removing it.

-keep

Saves temporary files created during the removal. Really only useful for debugging purposes.

-preserve

The package is removed, but copied to the preserved packages directory at the same time.

-warn

Shows what would happen if you removed the package.

If you pass the ROOT environment variable before removepkg, that path will be used for the root directory. This is useful for setting up new drives for your root directory. They will typically be mounted to /mnt or something other than /.

removepkg looks at the other installed packages and only removes files unique to the package you specify. It will also scan the postinstallation script for the specified package and remove any symbolic links that were created by it.

During the removal process, a status report is displayed. After the removal, the package database entry is moved to /var/log/removed_packages and the postinstallation script is moved to /var/log/removed_scripts.

Just as with installpkg, you can specify several packages or use wildcards for the package name.


18.2.4 upgradepkg

upgradepkg(8) will upgrade an installed Slackware package. The syntax is as follows:

# upgradepkg package_name

or

# upgradepkg old_package_name%new_package_name

upgradepkg works by first installing the new package and then removing the old package so that old files are no longer around on the system. If the upgraded package name has changed, use the percent sign syntax to specify the old package (the one that is installed) and the new package (the one you are upgrading it to).

If you pass the ROOT environment variable before upgradepkg, that path will be used for the root directory. This is useful for setting up new drives for your root directory. They will typically be mounted to /mnt or something other than /.

upgradepkg is not flawless. You should always back up your configuration files. If they get removed or overwritten, you’ll want a copy of the originals for any needed repair work.

Just as with installpkg and removepkg, you can specify several packages or use wildcards for the package name.


18.2.5 rpm2tgz/rpm2targz

The Red Hat Package Manager is a popular packaging system available today. Many software distributors are offering their products in RPM format. Since this is not our native format, we do not recommend people rely on them. However, some things are only available as an RPM (even the source).

We provide a program that will convert RPM packages to our native .tgz format. This will allow you to extract the package (perhaps with explodepkg) to a temporary directory and examine its contents.

The rpm2tgz program will create a Slackware package with a .tgz extension, while rpm2targz creates an archive with a .tar.gz extension.


18.3 Making Packages

Making Slackware packages can be either easy or difficult. There is no specific method for building a package. The only requirement is that the package be a tar gzipped file and if there is a postinstallation script, it must be /install/doinst.sh.

If you are interested in making packages for your system or for a network that you manage, you should have a look at the various build scripts in the Slackware source tree. There are several methods we use for making packages.


18.3.1 explodepkg

explodepkg(8) will do the same thing that installpkg does to extract the package, but it doesn’t actually install it and it doesn’t record it in the packages database. It simply extracts it to the current directory.

If you look at the Slackware source tree, you will see how we use this command for “framework” packages. These packages contain a skeleton of what the final package will look like. They hold all the necessary filenames (zero-length), permissions, and ownerships. The build script will cat the package contents from the source directory to the package build directory.


18.3.2 makepkg

makepkg(8) will package up the current directory into a valid Slackware package. It will search the tree for any symbolic links and add a creation block to the postinstallation script for creating them during the package install. It also warns of any zero-length files in the package tree.

This command is typically run after you have created your package tree.


18.3.3 SlackBuild Scripts

Slackware packages are built in many different ways by necessity. Not all software packages are written by their programmers to compile the same way. Many have compile time options that are not all included in the packages Slackware uses. Perhaps you need some of this functionality; you’ll need to compile your own package then. Fortunately for many Slackware packages, you can find SlackBuild scripts in the package’s source code.

So what is a SlackBuild script? SlackBuild scripts are executable shell scripts that you run as root to configure, compile, and create Slackware packages. You can freely modify these scripts in the source directory and run them to create your own versions of the default Slackware packages.


18.4 Making Tags and Tagfiles (for setup)

The Slackware setup program handles installation of the software packages on your system. There are files that tell the setup program which packages must be installed, which ones are optional, and which ones are selected by default by the setup program.

A tagfile is in the first software series directory and is called tagfile. It lists the packages in that particular disk set and their status. The status can be:

Table 18-3. Tagfile Status Options

Option

Meaning

ADD

The package is required for proper system operation

SKP

The package will be automatically skipped

REC

The package is not required, but recommended

OPT

The package is optional

The format is simply:

package_name: status

One package per line. The original tagfiles for each software series are stored as tagfile.org. So if you mess up yours, you can restore the original one.

Many administrators prefer writing their own tagfiles and starting the installer and selecting “full”. The setup program will read the tagfiles and perform the installation according to their contents. If you use REC or OPT, a dialog box will be presented to the user asking whether or not they want a particular package. Therefore, it is recommended that you stick with ADD and SKP when writing tagfiles for automated installs.

Just make sure your tagfiles are written to the same location as the originals. Or you can specify a custom tagfile path if you have custom tagfiles.

Tags: archive, database, manage, pop, redhat, slackware, Slackware Linux Essentials, software

Related posts

Slackware Linux Essentials , , , , , ,