[[setup-repositories]] == Repositories We also have repositories available for APT and YUM based distributions. Note that we only provide binary packages, but no source packages, as the packages are created as part of the Elasticsearch build. We have split the major versions in separate urls to avoid accidental upgrades across major version. For all 2.x releases use 2.x as version number, for 3.x.y use 3.x etc... We use the PGP key https://pgp.mit.edu/pks/lookup?op=vindex&search=0xD27D666CD88E42B4[D88E42B4], Elasticsearch Signing Key, with fingerprint 4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4 to sign all our packages. It is available from https://pgp.mit.edu. [float] === APT Download and install the Public Signing Key: [source,sh] -------------------------------------------------- wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - -------------------------------------------------- Save the repository definition to +/etc/apt/sources.list.d/elasticsearch-{major-version}.list+: ["source","sh",subs="attributes,callouts"] -------------------------------------------------- echo "deb http://packages.elastic.co/elasticsearch/{major-version}/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-{major-version}.list -------------------------------------------------- [WARNING] ================================================== Use the `echo` method described above to add the Elasticsearch repository. Do not use `add-apt-repository` as it will add a `deb-src` entry as well, but we do not provide a source package. If you have added the `deb-src` entry, you will see an error like the following: Unable to find expected entry 'main/source/Sources' in Release file (Wrong sources.list entry or malformed file) Just delete the `deb-src` entry from the `/etc/apt/sources.list` file and the installation should work as expected. ================================================== Run apt-get update and the repository is ready for use. You can install it with: [source,sh] -------------------------------------------------- sudo apt-get update && sudo apt-get install elasticsearch -------------------------------------------------- [WARNING] ================================================== If two entries exist for the same Elasticsearch repository, you will see an error like this during `apt-get update`: ["literal",subs="attributes,callouts"] Duplicate sources.list entry http://packages.elastic.co/elasticsearch/{major-version}/debian/ ...` Examine +/etc/apt/sources.list.d/elasticsearch-{major-version}.list+ for the duplicate entry or locate the duplicate entry amongst the files in `/etc/apt/sources.list.d/` and the `/etc/apt/sources.list` file. ================================================== Configure Elasticsearch to automatically start during bootup. If your distribution is using SysV init, then you will need to run: [source,sh] -------------------------------------------------- sudo update-rc.d elasticsearch defaults 95 10 -------------------------------------------------- Otherwise if your distribution is using systemd: [source,sh] -------------------------------------------------- sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service -------------------------------------------------- [float] === YUM / DNF Download and install the public signing key: [source,sh] -------------------------------------------------- rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch -------------------------------------------------- Add the following in your `/etc/yum.repos.d/` directory in a file with a `.repo` suffix, for example `elasticsearch.repo` ["source","sh",subs="attributes,callouts"] -------------------------------------------------- [elasticsearch-{major-version}] name=Elasticsearch repository for {major-version} packages baseurl=https://packages.elastic.co/elasticsearch/{major-version}/centos gpgcheck=1 gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch enabled=1 -------------------------------------------------- And your repository is ready for use. You can install it with: [source,sh] -------------------------------------------------- yum install elasticsearch -------------------------------------------------- Or, for newer versions of Fedora and Redhat: [source,sh] -------------------------------------------------- dnf install elasticsearch -------------------------------------------------- Configure Elasticsearch to automatically start during bootup. If your distribution is using SysV `init` (check with `ps -p 1`), then you will need to run: WARNING: The repositories do not work with older rpm based distributions that still use RPM v3, like CentOS5. [source,sh] -------------------------------------------------- chkconfig --add elasticsearch -------------------------------------------------- Otherwise if your distribution is using `systemd`: [source,sh] -------------------------------------------------- sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service --------------------------------------------------