Install Code-Server for VS code on Ubuntu 22.04 or 20.04 LTS – H2S Media

Code Server is an open-source project to program on VS Code but using a web browser. Here we learn the command to install Code Server on Ubuntu 22.04 Jammy JellyFish or 20.04 Focal Fossa.

VS Code – short for Visual Studio Code is a popular source text editor from Microsoft. It is primarily used for the development of web applications; it enables developers to program or creation of source texts in C++, C#, CSS, Dockerfile, Go, HTML, JavaScript, JSON, Less, Markdown, PHP, Python, Sass, T- SQL and TypeScript.

Although VS Code is already available to install on Debian-based systems such as Ubuntu using ~.Deb binary, however, resides only on the local machine where it has been installed. This means we cannot access it remotely unless we are not using any remote desktop software. Those who are interested in installing VS code locally can go for 4 Ways to install VS Code Editor on Ubuntu 22.04 | 20.04 LTS.

Now, come to users those who don’t want to carry their desktops always or want a high-resource server for coding. They can install “Code-Server” which is a project offered by coder.com to provide a platform that allows running the latest VS Code on a remote machine but accessible through a modern web browser. The source of the project is available on Github.

Steps to install Code -Server for VS Code on Ubuntu 22.04 | 20.04 LTS

The steps given here will be the same for other Linux systems such as Debian, Linux Mint, POPOS, and similar Linux systems.

1. Requirements:

There is no unique requirement to install Code-Server, just the regular ones:

Ubuntu 22.04| 20.04 |Debian server or desktop
A non-root user with sudo rights
1 GB of RAM coupled with 2 CPU cores

2. Run APT update

First, run the system update command to ensure all the installed system packages are up to date. This will also refresh the repository cache.

sudo apt update

3. Install Code-Editor on Ubuntu 22.04 | 20.04

There are two ways to install the Code-editor on Linux systems one is via Script which is the same for all Linux whether it is RedHat or Debian-based. Another way is to download the RPM or Deb package of Code-editor and install it manually as per our Linux system. Here we will show you both.

Using Script: #1st method

Code editor packages are not available through the default Ubuntu Jammy or Focal repositories, hence we need a third way. Therefore, on your command terminal run the given command that will fetch the required packages to configure on your Linux using the system package manager.

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

Script to install Code Editor for VS Scode on Ubuntu 22.04 20.04

Using Deb Package: # 2nd method

Open your browser and go to the GitHub Release page, scroll down and then download the Debian package.

Download Code Server Debian package

After that on your command terminal and switch to the Downloads directory because whatever we download from the browser goes into that.

cd Downloads

Check the downloaded files are there or not.

ls

Install it:

sudo apt install ./code-server_*_amd64.deb

4. Start and Enable Code-Editor Service

Once the installation is completed, start the service, whereas if you want Code-Editor to start automatically with system boot or in case of a system crash.

sudo systemctl start [email protected]$USER

To enable, the service:

sudo systemctl enable --now [email protected]$USER

Note: $USER will start the service for your current user only:

5. Nginx Proxy on Ubuntu 22.04 | 20.04

By default the Code-editor will only allow you to access the web interface at localhost i.e, hence to access it using any remote machine securely, we either can open an SSH Tunnel or install an Nginx proxy. Here we are going for Nginx lightweight server.

sudo apt install nginx -y

Start and enable its service:

sudo systemctl start nginx
sudo systemctl enable nginx

Check status:

sudo systemctl status nginx

6. Create Nginx Configuration file for Code-Server

Now, we create a file to proxy local running Code Server instance and deliver it using the main system IP-address over HTTP or HTTPS, when called by any user using the browser.

sudo apt install nano -y
sudo nano /etc/nginx/sites-available/code-server

Add the following lines:

Note: If you want to access the Code-Server using some domain name then replace yourdomain.com with the actual FQDN you want to use. Whereas those who don’t have a domain then simply remove the # tag and replace “system-IP-address” with the Ip-address of the server where Code-Editor has been installed.

server {
listen 80;
listen [::]:80;
server_name yourdomain.com;
#server_name system-ip-addres;
location / {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
}

Save the file- Ctrl+O; hit the Enter key and then exit- Ctrl+X.

Enable site configuration file:

sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server

Restart servers:

sudo systemctl restart nginx
sudo systemctl restart code-server

7. Access VS code web interface

Now, open any browser that can access the IP address of the remote server where the Code server has been installed. And point to that.

http:server-ip-address or  http://your-domain

8. Login- Code Editor Password

When we try to log in to the Code-editor web interface, it requires a password, that is saved in the YML file. Here is the command to retrieve it.

On your command terminal, run:

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

Copy or note down the password mentioned in the file.

Code Server Password

9. VS code using Web Interface on Ubuntu

Now, we can start closing using the VS Code web interface directly in the browser without visiting the remote machine physically.

VS code in Web browser Code Server VS code web interface on ubuntu 22.04 or 20.04

9. To use the Let’s Encrypt SSL certificate

Run given commands to access Code-Server over HTTPS instead of plain HTTP.

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --non-interactive --redirect --agree-tos --nginx -d yourdomain.com -m [email protected]

Be sure to replace [email protected] with your actual email and yourdomain.com with the domain you used in the Nginx configuration file.

Restart Nginx:

sudo systemctl restart nginx -y

After that, you should be able to access code-server via https://yourdomain.com

Uninstallation or remove Code Server

To remove the Code server in the future, if you don’t like then run the following command:

Stop service:

sudo systemctl stop nginx
sudo systemctl stop [email protected]$USER

To delete settings and data:

sudo apt remove code-server

If you also don’t need Nginx then:

sudo apt remove nginx

Delete data:

rm -rf ~/.local/share/code-server ~/.config/code-server rm -rf ~/.local/lib/code-server-*

Conclusion:

In this way, we can start editing our code on some remote machine using a local or internet network with the help of a web browser. This means whether we are using Android, iOS, Windows, Linux, or macOS, all can be used for programming using VS Code. Also, our all data will be in one central place.

Other Articles:

2 Ways to install VS code on Debian 11 Bullseye Linux
Linux Mint, Ubuntu, Manjaro, and Debian Desktop GUI differences
How to install GitEye GUI Git client on Ubuntu 22.04 | 20.04
How to install Kibana Dashboard on Ubuntu 22.04 or 20.04

Source of this news: https://www.how2shout.com/linux/install-code-server-for-vs-code-on-ubuntu-22-04-or-20-04-lts/

Related posts:

How could i find my proxy IP? - Augusta Free Touch
Authored Saturday, Nov. 23, 2019, 8: 34 am Sign up for AFP's 100, 000+ lovers on Online social networks Gear a request to AFP Subscribe to AFP podcasts on iTunes but also Spotify ...
Dallas Invents: 129 Patents Granted for Week of March 22 - dallasinnovates.com
Dallas Invents is a weekly look at U.S. patents granted with a connection to the Dallas-Fort Worth-Arlington metro area. Listings include patents granted to local assignees and/or those with a N...
authID.ai to Hold Annual Meeting on December 29, 2021 - KULR-TV
LONG BEACH, NY , Nov. 23, 2021 (GLOBE NEWSWIRE) -- authID.ai  [Nasdaq: AUID], a leading provider of secure, mobile, biometric authentication solutions, today announced that its 2021 Annual Meet...
Form N-PX LEUTHOLD FUNDS INC For: Jun 30 - StreetInsider.com
Get inside Wall Street with StreetInsider Premium. Claim your 1-week free trial here. UNITED STATES SECURITIES AND EXCHANGE COMMISSION WASHINGTON, D.C. 20549 FORM N-PX ANNUAL REPORT OF PROXY VOTIN...
Computer can't connect to remote computer [security package error] - WindowsReport.com
by Afam Onyimadu Author Afam is a geek and the go-to among his peers for computer solutions. He has a wealth of experience with Windows operating systems, dating back to his introduction...
How to choose the best VPN for streaming outside US – Film Daily - Film Daily
How to choose the best VPN for streaming outside US – Film Daily ☽ Trending News September 4, 2021 by: Frankie S...
Best ways to secure your information from breaches in 2022 - Craving Tech
Photo by Joshua Sortino on UnsplashNote: This is a guest post written by Dan MartinData breaches continue to be a threat to both individuals and organizations. Hackers are becoming innovative in how ...
Dustin May Has Finally Discovered His Strikeouts - FanGraphs
The quality of Dustin May’s raw stuff is undeniable. He throws his sinker with the highest average velocity of any starter in the majors and it’s ridiculous tailing action makes it one of the most GI...
Database leak exposed a large amount of credential stuffing for Spotify users - Illinoisnewstoday.co...
Researchers helped Spotify detect and address serious credential stuffing operations that affect hundreds of millions of users. On July 3, VpnMentor’s research team, led by Ran Locar and Noam Rote...
Dallas Invents: 134 Patents Granted for Week of Feb. 22 » Dallas Innovates - dallasinnovates.com
Dallas Invents is a weekly look at U.S. patents granted with a connection to the Dallas-Fort Worth-Arlington metro area. Listings include patents granted to local assignees and/or those with a N...
How to Select the Most Effective Social Media Proxy - iLounge
What are the most frequently made errors when people use social media proxies?The answer is straightforward — these individuals frequently make mistakes when selecting the best social media proxy.Tab...
How Do You Protect Yourself From A Swatting Attack? - Trending News Buzz
The internet has become a vast network of information that people use to access all kinds of things. From downloading games to researching health care, the internet is filled with valuable informati...
Trial Orders UK ISP TalkTalk to Block More Piracy Web - ISPreview. co. england
Budget broadband ISP TalkTalk has this week revised their list of blocked world wide web (i. e. those explore they’ve been told to sign up by the UK High Court) to include a number of new on...
Threat actors and researchers actively scanning for ProxyShell vulnerabilities warn - Texasnewstoday...
Researchers warn that attackers are currently scanning the Internet for Microsoft Exchange Server instances that have not been patched for the Proxy Shell vulnerability. The technical details of the...
How to bypass YouTube blocking with proxy server - Sprout Wired
Crash while using YouTube Youtube It is widely used by Internet users. It is one of the most important streaming video platforms. However, sometimes we may have problems accessing certain vide...
1337x Proxy and Mirror Sites in 2021 (100% Tried & Tested) - Robots.net
Torrenting and torrents are still very much alive and kicking at the moment. One very popular torrent website today is 1337x. However, what happens when such torrent sites get blocked or beco...
All You Need to Know About Craigslist Proxies - Robotics and Automation Ideas
All You Need to Know About Craigslist ads Proxies if ( 0 === window. location. hash. indexOf( '#comment-' ) ) // window.loc...
Best VPN for iPhone and iPad 2021 - ZDNet
Image: Daniel Romero via Unsplash My iPhone offers pretty good connectivity, but tends to be hamstrung by the limits imposed by my cellular carrier. Even though I have an unlimited data plan, using ...

IP Rotating Proxy Onsale

SPECIAL LIMITED TIME OFFER

00
Months
00
Days
00
Hours
00
Minutes
00
Seconds
First month free with coupon code FREE30