Project

General

Profile

TOC PREV NEXT
Fermilab CD logo Complete Guide and Reference Manual for UPS and UPD

Chapter Contents

Chapter 7: Installing Products Using tar
   7.1 Overview of Using tar to Install Products
   7.2 Requirements for tar usage
   7.3 Creating the Tarfile
   7.4 Moving the Tarfile
   7.5 Unpacking the Tarfile

  Chapter 7: Installing Products Using tar

  This chapter describes how to use tar to install products.

Originally developed to back up files to tape-based storage devices in UNIX, tar was later formalized as part of the POSIX standard, and today is used to collect, distribute, and archive files, while preserving file system attributes such as user and group permissions, access and modification dates, and directory structures.

The GNU version of tar is included with most modern variants of the Linux operating system.

  7.1 Overview of Using tar to Install Products

  The UNIX command tar can be used to combine files into a single file, for easy storage and distribution.

The first argument to tar should be a letter. It doesn't need to be prefixed with a dash ("-"), and may be combined with other single-letter options.

For example, the following commands are all equivalent:

% tar -c -f -z archive.tgz file1 file2

% tar -cfz archive.tgz file1 file2

% tar cfz archive.tgz file1 file2

Note, using the -z option does not automatically make the proper extension. It's a good habit to indicate when compression was used in creating the tar file by ending the file with .tgz
While there are many options available with the tar command, the following are of interest for installing products using tar .

c Create a new archive.
f file.tgz Use archive file.tgz
j Use bzip2 compression
v verbose, list the files in the archive
x extract the files
z use compression, usually gzip

  7.2 Requirements for tar usage

  Using tar requires UPS version 5 or later. To use the tar command, the directory structure of the source and destination product areas must be the same. To check this in ups v5_1 or later, run:

% ups layout

If it returns 'unified', then tar can be used. In the following output:

"/scratch/mengel/p": "unified" 
"/fnal/ups/db": "traditional" 
"/afs/fnal.gov/ups/db": "traditional" 

tar can be used for /scratch/mengel/p.
p<>. For earlier versions of ups , see Checking Layout Before ups V5_1

  7.3 Creating the Tarfile

  Once the layout has been verified as described above, the user changes directory to the products area and runs the tar command.

% cd /products/area
% tar czvf /tmp/transfer_me.tgz  product1 product2/vx_y_z*

This command packs up all versions of product1 and version vx_y_z of product2 into /tmp/transfer_me.tgz. Note: the user could specify a different suffix for the file, or leave one off entirely. We recommend ending the file with the options used to create it, so if the z options was used, then ending the file in .tgz will indicate that it is a gzip compressed tar archive file.

  7.4 Moving the Tarfile

  The tarfile can be transferred via Google Docs, SCP, put on a webserver, or however the user wishes to get it to the machine to install it on.

  7.5 Unpacking the Tarfile

  The user changes directory to the products area and runs the tar command.

% cd /other/products/area
% tar xzvf /tmp/transfer_me.tgz

Users can also extract only particular packages from the tarfile, by listing exactly what is wanted.

% tar xzvf /tmp/transfer_me.tgz product1

Note, if the file was created with the appropriate name, then the -z option does not need to be specified. It will be deduced from the archive file name.

 

TOC PREV NEXT

This page last revised in May 2014

TOC PREV NEXT
Fermilab CD logo Complete Guide and Reference Manual for UPS and UPD

Chapter Contents

Chapter 7: Installing Products Using tar
   7.1 Overview of Using tar to Install Products
   7.2 Requirements for tar usage
   7.3 Creating the Tarfile
   7.4 Moving the Tarfile
   7.5 Unpacking the Tarfile

  Chapter 7: Installing Products Using tar

  This chapter describes how to use tar to install products.

Originally developed to back up files to tape-based storage devices in UNIX, tar was later formalized as part of the POSIX standard, and today is used to collect, distribute, and archive files, while preserving file system attributes such as user and group permissions, access and modification dates, and directory structures.

The GNU version of tar is included with most modern variants of the Linux operating system.

  7.1 Overview of Using tar to Install Products

  The UNIX command tar can be used to combine files into a single file, for easy storage and distribution.

The first argument to tar should be a letter. It doesn't need to be prefixed with a dash ("-"), and may be combined with other single-letter options.

For example, the following commands are all equivalent:

% tar -c -f -z archive.tgz file1 file2

% tar -cfz archive.tgz file1 file2

% tar cfz archive.tgz file1 file2

Note, using the -z option does not automatically make the proper extension. It's a good habit to indicate when compression was used in creating the tar file by ending the file with .tgz
While there are many options available with the tar command, the following are of interest for installing products using tar .

c Create a new archive.
f file.tgz Use archive file.tgz
j Use bzip2 compression
v verbose, list the files in the archive
x extract the files
z use compression, usually gzip

  7.2 Requirements for tar usage

  Using tar requires UPS version 5 or later. To use the tar command, the directory structure of the source and destination product areas must be the same. To check this in ups v5_1 or later, run:

% ups layout

If it returns 'unified', then tar can be used. In the following output:

"/scratch/mengel/p": "unified" 
"/fnal/ups/db": "traditional" 
"/afs/fnal.gov/ups/db": "traditional" 

tar can be used for /scratch/mengel/p.
p<>. For earlier versions of ups , see Checking Layout Before ups V5_1

  7.3 Creating the Tarfile

  Once the layout has been verified as described above, the user changes directory to the products area and runs the tar command.

% cd /products/area
% tar czvf /tmp/transfer_me.tgz  product1 product2/vx_y_z*

This command packs up all versions of product1 and version vx_y_z of product2 into /tmp/transfer_me.tgz. Note: the user could specify a different suffix for the file, or leave one off entirely. We recommend ending the file with the options used to create it, so if the z options was used, then ending the file in .tgz will indicate that it is a gzip compressed tar archive file.

  7.4 Moving the Tarfile

  The tarfile can be transferred via Google Docs, SCP, put on a webserver, or however the user wishes to get it to the machine to install it on.

  7.5 Unpacking the Tarfile

  The user changes directory to the products area and runs the tar command.

% cd /other/products/area
% tar xzvf /tmp/transfer_me.tgz

Users can also extract only particular packages from the tarfile, by listing exactly what is wanted.

% tar xzvf /tmp/transfer_me.tgz product1

Note, if the file was created with the appropriate name, then the -z option does not need to be specified. It will be deduced from the archive file name.

 

TOC PREV NEXT

This page last revised in May 2014