Visual Studio Code is a lightweight source code editor for JavaScript, TypeScript and Node.js Applications. It also has extensions for multiple other programming languages like C++, C#, Python, PHP, Go, etc. This tutorial will help you to install Visual Studio Code editor on Ubuntu, Debian, Linuxmint and its derivatives systems.
Step 1 – Enable Package Repository
First of all, You need to enable package repository in your system. Run the following command to enable Visual studio code repository to your system.
echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" | sudo \ tee /etc/apt/sources.list.d/vs-code.list
Step 2 – Install Visual Studio Code Editor
Now, Import the package signing gpg key on your system using the following command.
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
After importing gpg key, Let’s use below commands to install Visual Studio Code on your Debian based system.
sudo apt-get update sudo apt-get install code
Step 3 – Launch Visual Studio Code
Now launch the Visual Studio Code editor on your system using the graphical menu. After that create a new file or open files and directories using the File menu.
Step 4 – Enable Required Extensions
There are a large number of extensions available for Visual Studio Code like C#, Python, JavaScript, Google Chrome etc. Install the required extensions to enhance your working experience with Visual Studio Code.
Very good thanks.
I am getting this error
[email protected]:/etc/apt/sources.list.d$ sudo curl https://packages.microsoft.com/keys/microsoft.asc | gpg –dearmor > microsoft.gpg
bash: microsoft.gpg: Permission denied
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 983 100 983 0 0 3824 0 –:–:– –:–:– –:–:– 3810
(23) Failed writing body
Thank you.
good….!!!
We don’t have permission to create a file in that specified directory /etc/apt/sources.list.d/
I am obliged for this article Rahul, I was trying to download visual studio in ubuntu for office work. I am glad I reached your article in perfect time. It helped me to do it in easy way.
Strangely there are no literature or documents found on step by step VS code installation on an Ubuntu server (AWS EC2 server) through the command line (ssh interface). The closest I got was this website. Rahul – can you please confirm these are the right set of instructions to insall VS code on an Ubuntu EC2 server through ssh ?
1. Create a new file /etc/apt/sources.list.d/vscode.list
2. Add a new line deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main
3. Run the following 4 commands
curl https://packages.microsoft.com/keys/microsoft.asc | gpg –dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
udo apt-get update
sudo apt-get install code
Usually, ubuntu package installation is straightforward using apt install. This looks like a bit of a drain. Any reasons for the long drawn process assuming this is the correct process?
i was installing visual studio but it is showing error”E: ailed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry ‘main/binary-i386/Packages’ in Release file (Wrong sources.list entry or malformed file)
E: Some index files failed to download. They have been ignored, or old ones used instead.”
This is Google chrome deb repository, which is showing this error. Just remove entry for chrome repository.