Problem scenario
You want to install Apache Presto to try it out. How do you do this with a script that will work on Debian/Ubuntu, CentOS/RHEL/Fedora and/or SUSE?
Solution
Prerequisites
i. You have Python installed as "python" (not just python3). If you need assistance installing Python, see this posting. Verify that python --version
works. You may need to use sudo ln -s $(which python) /bin/python
ii. You have Java installed. If you need assistance, see this posting.
Procedures
1. Use this script (e.g., like "sudo bash /tmp/presto.sh" and read the last few lines as they provide for manual steps done from different terminal windows):
version=0.240
#0.149 was a stable version
# The next version of this should be .343. It doesn't have a launcher.py file. It was seriously refactored.
# Some lines will have to be commented out or deleted. The future URLs will be like this:
# https://repo1.maven.org/maven2/io/prestosql/presto-server/343/presto-server-343.tar.gz
# https://repo1.maven.org/maven2/io/prestosql/presto-cli/343/presto-cli-343-executable.jar
echo "This assumes that Python and Java have already been installed"
echo "This script requires Python 3 unlike normal versions of Presto. You could modify the script where it downloads the launcher.py file"
echo "That launcher.py file is the only thing that requires Python 3. The installation media it uses would otherwise default to utilize Python 2"
echo "**************************************************************************************"
echo "This script needs access to the internet to download the installation media for Presto"
curl https://repo1.maven.org/maven2/com/facebook/presto/presto-server/$version/presto-server-$version.tar.gz > /tmp/presto-server-$version.tar.gz
cp /tmp/presto-server-$version.tar.gz /opt/
cd /opt/
sudo tar -xvf presto-server-$version.tar.gz
cd presto-server-$version
mkdir /data # With RHEL servers, this is unnecessary.
cd /data
mkdir presto
cd /opt/presto-server-$version
mkdir etc
echo "Getting special files from GitHub. If the .config and .properties files have trailing spaces or spaces near = signs, there can be issues."
echo "That is why we get the special files known to work from GitHub"
curl https://raw.githubusercontent.com/ContinualIntegration/presto/master/config.properties > /tmp/config.properties
curl https://raw.githubusercontent.com/ContinualIntegration/presto/master/jvm.config > /tmp/jvm.config
curl https://raw.githubusercontent.com/ContinualIntegration/presto/master/log.properties > /tmp/log.properties
curl https://raw.githubusercontent.com/ContinualIntegration/presto/master/node.properties > /tmp/node.properties
curl https://raw.githubusercontent.com/ContinualIntegration/presto/master/launcher.py > /tmp/launcher.py
mv /tmp/config.properties /opt/presto-server-$version/etc/config.properties
mv /tmp/jvm.config /opt/presto-server-$version/etc/jvm.config
mv /tmp/log.properties /opt/presto-server-$version/etc/log.properties
mv /tmp/node.properties /opt/presto-server-$version/etc/node.properties
mv /tmp/launcher.py /opt/presto-server-$version/bin/launcher.py
curl https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/$version/presto-cli-$version-executable.jar > /tmp/presto-cli-$version-executable.jar
cp /tmp/presto-cli-$version-executable.jar /bin/presto
chmod +x /bin/presto
chmod +x /opt/presto-server-$version/bin/launcher.py
echo "*************************************"
echo "The installation script has finished."
echo "*************************************"
echo "Run these five Linux commands and the last Presto SQL-like command:
cd /opt/presto-server-$version/bin
sudo ./launcher start
sudo ./launcher run -Djdk.attach.allowAttachSelf=true
cd /bin/
./presto --server localhost:8080 --catalog jmx --schema default
You should see the last line look like this: com.facebook.presto.server.PrestoServer ======== SERVER STARTED ========
If the last line does not look like that, try to "./presto --server localhost:8080 --catalog jmx --schema default" command again.
After you have run those commands and are at the Presto CLI, run this command:
SELECT * FROM system.runtime.nodes;
"
2. Most likely you will need a second terminal to issue the final two Linux commands and the Presto SQL-like command as described at the bottom of the script above. Some error messages are ignorable, while sometimes you have to run the ./presto --server localhost:8080 --catalog jmx --schema default
command twice.
FFR
This link may be of assistance to you for more installation media and peripherals: