Installing Kali Linux inside a Linux Container (LXC)(CT) on Proxmox

Installing Kali Linux inside a Linux Container (LXC)(CT) on Proxmox

How to Install Kali Linux on Proxmox LXC

Overview of Installation Process

  • The tutorial focuses on installing Kali Linux or any other Linux distribution using a Linux container (LXC) on a type 1 hypervisor, specifically Proxmox.
  • The installation will begin with a bare-bones image of Kali Linux, followed by the addition of necessary tools similar to those in the default installation.

Configuration and Testing

  • The setup includes configuring Remote Desktop Protocol (RDP) using xrdp and VNC via TightVNC server, with performance testing for both protocols planned.

Proxmox Setup Details

  • A single-node Proxmox installation is demonstrated, showcasing an existing virtual machine running Kali that consumes approximately 1.24 GB of memory.
  • Users can store ISO images or container templates in local storage; however, no pre-existing templates for Kali are available.

Finding and Downloading Templates

  • The speaker notes that while searching for a Kali template, they found documentation indicating the existence of LXC and LXD images but not directly accessible links for download.
  • It’s explained that LXD runs containers atop Ubuntu, which is not desired in this case as the goal is to run Kali directly from a hypervisor without an underlying OS.

Accessing Required Files

  • To minimize load on the host machine, it’s emphasized that direct access to container images is preferred over running them through another operating system layer.
  • After some investigation into available images, it was discovered that specific URLs must be constructed to access the required files for downloading.

Downloading Root File System

  • By navigating through directories within the URL structure provided by Kali's documentation, users can locate and download the root filesystem file needed for installation.
  • The speaker highlights how to find and download this root fs file (approximately 73 MB), which serves as the basis for creating a new template in Proxmox.

Creating Container Template in Proxmox

  • Instructions are given on how to create a new container template using the downloaded root filesystem file within Proxmox.
  • Steps include assigning a container ID and password while selecting storage options such as 20 GB space and six CPU cores to match existing virtual machines for comparison purposes.

Kali Linux Container Setup

Configuring Memory and Network Settings

  • The system is allocated 8 GB of memory and 4 GB of swap space. Emphasis on not altering IPv6 settings to avoid network issues.
  • The container is assigned an IPv4 address (201) within the 192.168.70 network, using a /24 subnet mask. A gateway router at .254 is set for internet access, though it's optional for local testing.

Initializing the Container

  • After configuration, the container starts booting up; a comparison between virtual machines and containers will be made later regarding memory usage.
  • The console shows minimal resources (11 MB), indicating only a base kernel is present until additional packages are installed.

Installing Essential Networking Tools

  • Accessing the console requires root login with previously set password; initial state shows no tools available for networking tasks.
  • The base Kali Linux kernel will be used to build upon, aiming for fewer bugs during installation.

Package Installation for Networking

  • Key networking tools are identified: wget, man pages, vim editor, nano text editor, inet utilities, ip utilities, and ping capabilities are essential for basic operations.
  • Successful pings confirm that the network interface is operational and can reach external sites like Google.

User Management and Shell Configuration

  • Discussion on using zsh as the terminal shell in newer Kali versions due to its enhanced features; however, it requires installation for each user if added later.
  • It’s recommended to install zsh early in setup to ensure all users have access without needing repeated installations.

Finalizing User Setup

  • Creating a non-root user named "kali" with default credentials ensures better security practices moving forward in operations.
  • Additional packages such as cali-default, zsh-syntax-highlighting, and zsh-auto-suggestions are installed to enhance user experience in the terminal environment.

Meta Packages Installation

  • Acknowledgment of supplemental tools needed post-installation; meta packages provide various desktop environments and core images necessary for functionality.

This structured approach provides clarity on setting up a Kali Linux container while emphasizing critical configurations and installations required throughout the process.

Kali Linux Setup and Configuration

Exploring Hidden Directories and User Permissions

  • The speaker discusses the presence of hidden directories and files in Kali Linux, specifically mentioning the .zshrc file that contains Zsh configuration parameters.
  • The speaker attempts to switch users to access the Kali environment, highlighting a need for proper user permissions to execute commands like ls -a.
  • After modifying user groups with usermod, the speaker confirms successful login as the Kali user, indicating they now have sudo privileges.

