AlmaLinuxRHEL Based

How To Install Visual Studio Code on AlmaLinux 10

Install Visual Studio Code on AlmaLinux 10

Visual Studio Code has revolutionized the way developers write, debug, and manage code across multiple platforms. As Microsoft’s flagship code editor, VS Code offers an unparalleled combination of lightweight performance and powerful functionality that makes it the preferred choice for millions of developers worldwide. For AlmaLinux 10 users seeking a robust development environment, installing Visual Studio Code opens up a world of possibilities with its extensive extension ecosystem, intelligent code completion, and seamless integration capabilities.

AlmaLinux 10, being a community-driven, enterprise-grade Linux distribution, provides an excellent foundation for development work. Its stability, security features, and compatibility with Red Hat Enterprise Linux make it an ideal platform for running development tools like Visual Studio Code. Whether you’re working on web development projects, system administration scripts, or complex software applications, VS Code on AlmaLinux 10 delivers the performance and reliability you need.

This comprehensive guide will walk you through multiple installation methods, ensuring you can choose the approach that best fits your workflow and system requirements. We’ll cover everything from basic installation to advanced configuration, troubleshooting common issues, and optimizing your VS Code environment for maximum productivity.

Prerequisites and System Requirements

Before diving into the installation process, ensuring your AlmaLinux 10 system meets the necessary requirements is crucial for a smooth VS Code installation experience. Visual Studio Code is designed to run efficiently on modern Linux systems, but verifying these prerequisites will help avoid potential complications.

System Requirements:

  • AlmaLinux 10 (64-bit)
  • Minimum 1.6 GHz processor
  • 1 GB of RAM (2 GB recommended)
  • 200 MB of available disk space
  • Internet connectivity for downloading packages and extensions

User Privileges:
Your user account must have sudo privileges to install system packages and modify repository configurations. If you’re unsure about your sudo access, test it by running sudo whoami, which should return “root” if properly configured.

Verifying Your System:
Check your AlmaLinux version to ensure compatibility:

cat /etc/almalinux-release

Update your system to ensure all packages are current:

sudo dnf update -y

This preliminary update helps prevent package conflicts and ensures your system has the latest security patches before installing VS Code.

Understanding Installation Methods

AlmaLinux 10 users have several approaches for installing Visual Studio Code, each with distinct advantages depending on your specific needs and preferences. Understanding these methods helps you make an informed decision about which installation approach aligns best with your workflow.

Repository Method Advantages:

  • Automatic updates through system package manager
  • Integrated with AlmaLinux update mechanisms
  • Easier long-term maintenance
  • Consistent with system administration practices

RPM Package Method Benefits:

  • Immediate installation without repository setup
  • Works in environments with restricted internet access
  • Direct control over package versions
  • Simplified one-time installation process

Flatpak Alternative:
Some users prefer Flatpak installations for sandboxed applications, though this method requires additional setup and may have different performance characteristics.

Method 1: Installing via Microsoft Repository

The repository installation method represents the most robust and maintainable approach for installing Visual Studio Code on AlmaLinux 10. This method establishes a permanent connection to Microsoft’s official repositories, enabling seamless updates and ensuring you always have access to the latest features and security patches.

System Preparation

Begin by ensuring your AlmaLinux 10 system is properly prepared for the installation process. Update all existing packages to their latest versions:

sudo dnf update -y

Install development tools that may be required for certain VS Code extensions and functionality:

sudo dnf groupinstall "Development Tools" -y

These development tools include compilers, build systems, and libraries that many programming language extensions depend on for optimal functionality.

Adding Microsoft Repository

The repository setup process involves two critical steps: importing Microsoft’s GPG key for package verification and configuring the repository itself.

Import Microsoft GPG Key:
Security is paramount when adding third-party repositories. Import Microsoft’s official GPG key to verify package authenticity:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

This key ensures that all packages downloaded from Microsoft’s repository are genuine and haven’t been tampered with during transmission.

Create Repository Configuration:
Add the Visual Studio Code repository to your system’s repository list:

printf "[vscode]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc\nmetadata_expire=1h" | sudo tee /etc/yum.repos.d/vscode.repo

This command creates a new repository configuration file that tells your package manager where to find VS Code packages and how to verify their authenticity.

Installing Visual Studio Code

With the repository properly configured, refresh your package database and install VS Code:

sudo dnf update -y
sudo dnf install code -y

The installation process downloads the latest stable version of Visual Studio Code and all necessary dependencies. Monitor the output for any error messages, though issues are rare when following these steps correctly.

Verification:
Confirm successful installation by checking the installed version:

code --version

This command should display version information, confirming that VS Code is properly installed and accessible from the command line.

Method 2: Installing via RPM Package

The direct RPM installation method offers an alternative approach that some users prefer for its simplicity and immediate availability. This method involves downloading the RPM package directly from Microsoft’s website and installing it manually.

Downloading the RPM Package

