Prepare your development environment on Linux
To deploy and run Azure Service Fabric applications on your Linux development machine, install the runtime and common SDK. You can also install optional SDKs for Java and .NET Core development.
The following operating system versions are supported for development:
- Ubuntu 16.04 (
1. Script installation
A script is provided for convenience for installing the Service Fabric runtime and the Service Fabric common SDK along with sfctl CLI. Run the manual installation steps in the next section to determine what is being installed and the licenses that are being agreed to. Running the script assumes you agree to the licenses for all the software that is being installed.
After the script is executed successfully, you can directly skip to Set up a local cluster.
sudo curl -s https://raw.githubusercontent.com/Azure/service-fabric-scripts-and-templates/master/scripts/SetupServiceFabric/SetupServiceFabric.sh | sudo bash
2. Manual Installation
For manual installation of Service Fabric runtime and common SDK, follow the rest of this guide.
Update your APT sources
To install the SDK and the associated runtime package via the apt-get command-line tool, you must first update your Advanced Packaging Tool (APT) sources.
- Open a terminal.
Add the Service Fabric repo to your sources list.
sudo sh -c 'echo "deb [arch=amd64] http://apt-mo.trafficmanager.net/repos/servicefabric/ xenial main" > /etc/apt/sources.list.d/servicefabric.list'
dotnetrepo to your sources list.
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
Add the new Gnu Privacy Guard (GnuPG, or GPG) key to your APT keyring.
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
Add the official Docker GPG key to your APT keyring.
sudo apt-get install curl sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Set up the Docker repository.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Refresh your package lists based on the newly added repositories.
sudo apt-get update
Install and set up the Service Fabric SDK for local cluster setup
After you have updated your sources, you can install the SDK. Install the Service Fabric SDK package, confirm the installation, and agree to the license agreement.
sudo apt-get install servicefabricsdkcommon
The following commands automate accepting the license for Service Fabric packages:
echo "servicefabric servicefabric/accepted-eula-ga select true" | sudo debconf-set-selections echo "servicefabricsdkcommon servicefabricsdkcommon/accepted-eula-ga select true" | sudo debconf-set-selections
Set up a local cluster
Once the installation completes, you should be able to start a local cluster.
Run the cluster setup script.
Open a web browser and go to Service Fabric Explorer. If the cluster has started, you should see the Service Fabric Explorer dashboard.
At this point, you can deploy pre-built Service Fabric application packages or new ones based on guest containers or guest executables. To build new services by using the Java or .NET Core SDKs, follow the optional setup steps that are provided in subsequent sections.
Standalone clusters aren't supported in Linux.
If you have an SSD disk avaiable, it is recommended to pass an SSD folder path using `--clusterdataroot` with devclustersetup.sh for superior performance.
Set up the Service Fabric CLI
Set up Yeoman generators for containers and guest executables
Service Fabric provides scaffolding tools that help you create Service Fabric applications from a terminal using Yeoman template generators. Follow these steps to set up the Service Fabric Yeoman template generators:
Install nodejs and NPM on your machine
sudo apt-get install npm sudo apt install nodejs-legacy
Install Yeoman template generator on your machine from NPM
sudo npm install -g yo
Install the Service Fabric Yeo container generator and guest executable generator from NPM
sudo npm install -g generator-azuresfcontainer # for Service Fabric container application sudo npm install -g generator-azuresfguest # for Service Fabric guest executable application
After you have installed the generators, you should be able to create guest executable or container services by running
yo azuresfguest or
yo azuresfcontainer, respectively.
Set up .NET Core 2.0 development
Set up Java development
To build Service Fabric services using Java, install JDK 1.8 and Gradle to run build tasks. The following snippet installs Open JDK 1.8 along with Gradle. The Service Fabric Java libraries are pulled from Maven.
sudo apt-get install openjdk-8-jdk-headless sudo apt-get install gradle
Install the Eclipse Neon plug-in (optional)
You can install the Eclipse plug-in for Service Fabric from within the Eclipse IDE for Java Developers. You can use Eclipse to create Service Fabric guest executable applications and container applications in addition to Service Fabric Java applications.
In Eclipse, ensure that you have latest Eclipse Neon and the latest Buildship version (1.0.17 or later) installed. You can check the versions of installed components by selecting Help > Installation Details. You can update Buildship by using the instructions at Eclipse Buildship: Eclipse Plug-ins for Gradle.
To install the Service Fabric plug-in, select Help > Install New Software.
In the Work with box, type http://dl.microsoft.com/eclipse.
Select the ServiceFabric plug-in, and then click Next.
Complete the installation steps, and then accept the end-user license agreement.
If you already have the Service Fabric Eclipse plug-in installed, make sure that you have the latest version. You can check by selecting Help > Installation Details and then searching for Service Fabric in the list of installed plug-ins. If a newer version is available, select Update.
For more information, see Service Fabric plug-in for Eclipse Java application development.
Update the SDK and runtime
To update to the latest version of the SDK and runtime, run the following commands:
sudo apt-get update sudo apt-get install servicefabric servicefabricsdkcommon
To update the Java SDK binaries from Maven, you need to update the version details of the corresponding binary in the
build.gradle file to point to the latest version. To know exactly where you need to update the version, you can refer to any
build.gradle file in Service Fabric getting-started samples here.
Updating the packages might cause your local development cluster to stop running. Restart your local cluster after an upgrade by following the instructions on this page.
Remove the SDK
To remove the Service Fabric SDKs, run the following:
sudo apt-get remove servicefabric servicefabicsdkcommon sudo npm uninstall generator-azuresfcontainer sudo npm uninstall generator-azuresfguest sudo apt-get install -f
- Create and deploy your first Service Fabric Java application on Linux by using Yeoman
- Create and deploy your first Service Fabric Java application on Linux by using Service Fabric Plugin for Eclipse
- Create your first CSharp application on Linux
- Prepare your development environment on OSX
- Prepare a Linux development environment on Windows
- Use the Service Fabric CLI to manage your applications
- Service Fabric Windows/Linux differences
- Get started with Service Fabric CLI