K7

K7Blog

须知少年凌云志 曾许人间第一流.
proton
telegram

Have you ever heard of LXC servers?

Preface:#

What is an LXC server?

LXC (Linux Containers) is an operating system-level virtualization technology used to create and manage containers on Linux systems. It allows for the isolation of one or more applications and their dependencies in separate containers, each with its own file system, network, process space, etc. LXC provides a lightweight virtualization solution with lower overhead and faster startup times compared to traditional virtual machines.

68747470733a2f2f626f6263617265732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032332f30312f6c78632e706e67

An LXC server is a server that runs LXC technology. These servers use LXC to create and manage containers, allowing users to easily deploy, run, and manage multiple applications or services. LXC servers are commonly used in virtualized server environments, providing higher resource utilization and more flexible deployment options.

Further reading:

Not only LXC, but also LXD, what is LXD?#

LXD is a container management tool based on LXC that provides a simpler and more powerful way to manage Linux containers. LXD is built on top of LXC and provides additional features and tools to make container management and deployment easier.

Compared to traditional LXC, LXD has the following advantages and features:

  1. Ease of use: LXD provides a simple command-line interface and RESTful API that allows users to easily create, start, stop, delete, and manage containers.
  2. Performance: LXD provides more efficient container management, including faster startup times, lower resource consumption, and better performance.
  3. Security: LXD offers a range of security features, including container isolation, resource limitations, and access control, to protect the security of containers and the host system.
  4. Scalability: LXD supports clustering and distributed deployment, allowing users to easily scale and manage large container infrastructures.
  5. Overall, LXD provides a simple, efficient, and secure container management solution suitable for various scenarios, including development, testing, deployment, and operations.

Further reading:

Main Text:#

I previously wrote an article: Docker Installation of Multiple Baota + Business Ideas You can take a look at it, and this article can be considered as a follow-up.

I saw a virtual host selling Baota on Bilibili, but it is not a conventional virtual host. It has independent Root privileges and can build Java, Node, and Python projects other than PHP. At that time, I couldn't open the website of the sales platform, so I didn't experience it and didn't know the technical principles behind it.

Yesterday, I saw another company with the same advertising slogan, but there was no stock. So I came to the first one and bought one to play with. I always thought it was using Docker to virtualize the virtual machine. Today, when I logged into the server, I realized that the system architecture is LXC (I saw it through the integration script). At that time, I was verifying whether the system was running in a Docker container.

Snipaste_2024-04-14_20-53-18

Both LXC and KVM can control the actual number of cores used by the virtual machine, and both the upstream and downstream bandwidth and disk can be controlled. However, KVM cannot oversell memory and hard disk directly, but it can be oversold through other methods. LXC is a bit abnormal. It seems that the hard disk cannot be oversold, but the memory can be oversold.

I saw on the One-Click LXD Script GitHub that the author said:

  • Tested: Oracle's 2C2G60G can open 30 1H512M1.5G
  • DigitalOcean's 4C8G160G, if the hard disk is not fully utilized, can open 135 1H512G2GSSD
  • Normally, a general 1C1G20GSSD VPS can open about 15

Although the script is based on LXD, the architecture of the virtual machine opened is still LXC. You can check it on GitHub: https://github.com/MXCCO/lxdpro

There is also another script: https://github.com/oneclickvirt/lxd This script has more detailed documentation. I played with it myself, but I didn't test the functionality of the VPS opened by the container carefully. I won't make many comments on stability, but it is highly playable and supports allocating IPv6 to the virtual machine. I'm not sure if IPv4 can be allocated.

Pros and Cons:#

The created container may have no network. I tested it and found that disabling the firewall solved the problem.

The advantage is that you can oversell like crazy, and if you have a VPS, you can play with it. You don't need your server to support virtualization like opening KVM virtual machines. Each virtual machine can have a different system, and each system is a clean system with lower performance overhead compared to Docker. It can also allocate the number of cores and the actual number of cores used, and limit bandwidth and disk usage like other virtualization technologies.

The disadvantage is that (there is no independent IPv4, I'm not sure if this can be considered a disadvantage, but IPv6 can be allocated.) It is a bit unstable. The Baota virtual host I purchased, I upgraded it to a cracked version in the terminal, and then restarted it in the service provider's console, and the server crashed. After reinstalling and upgrading, there was no problem, but the restart was a bit slow. Other disadvantages are currently unknown and not deeply understood.

If you want to play, you can directly go to the GitHub mentioned above and use the script to play.

Business Ideas:#

I found that people have been selling LXC servers a few years ago. There are probably not many people selling them now, and the prices are relatively cheap and niche.

But as I wrote in the previous article Docker Installation of Multiple Baota + Business Ideas, you can reproduce it by replacing Docker technology with LXC, create your own pre-installed cracked version of Baota image, and follow a similar idea as in this article, map the SSH, FTP, and MySQL ports of the container to the host machine.

The LXC server I purchased is accessed through a domain name bound to another server. Let's stop here for now, as I have been interrupted while writing this article...

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.