IncludeOS 可让您在云中运行应用程序而无需操作系统。IncludeOS 为您的应用程序添加了操作系统功能,让您能够创建高性能、安全且资源高效的虚拟机。
IncludeOS 应用程序在几十毫秒内启动,并且只需要几兆字节的磁盘和内存。
[在 Github 上查看] [url=https://join.slack.com/t/includeos/shared_invite/zt-5z7ts29z-_AX0kZNiUNE7eIMUP60GmQ][在 Slack 上聊天] [/url][告诉我更多]
要在 Linux 或 macOS 上使用 IncludeOS 运行服务,您无需安装 IncludeOS,但您需要根据要运行的服务安装一些依赖项。您可以先试用我们最简单的 hello_world 服务。对于此服务,您将需要以下依赖项。
- Conan 包管理器
- cmake、make、nasm
- clang,或者 Linux 上的 gcc。预构建的软件包适用于 clang 6.0 和 gcc 7.3
- 库姆
- python3 包:psutil、jsonschema
有了上述依赖项,您应该能够在几分钟内构建一个应用程序。$ conan config install https://github.com/includeos/conan_config.git $ git clone https://github.com/includeos/hello_world.git $ mkdir build_hello_world $ cd build_hello_world $ conan install ../hello_world -pr $ source ./activate.sh $ cmake ../hello_world $ cmake --build . $ boot hello
|
hello world 启动的服务看起来应该像这样:================================================================================ IncludeOS 0.14.1-1093 (x86_64 / 64-bit) +--> Running [ Hello world - OS included ]
~~~~~~~~~~~~~~~~ Hello world [ main ] returned with status 0
|
有关详细说明,请参阅GitHub README。安装后,我们建议查看并启动一些演示示例,以熟悉系统。
我们致力于让创建快速实用的服务变得简单。以下代码将设置一个简单的 TCP 回显服务,并愉快地与任何连接的人进行通信。
#include <os> #include <iostream> #include <net/interfaces>
void Service::start() { // Get the IP stack thats already been automatically configured auto& inet = net::Interfaces::get(0); // Setup a TCP echo server on port 7 (echo port) auto& server = inet.tcp().listen(7);
server.on_connect([] (auto conn) { // Log incomming connections on the console: std::cout << "Connection " << conn->to_string() << " established\n"; // When data is received, echo back conn->on_read(1024, [conn] (auto buf) { conn->write(buf); }); }); }
|
虚拟机的网络配置可以驻留在名为 config.json 的 JSON 文件中,该文件位于同一文件夹中。根据您的需要,它应该看起来像这样:{ "net" : [ { "iface": 0, "config": "dhcp-with-fallback", "address": "10.0.0.42", "netmask": "255.255.255.0", "gateway": "10.0.0.1" } ] }
|
建议
4K Download 定期更新其名为YouTube 的应用程序至 MP3。如果您需要从 YouTube 下载音频,我们强烈推荐它。