{"id":481,"date":"2024-10-07T22:11:57","date_gmt":"2024-10-07T22:11:57","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2024\/10\/07\/9967651-how-to-install-flutter-web-on-a-vps-at-hostinger\/"},"modified":"2026-05-08T13:01:41","modified_gmt":"2026-05-08T13:01:41","slug":"9967651-how-to-install-flutter-web-on-a-vps-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/9967651-how-to-install-flutter-web-on-a-vps-at-hostinger\/","title":{"rendered":"How to Install Flutter Web on a VPS at Hostinger"},"content":{"rendered":"<h2 id=\"h_913951cdd1\"><b>Step 1: Install OS for your VPS<\/b><\/h2><p class=\"no-margin\">You can choose any Linux OS for your VPS setup. In this tutorial, we will use Ubuntu 24.04 as an example.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_e4dd488014\"><b>Step 2: Access your SSH client<\/b><\/h2><div class=\"intercom-container\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2024\/10\/24ce3018-1359-471d-a960-cd08ba9a833d.jpg\" data-media-id=\"2336\" alt=\"Hostinger VPS card showing Ubuntu 24.04 running with root access and reboot VPS button\"><\/div><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Access the <b>VPS Overview <\/b>page and select your preferred method for connecting to your SSH client. You can use the browser-based terminal (located in the top right corner) or the command <code>ssh root@your_vps_ip<\/code> in your Terminal or Putty for manual connection.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_64bbd1111b\"><b>Step 3: Building Flutter Web on VPS<\/b><\/h2><p class=\"no-margin\">\n<\/p><h3 id=\"h_892f25874c\"><b>1. Install Google Chrome on your VPS<\/b><\/h3><p class=\"no-margin\">Google Chrome is essential for running and debugging Flutter web apps. Download the latest version of Google Chrome for Linux:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>wget <a href=\"https:\/\/dl.google.com\/linux\/direct\/google-chrome-stable_current_amd64.deb\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">https:\/\/dl.google.com\/linux\/direct\/google-chrome-stable_current_amd64.deb<\/a><\/code><\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_e3e0551e53\"><b>2. Install the downloaded Chrome package:<\/b><\/h3><p class=\"no-margin\"><code>sudo apt install .\/google-chrome-stable_current_amd64.deb<\/code><\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_8d8f4ba540\"><b>3. Set Chrome Environment Variable<\/b><\/h3><p class=\"no-margin\">After installing Chrome, set the <code>CHROME_EXECUTABLE<\/code> environment variable, so Flutter knows where Chrome is located. Add the following line to your <code>.bashrc<\/code> file to export the Chrome path:<\/p><p class=\"no-margin\">&#8203;<code>echo 'export CHROME_EXECUTABLE=\/usr\/bin\/google-chrome' &gt;&gt; ~\/.bashrc<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Apply the changes made in .bashrc to your current session:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>source ~\/.bashrc<\/code><\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_27ca4f4d3c\"><b>4. Install Flutter via Snap<\/b><\/h3><p class=\"no-margin\">Flutter can be installed easily using the Snap package manager.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Update your package list:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>sudo apt update<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Install Snap if you don&rsquo;t have it already:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>sudo apt install snapd<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Install Flutter via Snap with classic mode enabled:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>sudo snap install flutter --classic<\/code><\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_0326f75dac\">5. Enable Web Support in Flutter<\/h3><p class=\"no-margin\">Flutter needs to be configured to support web development, run the following command to enable web support in Flutter:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>flutter config --enable-web<\/code><\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_b0e3d36957\">6. Create and Run a Flutter Web Project<\/h3><p class=\"no-margin\">Now that Flutter is installed and configured for the web, you can create and run your first web project:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>flutter create my_web_app<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Navigate into the project directory:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>cd my_web_app<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Run the app using the web server device (with a custom port and hostname):<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>flutter run -d web-server --web-port=8080 --web-hostname=0.0.0.0<\/code><\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_1010ec8a17\"><b>Step 4: Configure Firewall to Allow Web Traffic<\/b><\/h2><p class=\"no-margin\">To access your Flutter web app from outside the VPS, ensure your firewall allows traffic on port 8080. Allow incoming TCP traffic on port 8080:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>sudo ufw allow 8080\/tcp<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Reload the firewall to apply the changes:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>sudo ufw reload<\/code><\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_e5d25db3c4\"><b>Step 5. Access Your Flutter Web App<\/b><\/h2><p class=\"no-margin\">Once the app is running, you can access it from any browser. Open your browser and navigate to the following URL, replacing <code>your_ip<\/code> address with your VPS IP address:<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><code>http:\/\/your_ip:8080<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Your Flutter web app is now built and deployed to your VPS!<\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2024\/10\/e3a353c3-1da8-4c84-92e4-b6697b4020bd.jpg\" data-media-id=\"2337\" alt=\"Flutter demo home page with counter at 2 and a plus button in the bottom-right corner\"><\/div><p class=\"no-margin\">\n<\/p><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p class=\"no-margin\">For further development, please check the official <a href=\"https:\/\/docs.flutter.dev\/get-started\/learn-flutter\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Flutter documentation<\/a> <b>&#128640;<\/b><\/p>\n<\/div><p class=\"no-margin\">\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting started with the Flutter web on a VPS<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[199],"tags":[],"class_list":["post-481","post","type-post","status-publish","format-standard","hentry","category-vps-management"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/9967651-how-to-install-flutter-web-on-a-vps-at-hostinger\/","default":1}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=481"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":2340,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/481\/revisions\/2340"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}