Enabling SSH and Installing Desktop Environment

  • The speaker emphasizes enabling SSH for remote access, demonstrating how to use sudo systemctl commands to manage services.
  • A base installation of a desktop environment is discussed; the speaker mentions various options available in Kali Linux such as XFCE, KDE, Gnome, etc.
  • The installation process begins with updating repositories and installing necessary packages including kali-desktop-xfce, xrdp, and Firefox for performance testing.

Network Configuration Considerations

  • A warning is issued about potential network conflicts due to both Systemd's networkd and Network Manager being active simultaneously after package installation.
  • The speaker explains that having both systems can lead to issues upon restarting containers or hosts, complicating network troubleshooting.
  • To avoid these problems, it’s suggested to purge Network Manager from the system.

Resource Monitoring and Service Management

  • After completing a base installation without GUI tools, resource usage is noted at around 300 MB of RAM.
  • The SSH service status is checked post-installation; it confirms that SSH is running on port 22 allowing remote connections.

Remote Desktop Session Testing

  • The status of xrdp is verified; once confirmed running on port 3389, a remote desktop session is initiated successfully.
  • Upon connecting via RDP, it's noted that only basic tools are available in this initial setup without additional Kali tools installed.

Proxmox and Kali Linux: Resource Utilization Comparison

Overview of Resource Usage

  • Discussion on web links and icons leading to websites, noting the absence of tools in the current context.
  • Memory utilization comparison: The container uses approximately 621 MB of RAM, while a full Kali Linux virtual machine consumes about 1.28 GB due to its comprehensive toolset.

Installation Process for Kali Tools

  • Transitioning back to Kali Linux for the installation of all necessary tools after RDP testing.
  • Emphasis on updating the system before proceeding with installations to ensure everything is up-to-date.
  • Introduction of package management commands; searching for Kali Linux meta packages as part of preparation for installation.

Installation and Reboot Procedures

  • Decision to install the default meta package for Kali Linux, anticipating a duration of around 10–12 minutes for completion.
  • Post-installation checks are performed, including purging unnecessary network managers before rebooting both the virtual machine and container.

Resource Comparison After Reboot

  • Noting resource usage post-reboot: The container shows significantly lower memory consumption compared to the virtual machine (43 MB vs. 789 MB).
  • Explanation that containers do not utilize a traditional BIOS like virtual machines do, affecting configuration file accessibility.

VNC Server Setup and Testing

  • Initiating VNC server setup with specific geometry settings; issues arise related to pixel depth configurations during initial attempts.
  • Adjustments made after encountering errors; successful connection established with VNC client after reconfiguration.

Performance Insights from Testing

  • Comparison between RDP and VNC performance indicates that VNC offers better user experience despite some screen tearing issues.
  • Observations on memory consumption during YouTube playback show significant differences: VM at 1.5 GB versus container at approximately 758 MB, highlighting efficiency benefits.

Conclusion on Resource Efficiency

  • Final thoughts emphasize remarkable resource savings when using containers over full virtual machines, encouraging viewers to consider this approach in their setups.
Video description

In this video, we will be installing Kali Linux literally from rootfs on Proxmos version of a Linux Container (LXC), known as CT. We will also access and test this Kali Linux box from both RDP and VNC. 0:00 | Introduction 0:21 | Agenda 2:07 | Issues finding Kali Linux Container Template in Proxmos/KaliDocs 07:00 | Creating Proxmos Linux Container (CT) 10:04 | Kali Linux Base Installation 17:52 | Kali Linux XFCE Desktop Environment Installation 19:55 | systems-network and network-manager conflict resolution 23:00 | Enabling SSH server 24:05 | Testing RDP server (xrdp) 26:45 | Installation of Kali Tools 31:15 | Testing VNC server (tightvncserver) 34:00 | Wrapping up All the commands in this video can be found on my github page: https://github.com/saqibmahmood/Kali-Linux-Container-on-Proxmox