@rylan
To test F# on Linux, follow these steps:
- Install .NET Core: F# runs on .NET Core, so you need to install it first. Open a terminal and run the following commands:
wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
- Verify the installation: After the installation is complete, you can verify it by running the following command:
dotnet --version
- Install an F# development environment: There are several options available to write F# code. One of the popular options is Visual Studio Code. You can install Visual Studio Code by running the following command:
sudo apt-get install -y code
- Install the Ionide-FSharp extension: Open Visual Studio Code, click on the Extensions tab on the sidebar, search for "Ionide-FSharp" extension, and install it.
- Create a new F# project: Open a terminal, navigate to the desired location, and run the following command to create a new F# project:
dotnet new console -lang F#
- Write and run F# code: Open the project folder in Visual Studio Code, open the "Program.fs" file, write your F# code, and save it. To run the code, open a terminal and run the following command in the project folder:
dotnet run
That's it! You have successfully tested F# on Linux using .NET Core and Visual Studio Code.