Difference between revisions of "Install Apertium core using packaging"

From Apertium
Jump to navigation Jump to search
(Add mixed-install cleanup script)
Line 73: Line 73:


Which will, if nothing else, tell you a lot about byways of the Apertium project.
Which will, if nothing else, tell you a lot about byways of the Apertium project.

==== Cleaning up a mixed install ====
If you have installed some of the core tools from source and want to switch to packages, you can remove the source install with something like this. Be extremely careful with getting this right so it doesn't wipe your whole machine.

<pre>
# Wipe most files
rm -rfv /usr/local/*/*apertium* /usr/local/*/*/*apertium*
rm -rfv /usr/local/bin/lt-*
rm -rfv /usr/local/*/*lttoolbox* /usr/local/*/*/*lttoolbox*
rm -rfv /usr/local/*/*hfst* /usr/local/*/*/*hfst*
rm -rfv /usr/local/bin/cg-*
rm -rfv /usr/local/*/*cg3* /usr/local/*/*/*cg3*

# Wipe any certain conflicting file
grep -h '^Package:' /var/lib/apt/lists/apertium.projectjj.com* \
| awk '{print $2}' | xargs -rn1 dpkg-query -L 2>/dev/null | grep '^/usr' \
| xargs -rn1 '-I{}' bash -c "if [[ -f '{}' ]]; then echo '{}'; fi;" \
| sed 's/\/usr\//\/usr\/local\//;' | xargs rm -fv
</pre>


=== Red Hat-based ===
=== Red Hat-based ===

Revision as of 09:47, 11 October 2018

You are using a Debian/Red Hat-based operating system. You want a fast clean install.

You could use a public repository[1] but you will be more up-to-date with the Apertium package repository.

The Apertium package repository

Tino Didriksen provides a repository of Debian/RPM packages. Downloading packages from there, you can install all prerequisites and Apertium tools. You also get, for optional install; release-level language pairs, service providers, constraint grammar code, and more. All under package management.

Before we start, a comment from the mail list, from an admin-level contributor,

If you're going to be developing, I'd say pick nightly. The -release versions of lttoolbox and apertium might not be up-to-date with what apertium-init expects.


Debian-based

If you have a Debian or Debian-based system (e.g. Ubuntu, Mint...).

First, remove any Apertium packages you have installed from operating system repositories. They will be out-of-date, sometimes by years.

Add the repository,

# Pick one:

# Nightly, unstable, new, almost always use this:
wget https://apertium.projectjj.com/apt/install-nightly.sh -O - | sudo bash

# Release, stable, old:
wget https://apertium.projectjj.com/apt/install-release.sh -O - | sudo bash


You should see messages.

Install dev tools,

sudo apt-get -f install apertium-all-dev

About the Debian repository install

Check the script installed Apertium repository details,

apt-cache policy | grep apertium

Unfortunately, due to the seamless upgrading of Debian packaging, it is difficult to see which packages the new repository has added, and where. Even Synaptic, the wonder GUI, has no way through. You could try this brute force commandline,

find /var/lib/apt/lists/ |grep projectjj.*Packages | xargs grep -h Package

Which will, if nothing else, tell you a lot about byways of the Apertium project.

Cleaning up a mixed install

If you have installed some of the core tools from source and want to switch to packages, you can remove the source install with something like this. Be extremely careful with getting this right so it doesn't wipe your whole machine.

# Wipe most files
rm -rfv /usr/local/*/*apertium* /usr/local/*/*/*apertium*
rm -rfv /usr/local/bin/lt-*
rm -rfv /usr/local/*/*lttoolbox* /usr/local/*/*/*lttoolbox*
rm -rfv /usr/local/*/*hfst* /usr/local/*/*/*hfst*
rm -rfv /usr/local/bin/cg-*
rm -rfv /usr/local/*/*cg3* /usr/local/*/*/*cg3*

# Wipe any certain conflicting file
grep -h '^Package:' /var/lib/apt/lists/apertium.projectjj.com* \
| awk '{print $2}' | xargs -rn1 dpkg-query -L 2>/dev/null | grep '^/usr' \
| xargs -rn1 '-I{}' bash -c "if [[ -f '{}' ]]; then echo '{}'; fi;" \
| sed 's/\/usr\//\/usr\/local\//;' | xargs rm -fv

Red Hat-based

If you have a RHEL/CentOS/Fedora/OpenSUSE or similar system.

First, remove any Apertium packages you have installed from operating system repositories. They will be out-of-date, sometimes by years.

Add the repository,

# Pick one

# Nightly, unstable, new, almost always use this:
wget https://apertium.projectjj.com/rpm/install-nightly.sh -O - | sudo bash

# Release, stable, old:
wget https://apertium.projectjj.com/rpm/install-release.sh -O - | sudo bash

Install dev tools,

# RHEL/CentOS:
sudo yum install apertium-all-devel
# Fedora:
sudo dnf install apertium-all-devel
# OpenSUSE:
sudo zypper install apertium-all-devel


And now...

Maybe you want to test this is working. So download a test language, Install language data using packaging. Then Install quick tests can make you sure.

If you know you need the HFST or CG3 modules, packages are available, or see Installation of grammar libraries. You may also be interested in the many tips at Bash completion.

If you are developing, now you can Install language data by compiling or How to bootstrap a new pair. If you are not, Install language data using packaging and go speak many languages :)

Notes

  1. Using public repositories, such as Debian Stable

    Not recommended, except for assessment. See the main section on the Apertium package repository.

    Apertium is a mature project, so you will find packages for Apertium in well-known public repositories. Moreover, the Apertium core is well-developed, so often backwards-compatible. If you use one of these package downloads, they will work, and can give you a good idea of what Apertium is and can do.

    In Debian repositories, Apertium core is listed simply as,

    apertium
    

    And can be installed by sudo apt get or similar method. Also, several language translation pairs will be available. For various reasons, the author has successfully developed language pairs using public repository versions of Apertium core.

    There are good reasons not to use these downloads. First, although Apertium is often backwards-compatible, this is not a key aim of the project. The code may break between versions. Next, although Apertium is an older project, it is actively developed. Honest! Although Apertium core does not change often, it has been changed, and may be changed again. And Apertium has found a place, for example, supporting languages under threat. This is work without end. Check the main repository and you will find a steady stream of contributions. And then we can talk about the many projects surrounding Apertium. Despite organisation, key contributors can not always remember what is available, and where it is! And, finally, contributors to Apertium put a lot of effort into maintaining a package system that is up-to-date and ready to go.

    Sometimes there is a good reason not to use the Apertium-provided packages. A workplace may place a restriction on install or rollout. Go ahead, use versions from a public repository. But the Apertium-provided packages are reliable, a key resource, and most people should use them.