Navigate to the official Visual Studio Code website to download the latest RPM package. Open your web browser and visit code.visualstudio.com. Look for the download section and select the RPM package option specifically designed for Red Hat-based distributions like AlmaLinux.

Command Line Download:
Alternatively, download the package directly using wget or curl:

cd ~/Downloads
wget -O vscode.rpm "https://code.visualstudio.com/sha/download?build=stable&os=linux-rpm-x64"

This approach ensures you get the latest stable release directly from Microsoft’s servers.

Installing the RPM Package

Once downloaded, install the RPM package using either the rpm command or dnf’s local install feature:

Using RPM:

sudo rpm -i ~/Downloads/vscode.rpm

Using DNF (Recommended):

sudo dnf localinstall ~/Downloads/vscode.rpm -y

The dnf method is preferred because it automatically resolves any dependency issues that might arise during installation.

Post-Installation Repository Setup

One significant advantage of RPM installation is that it automatically configures the Microsoft repository for future updates. Verify this configuration:

cat /etc/yum.repos.d/vscode.repo

This ensures that future VS Code updates will be available through your regular system update process.

Launching and Verifying Installation

After successful installation, Visual Studio Code can be launched through multiple methods, providing flexibility for different user preferences and workflows.

Command Line Launch

The most direct method for launching VS Code is through the terminal:

code

To launch VS Code in the background, allowing you to continue using the terminal:

code &

Open a specific file or directory immediately:

code /path/to/your/project
code filename.py

These command-line options make VS Code integration with your development workflow seamless and efficient.

GUI Launch

AlmaLinux 10’s desktop environment provides intuitive graphical access to VS Code:

  1. Click on “Activities” in the top-left corner
  2. Type “Visual Studio Code” in the search bar
  3. Click on the VS Code icon to launch

Creating Desktop Shortcuts:
For frequent access, create a desktop shortcut by right-clicking on the VS Code icon in the activities overview and selecting “Add to Favorites” or dragging it to your desktop.

Install Visual Studio Code on AlmaLinux 10

Installation Verification

Confirm your installation is working correctly by checking the version and basic functionality:

code --version
code --help

Launch VS Code and verify that the welcome screen appears with options for opening folders, creating new files, and accessing extensions.

Initial Configuration and Setup

Proper initial configuration transforms VS Code from a basic editor into a powerful, personalized development environment tailored to your specific needs and preferences.

First-Time Setup Wizard

When you first launch VS Code, you’ll encounter a welcome screen with several configuration options:

  • Theme Selection: Choose between light, dark, and high-contrast themes
  • Keyboard Shortcuts: Select familiar key bindings from other editors
  • Extension Recommendations: Review suggested extensions based on detected files

Take time to explore these options, as they significantly impact your daily development experience.

Essential Extensions Installation

VS Code’s extension ecosystem is one of its greatest strengths. Access the Extensions marketplace using Ctrl+Shift+X or clicking the Extensions icon in the activity bar.

Recommended Extensions for Common Development Tasks:

  • Python: Comprehensive Python development support
  • GitLens: Enhanced Git integration and code history
  • Prettier: Automatic code formatting
  • Live Server: Local development server for web projects
  • Bracket Pair Colorizer: Visual bracket matching

Install extensions by searching for their names and clicking “Install.” Extensions enhance functionality but can impact performance, so install only those you actively use.

Workspace Configuration

Understanding the difference between user settings and workspace settings helps you configure VS Code appropriately:

User Settings: Apply globally across all VS Code instances
Workspace Settings: Apply only to the current project

Access settings through File > Preferences > Settings or using Ctrl+,. Configure essential settings like:

{
    "editor.fontSize": 14,
    "editor.lineHeight": 1.5,
    "files.autoSave": "onFocusChange",
    "editor.minimap.enabled": true
}

These settings improve readability and workflow efficiency.

Advanced Configuration Options

Advanced configuration allows you to customize VS Code beyond basic settings, creating an optimized development environment that matches your specific workflow requirements.

Settings and Preferences

VS Code offers two primary ways to manage settings: the graphical interface and direct JSON editing. Advanced users often prefer JSON editing for precise control:

Access Settings JSON:

  • Press Ctrl+Shift+P
  • Type “Preferences: Open Settings (JSON)”
  • Edit settings directly in JSON format

Key Advanced Settings:

{
    "workbench.colorTheme": "Dark+ (default dark)",
    "editor.fontFamily": "'Fira Code', 'Courier New', monospace",
    "editor.fontLigatures": true,
    "editor.rulers": [80, 120],
    "files.trimTrailingWhitespace": true,
    "editor.formatOnSave": true
}

These settings enhance code readability and maintain consistent formatting standards.

Terminal Integration

VS Code’s integrated terminal provides seamless access to command-line tools without leaving the editor:

Configure Default Shell:

{
    "terminal.integrated.defaultProfile.linux": "bash",
    "terminal.integrated.fontSize": 12
}

