Install Visual Studio Code Web on Ubuntu 24.04

This article explains how to install Visual Studio Code for Web on Ubuntu 24.04.

Visual Studio Code for the Web, a lightweight, browser-based version of the popular Visual Studio Code (VS Code) editor, offers a convenient coding experience. It lets you write code directly in your web browser, eliminating the need to install any software on your machine.

This version is particularly useful for quick edits, collaboration, or when you’re on a device that can’t accommodate the complete VS Code environment.

Visual Studio Code for Web integrates seamlessly with GitHub and other cloud services, enabling real-time collaboration, easy access to projects from any device, and the ability to work in distributed environments.

Download the installer script

To install Visual Studio Code for Web, you can use its installer script. To do that, first, prepare Ubuntu by running the command below.

sudo apt update
sudo apt install curl

Next, run the command below to download the Visual Studio Code for Web installer script.

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run

After that, run the command below to install it.

curl -fsSL https://code-server.dev/install.sh | sh

When prompted, type in your password (admin) to install.

Once installed, run the command below to enable it and check the service status.

sudo systemctl enable --now code-server@$USER
sudo systemctl status code-server@$USER

The command should output an active status for the app.

 [email protected] - code-server
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; pre>
Active: active (running) since Sun 2024-12-22 11:46:29 CST; 8s ago
Main PID: 4259 (node)
Tasks: 22 (limit: 4561)
Memory: 60.3M (peak: 60.7M)
CPU: 503ms
CGroup: /system.slice/system-codex2dserver.slice/[email protected]>
├─4259 /usr/lib/code-server/lib/node /usr/lib/code-server
└─4286 /usr/lib/code-server/lib/node /usr/lib/code-server/out/node>

Configure Visual Studio Code for Web

After installing the app, you can set up authentication password to secure the code-server environment.

To do that, open the default code-server config file at ~/.config/code-server/config.yaml with the nano edito.

nano ~/.config/code-server/config.yaml

Then, create a password for authentication.

bind-addr: 127.0.0.1:8080
auth: password
password: 6fd97c37c251428ed0f3c74e
cert: false

Save the file and exit. Restart the service using the command below to apply your changes.

sudo systemctl restart code-server@$USER

Use a Reverse Proxy Server

To better use the software, you may want to setup a reverse proxy server using Nginx or Apache.

Below are two posts that show you how to set up a proxy server on Ubuntu Linux.

Set up Let’s Encrypt SSL Certificate

Another setting you can use is SSL certificate for the service. Below are also two posts that show you how to set up Let’s Encrypt SSL certificate for web servers on Ubuntu.

After setting up your environment, go and access the Visual Studio Code for Web portal.

If you set up a reverse proxy, then enter the hostname. If not, use the default hostname and port below

http://localhost:8080

Enter the password from the password file.

Visual Studio Code portal

Start coding.

That should do it!

Conclusion:

In summary, installing Visual Studio Code for Web on Ubuntu 24.04 offers a streamlined coding experience directly in your browser. Here are the key takeaways:

  • Visual Studio Code for Web allows for lightweight, browser-based coding without installation.
  • Effective for rapid coding sessions and collaboration on various devices.
  • Supports integration with cloud services like GitHub for real-time collaboration.
  • Installation is straightforward using the provided installer script.
  • Configuring authentication enhances the security of your coding environment.
  • Setting up a reverse proxy (using Nginx or Apache) optimizes accessibility.
  • Implementing Let’s Encrypt SSL certificates secures your service.
  • Access your development environment via http://localhost:8080 after setup.
  • Start coding and take advantage of the flexibility that this platform offers!

Frequently Asked Questions

How do I install Visual Studio Code for Web on Ubuntu 24.04?

To install Visual Studio Code for Web on Ubuntu 24.04, first update your system and install curl using 'sudo apt update && sudo apt install curl'. Then, download and run the installer script with 'curl -fsSL https://code-server.dev/install.sh | sh'.

What are the benefits of using Visual Studio Code for Web?

Visual Studio Code for Web allows you to code directly in your browser without needing to install software. It's great for quick edits, collaboration, and working on devices that can't run the full desktop version.

How can I secure my Visual Studio Code for Web installation?

To secure your installation, you can set up an authentication password by editing the config file located at '~/.config/code-server/config.yaml'. Add your desired password under the 'auth' section and restart the service to apply the changes.

Can I use a reverse proxy with Visual Studio Code for Web?

Yes, using a reverse proxy server like Nginx or Apache can enhance your Visual Studio Code for Web setup. You can find tutorials on how to set up a proxy server on Ubuntu for both Nginx and Apache.

How do I check the status of the Visual Studio Code for Web service?

To check the status of the Visual Studio Code for Web service, run the command 'sudo systemctl status code-server@$USER'. This will show you if the service is active and running.

Categories:

Leave a Reply

Your email address will not be published. Required fields are marked *