# I - Preinstallation steps

From now on this guide assumes that you're using a real tape library. However, you can give [MHVTL](http://www.mhvtl.com/) a try to test with a virtual tape library instead.

Before installing CTA, make sure you have the following packages, which will be useful for tape management later on (See: [*Know your tape library with mtx and mt*](https://ctadcache.gitbook.io/the-cta-book/chapter-ii-getting-started/i-preinstallation-steps/know-your-tape-library-with-mtx-and-mt))

* **`mt-st`**:  magnetic tape drive control tool
* **`mtx`**:  SCSI media changer device control tool
* **`lsscsi`**: list SCSI devices

Other packages you need in order to start the preinstallation steps are:

* yum-utils
* yum-plugin-priorities
* yum-plugin-versionlock

First we are going to add the cta-public repository to `/etc/yum.repos.d`directory.&#x20;

```
# CTA-4
[cta-public]
name=CERN Tape Archive
baseurl=https://cta-public-repo.web.cern.ch/cta-4/el-7/cta
enabled=1
gpgcheck=0
exclude=yum-conf*
metadata_expire=43200
skip_if_unavailable=1
keepcache = 0

# CTA-5
[cta-public]
name=CERN Tape Archive
baseurl=https://cta-public-repo.web.cern.ch/cta-5/el-7/cta
enabled=1
gpgcheck=0
exclude=yum-conf*
metadata_expire=43200
skip_if_unavailable=1
keepcache = 0
```

You'll notice that you can choose between CTA-4 or CTA-5. For CTA the versioning convention is to have the major version **match the XRootD version it is compiled against**. For more information about versioning, see [*CTA Version Numbering (EOSCTA Docs)*](https://eoscta.docs.cern.ch/cta/tag_cta/#cta-version-numbering)*.*&#x20;

Once you have decided which version you are going to use and you've set the proper repository, let's install the first package, which is *cta-release.*&#x20;

```
yum install cta-release
```

The ***cta-release*** rpm allows us to create an appropiate versionlock file specifying the correct version of all CTA packages and dependencies in order to not mess up with the installation. \
Note that if you don't specify the version, yum will try to install the latest version found on the repo.\
\
Once installed, check that the following repositories have been added to `/etc/yum.repos.d`:

* cta-ceph.repo
* cta-eos-citrine.repo
* cta-eos-citrine-depend.repo
* cta-eos-diopside.repo
* cta-eos-diopside-depend.repo
* cta-eos-quarkdb.repo
* cta-oracle-instant-client.repo

Let's create our `versionlock.list`. This is a text file that specifies the exact version of packages and its dependencies. These will match the cta-release version.\
Create the versionlock.list with the following command:

```
cta-versionlock apply
Adding CTA packages and dependencies to versionlock.list
==> adding: 95/95
```

We can check the versionlock.list either directly looking at the file (at `/etc/yum/pluginconf.d/versionlock.list`) or with the following comand:

```
cta-versionlock check

Yum versionlock status for CTA packages and dependencies
==> ok: 95/95
```

If you already had an older versionlock.list and some versions are wrong, you can always overwrite them with:

```
cta-versionlock forceupdate
Adding and updating CTA packages and dependencies in versionlock.list
==> updating: 0/95 Nothing to do
```

This way you cannot mess up with packages versioning when installing.&#x20;

You've finished the preinstallation steps. Jump to [*II - Installation guide*](https://ctadcache.gitbook.io/the-cta-book/chapter-ii-getting-started/ii-installation-guide) to continue!