Multiple Terminal Support:
Open multiple terminal instances using Ctrl+Shift+` for different tasks simultaneously. Configure shell-specific settings for different development environments.

Debugging Setup

VS Code’s debugging capabilities require configuration files for different programming languages:

Create Launch Configuration:

  1. Press F5 or go to Run > Start Debugging
  2. Select your programming language environment
  3. VS Code creates a .vscode/launch.json file

Example Python Debug Configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

This setup enables breakpoint debugging and variable inspection directly within VS Code.

Troubleshooting Common Issues

Even with careful installation, you may encounter issues that require troubleshooting. Understanding common problems and their solutions helps maintain a stable VS Code environment.

Installation Problems

GPG Key Import Failures:
If the GPG key import fails, check your internet connection and try alternative download methods:

wget https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

Repository Addition Issues:
Verify repository configuration by examining the created file:

cat /etc/yum.repos.d/vscode.repo

Ensure all required fields are present and properly formatted.

Package Dependency Conflicts:
Resolve dependency issues by updating the package database and installing missing dependencies:

sudo dnf clean all
sudo dnf makecache
sudo dnf install code --allowerasing

Launch Issues

Permission Problems:
If VS Code fails to launch due to permission issues, check file ownership:

ls -la /usr/bin/code
sudo chown root:root /usr/bin/code

Missing Dependencies:
Install missing system libraries that VS Code requires:

sudo dnf install libXScrnSaver

Display Issues:
For systems with multiple graphics cards or unusual display configurations, try launching with specific flags:

code --disable-gpu

Performance Optimization

Memory Usage Optimization:
Limit VS Code’s memory consumption by adjusting settings:

{
    "search.followSymlinks": false,
    "files.watcherExclude": {
        "**/node_modules/**": true
    }
}

Extension Management:
Disable unnecessary extensions to improve startup time and reduce memory usage. Regularly review installed extensions and remove those no longer needed.

File Watching Limits:
Increase system file watching limits for large projects:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Updating and Maintaining VS Code

Keeping Visual Studio Code updated ensures access to the latest features, security patches, and performance improvements. The update process varies depending on your installation method.

Automatic Updates

When installed via repository method, VS Code updates automatically with system updates:

sudo dnf update

This command updates all packages, including VS Code, maintaining system consistency and security.

Update Notification Settings:
Configure VS Code to notify you about available updates:

{
    "update.mode": "manual",
    "update.showReleaseNotes": true
}

Manual Update Process

For RPM installations or when you want to control update timing:

Check Current Version:

code --version

Download Latest RPM:
Visit the VS Code website and download the newest version, then install it using the same methods described earlier.

Extension Updates:
Extensions update independently of VS Code itself. Enable automatic extension updates in settings or update manually through the Extensions view.

Uninstalling VS Code

Complete removal of Visual Studio Code involves removing the package, configuration files, and repository settings.

Package Removal

For Repository Installations:

sudo dnf remove code -y
sudo dnf autoremove -y

For RPM Installations:

sudo rpm -e code

Configuration Cleanup

Remove user configuration and data directories:

rm -rf ~/.config/Code
rm -rf ~/.vscode

Repository Cleanup:
Remove the VS Code repository configuration:

sudo rm /etc/yum.repos.d/vscode.repo

This ensures complete removal and prevents conflicts if you reinstall VS Code later.

Best Practices and Tips

Maximizing your VS Code experience requires understanding best practices that enhance productivity and maintain system performance.

Development Workflow Integration

Git Integration:
Configure Git credentials and signing keys for seamless version control:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

VS Code’s built-in Git support provides visual diff views, staging areas, and commit management directly within the editor.

Project Management:
Organize projects using VS Code workspaces that save opened folders, settings, and extension recommendations:

{
    "folders": [
        {"path": "./frontend"},
        {"path": "./backend"}
    ],
    "settings": {},
    "extensions": {
        "recommendations": ["ms-python.python"]
    }
}

Keyboard Shortcuts:
Master essential keyboard shortcuts to improve efficiency:

  • Ctrl+P: Quick file navigation
  • Ctrl+Shift+P: Command palette
  • Ctrl+`: Toggle integrated terminal
  • Ctrl+B: Toggle sidebar

Security Considerations

Extension Security:
Only install extensions from trusted publishers with good ratings and recent updates. Review extension permissions before installation, particularly for extensions that access files or network resources.

Workspace Trust:
VS Code’s workspace trust feature prevents automatic execution of potentially harmful code. Configure trust settings appropriately:

{
    "security.workspace.trust.enabled": true,
    "security.workspace.trust.startupPrompt": "always"
}

Safe Coding Practices:
Use VS Code’s built-in security features like syntax highlighting for potential security issues and linting extensions that detect common vulnerabilities.

Congratulations! You have successfully installed Visual Studio Code. Thanks for using this tutorial for installing the Visual Studio Code on AlmaLinux OS 10 system. For additional help or useful information, we recommend you check the official Visual Studio Code website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button