Portable App Distribution for Linux
Introduction
Portable App Distribution refers to packaging applications in a self-contained format that includes all necessary dependencies, allowing them to run on various Linux systems without requiring traditional installation.
This documentation provides guidance for deploying Portable App Distribution in a Linux environment and serves as a helpful reference rather than official implementation support.
Prerequisites
To deploy your app to an on-premises Cloud Foundry configuration using Portable App Distribution, ensure that you fulfill the following prerequisites:
-
A Linux environment. This can be a virtual machine, a physical server, or a cloud instance (for example, AWS EC2, Azure VM, Google Cloud VM). You will need
sudoorrootprivileges for some commands. -
Java Development Kit (JDK). Your application requires a compatible Java runtime. For installation instructions, refer to the following sections.
-
A method to transfer the .zip file onto your Linux machine, for example:
- Cloud storage - If your Linux machine is in the cloud, you can use the cloud provider's CLI (for example, AWS S3, Azure Blob Storage, Google Cloud Storage).
- SFTP/SCP - For direct file transfer from your local machine.
- Version Control System (VCS) - If your .zip is stored in a repository.
- Artifactory/Nexus: For artifact management.
Deploying an App with Portable App Distribution
To deploy your app to Linux, perform the following steps:
-
Connect to your Linux server by running the following command:
ssh -i "<your SSH private key, if applicable>.pem" <your username on the Linux instance>@<public IP address or host name of your server> -
Optional: Update your package lists and installed packages by running one of the following commands:
-
For Debian/Ubuntu-based systems:
sudo apt update -y sudo apt upgrade -y -
For RHEL/CentOS/Amazon Linux-based systems:
sudo yum update -yorsudo dnf update -y
-
-
Install the Java Development Kit by running one of the following commands:
- For Amazon Linux:
sudo yum install java-21-amazon-corretto -y - For Debian/Ubuntu-based systems:
sudo apt install temurin-21-jdk -y - For RHEL/CentOS-based systems:
sudo yum install temurin-21-jdk -yorsudo dnf install temurin-21-jdk -y
- For Amazon Linux:
If your application requires it, you can change the Java version on vendor as needed, for example, openjdk-21-jdk or java-17-amazon-corretto.
-
Verify that Java is correctly installed by running the following command:
java -version. -
Upload the Portable App Distribution .zip file to a location where your Linux server can access it by using one of the following options, depending on the location and configuration of your Linux machine.
-
For Azure Blob Storage (often done as part of a CI/CD pipeline):
az storage blob upload --account-name <your storage account name> --container-name <your container name> --name <your app>.zip --file <your project folder>/build/distributions/your-app.zip --auth-mode loginYou may need to log in to Azure CLI first with the
azlogin. -
For Cloud Storage (often done as part of a CI/CD pipeline):
<cloud provider, for example, aws s3> cp <your project folder>/build/distributions/your-app.zip s3://<your bucket>/Adjust the
cpcommand for your specific cloud provide (for example,gsutil cpfor Google Cloud, oraws s3for AWS S3). -
For SFTP/SCP (when transferring directly from your local machine to the Linux server):
scp -i "<your SSH private key if app>.pem" <path to the .zip file on your local machine> <your user name>@<your Linux server IP or host name>:/home/<your user>/ -
For JFrog Artifactory or similar:
curl -u "<your Artifactory user name>:<your Artifactiory password>" -X PUT "https://<path to your file>.zip" -T <your app>.zipUse the
-Oflag to save the file with its original name. -
From a public URL using
wget:wget https://<path to your file>.zip
-
-
Download the .zip file onto your Linux server by using one of the following options, depending on the location and configuration of your Linux machine.
-
For Azure Blob Storage:
az storage blob download --account-name <your storage account name> --container-name <your container name> --name <your app>.zip --file /home/<your user name>/<your app>.zip --auth-mode loginEnsure that the user running this command on the Linux instance has the necessary permissions to access the Azure Storage account and container. You may need to log in to Azure CLI first with the
azlogin. -
For Cloud Storage:
<cloud provider, for example, aws s3> cp s3://<your bucket name>/<your app>.zip /home/<your user name>/<your app>.zipAdjust the
cpcommand for your specific cloud provide (for example,gsutil cpfor Google Cloud, oraws s3for AWS S3).Ensure that the user running this command on the EC2 instance has read permissions for the specified S3 Bucket.
-
For SFTP/SCP (when transferring directly from your local machine to the Linux server):
scp -i "<your SSH private key if app>.pem" <path to the .zip file on your local machine> <your user name>@<your Linux server IP or host name>:/home/<your user>/ -
For JFrog Artifactory or similar:
curl -u "<your Artifactory user name>:<your Artifactiory password>" -0 "https://<path to your file>.zip" -T <your app>.zipYou can also retrieve the files using
wget.
-
-
Extract the .zip file by running the following command:
unzip <your app>.zip -d <your desired directory>. -
Navigate into the extracted directory and execute the start script by running the following command:
cd your-desired-directory sh bin/startThe
bin/startscript is a common convention for Portable App Distributions using the Default configuration. If your application uses a different configuration, start script, or command, adjust accordingly. -
Verify that the application is running by opening the following URL in your browser:
http://<public IP of your Linux instance>:8080.8080is the default port. If your application is configured to run on a different port, adjust accordingly.Ensure that the port is open in your Linux server's firewall (for example,
firewalld,ufw), and any cloud security groups or network access control lists (NACLs).