This commit is contained in:
Your Name
2025-08-16 16:24:12 -04:00
commit 1a020a7dca
52 changed files with 4346 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
tutorial1/

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

190
README.md Normal file
View File

@@ -0,0 +1,190 @@
# n-OS-tr
n-OS-tr is an attempt to create a nostr based operating system / distro.
We are starting with a base of debian live.
Currently exploring different means to this end.
## Debian Live Build Setup and Tutorial 1 Implementation
This document covers the complete process of setting up live-build and implementing Tutorial 1 from the Debian Live Manual.
### System Requirements
Tested on Pop!_OS 22.04 LTS (Ubuntu-based system).
### Phase 1: Installing Dependencies
The following packages are required for building Debian Live images:
```bash
sudo apt update
sudo apt install debootstrap xorriso squashfs-tools syslinux-utils cpio gzip gettext
```
**Package purposes:**
- `debootstrap`: Creates minimal Debian base system
- `xorriso`: Creates ISO images
- `squashfs-tools`: Creates compressed filesystem
- `syslinux-utils`: Boot loader utilities
- `cpio`, `gzip`, `gettext`: Archive and localization utilities
### Phase 2: Setting up Live-Build from Repository
Instead of installing live-build via system packages (which may be outdated), we use the repository directly for the most current version.
#### Creating the Wrapper Script
Create `lb-wrapper.sh` for convenient access to live-build commands:
```bash
#!/bin/bash
# Set the LIVE_BUILD environment variable to point to our repository
export LIVE_BUILD="$(dirname "$0")/live-build"
# Execute the live-build frontend with all arguments passed through
"$LIVE_BUILD/frontend/lb" "$@"
```
Make it executable:
```bash
chmod +x lb-wrapper.sh
```
**Usage:** Replace all `lb` commands with `./lb-wrapper.sh` to use the repository version.
### Phase 3: Tutorial 1 - Default Image Creation
Following the Debian Live Manual Tutorial 1 to create a basic live system:
```bash
mkdir tutorial1
cd tutorial1
../lb-wrapper.sh config
```
This creates the basic configuration structure in the `config/` directory.
### Phase 4: Building the Image
**Important:** Due to keyring compatibility issues between Ubuntu/Pop!_OS and Debian, we need to bypass GPG verification for development builds.
Build the image as root with security bypass:
```bash
sudo ../lb-wrapper.sh config --apt-secure false --distribution stable
sudo ../lb-wrapper.sh build 2>&1 | tee build.log
```
### Keyring Issues and Troubleshooting
**Problem:** Pop!_OS/Ubuntu keyrings are incompatible with both Debian testing and stable distributions, causing GPG verification failures.
**Error examples:**
- Debian testing: `The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 78DBA3BC47EF2265`
- Debian stable: `The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 762F67A0B2C39DE4`
**Solution:** Use `--apt-secure false` flag to bypass GPG verification for development purposes.
**Production note:** For production builds, proper keyring setup should be implemented instead of disabling security checks.
### Expected Results
- Build time: Varies based on internet connection and system performance
- Output file: `live-image-amd64.hybrid.iso` (approximately 298MB)
- This ISO can be:
- Tested in virtual machines (QEMU, VirtualBox)
- Written to USB drives
- Burned to optical media
### Command Summary
Complete sequence for Tutorial 1:
```bash
# 1. Install dependencies
sudo apt install debootstrap xorriso squashfs-tools syslinux-utils cpio gzip gettext
# 2. Create wrapper script (if not exists)
# [Create lb-wrapper.sh as shown above]
chmod +x lb-wrapper.sh
# 3. Create and configure tutorial
mkdir tutorial1
cd tutorial1
../lb-wrapper.sh config --apt-secure false --distribution stable
# 4. Build image
sudo ../lb-wrapper.sh build 2>&1 | tee build.log
# 5. Result: live-image-amd64.hybrid.iso ready for testing
```
### Notes
- The `--distribution stable` ensures we use Debian stable instead of the default testing
- Build logs are automatically saved due to the wrapper script configuration
- The `--apt-secure false` flag is a workaround for keyring issues on Ubuntu-based systems
- For clean rebuilds, use `sudo ../lb-wrapper.sh clean` before building again
## FAQ
### Q: What are the auto, config, and local directories created by `lb config` for?
**A:** When you run `lb config`, three directories are created:
1. **auto/** - Created but empty by default
- Used for optional automation scripts that you create yourself
- You can add `auto/config`, `auto/build`, `auto/clean` scripts that run automatically before their respective `lb` commands
- Most basic builds (like Tutorial 1) don't need these files
- Useful for advanced scenarios where you want reproducible builds with version control
2. **config/** - This is where the real configuration lives
- Contains all the subdirectories for customizing your live system
- Has the main config files (binary, bootstrap, chroot, common, source) with your build parameters
- This is where you add package lists, custom files, hooks, etc.
- Most important directory for customization
3. **local/** - For local customizations
- Also typically empty unless you have custom executables or files to include
- Used for build-time scripts and tools, not files to include in the final system
### Q: How do I add files to specific locations in the final live system?
**A:** Several directories in the config structure map directly to the final system filesystem:
**For files you want in the final live system:**
1. **config/includes.chroot/** - Maps directly to the root filesystem (`/`)
- To put a file in `/usr/local/bin/myscript` in the final system
- Place it at `config/includes.chroot/usr/local/bin/myscript`
- Everything in this directory gets copied to `/` in the live system
2. **config/includes.chroot_after_packages/** - Same mapping, but copied after packages are installed
- Use when you want to overwrite files that packages might have installed
- Same directory mapping as above
3. **config/includes.chroot_before_packages/** - Copied before packages are installed
- Less commonly used, but available if needed
**For files you want on the ISO/boot media itself (not in the live system):**
4. **config/includes.binary/** - Files that go on the boot media
- These appear on the USB/CD itself, not inside the running live system
- Useful for documentation, additional tools, etc.
**Example:** To put a custom script in `/usr/local/bin/hello` in your live system:
```bash
# 1. Create the directory structure
mkdir -p config/includes.chroot/usr/local/bin/
# 2. Put your script there
cp myscript config/includes.chroot/usr/local/bin/hello
# 3. Make it executable
chmod +x config/includes.chroot/usr/local/bin/hello
```
The build process will automatically copy it to the correct location in the live system.

6
deploy.sh Executable file
View File

@@ -0,0 +1,6 @@
rsync -v n-os-tr.sh ~/Servers/LaanTungir/WWW/n-os-tr.sh
rsync -v test.sh ~/Servers/LaanTungir/WWW/test.sh
rsync -v docker.sh ~/Servers/LaanTungir/WWW/docker.sh
# rsync -v --delete n_os_tr.sh ~/Servers/LaanTungir/WWW/n-os-tr.sh

457
docker.sh Executable file
View File

@@ -0,0 +1,457 @@
#!/bin/bash
# Docker Compose Installation and Nginx Setup Script for Debian
set -e
echo "Starting Docker Compose installation and Nginx setup..."
# Update package index
echo "Updating package index..."
sudo apt update
# Install prerequisites
echo "Installing prerequisites..."
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
# Add Docker's official GPG key
echo "Adding Docker's GPG key..."
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker repository
echo "Adding Docker repository..."
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update package index again
echo "Updating package index with Docker repository..."
sudo apt update
# Install Docker Engine
echo "Installing Docker Engine..."
sudo apt install -y docker-ce docker-ce-cli containerd.io
# Start and enable Docker service
echo "Starting Docker service..."
sudo systemctl start docker
sudo systemctl enable docker
# Add current user to docker group (optional, requires logout/login to take effect)
echo "Adding current user to docker group..."
sudo usermod -aG docker $USER
# Install Docker Compose
echo "Installing Docker Compose..."
DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')
sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Verify Docker Compose installation
echo "Verifying Docker Compose installation..."
docker-compose --version
# Create Docker directory structure
echo "Creating Docker directory structure..."
mkdir -p Docker
cd Docker
# Create subdirectories
mkdir -p strfry/data blossom/data conf.d WWW
# Create docker-compose.yml
echo "Creating docker-compose.yml..."
cat > docker-compose.yml << EOF
version: '3.8'
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./conf.d:/etc/nginx/conf.d:ro
- ./WWW:/var/www/html:ro
- /etc/letsencrypt:/etc/letsencrypt:ro
restart: unless-stopped
networks:
- web
depends_on:
- strfry
- blossom
strfry:
image: dockurr/strfry
container_name: strfry
ports:
- "7777:7777" # Internal port for nginx proxy
volumes:
- ./strfry/data:/app/strfry-db
- ./strfry/strfry.conf:/etc/strfry.conf
restart: always
stop_grace_period: 2m
networks:
- web
blossom:
image: ghcr.io/hzrd149/blossom-server:master
container_name: blossom
ports:
- "3000:3000" # Internal port for nginx proxy
volumes:
- ./blossom/data:/app/data
- ./blossom/config.yml:/app/config.yml
restart: always
networks:
- web
networks:
web:
driver: bridge
EOF
# Create nginx main configuration
echo "Creating nginx.conf..."
cat > nginx.conf << EOF
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '
'\$status \$body_bytes_sent "\$http_referer" '
'"\$http_user_agent" "\$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
EOF
# Create nginx site configuration
echo "Creating nginx site configuration..."
cat > conf.d/default.conf << EOF
server {
listen 80;
server_name localhost;
# Main website
location / {
root /var/www/html;
index index.html index.htm;
try_files \$uri \$uri/ =404;
}
# Strfry Nostr relay proxy
location /strfry {
rewrite ^/strfry(.*) \$1 break;
proxy_pass http://strfry:7777;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade;
proxy_read_timeout 86400;
}
# Blossom blob storage proxy
location /blossom {
rewrite ^/blossom(.*) \$1 break;
proxy_pass http://blossom:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade;
client_max_body_size 100M;
}
}
EOF
# Create strfry configuration
echo "Creating strfry configuration..."
cat > strfry/strfry.conf << EOF
##
## Default strfry config
##
# Directory that contains the strfry LMDB database (restart required)
db = "./strfry-db/"
dbParams {
# Maximum number of threads/processes that can simultaneously have LMDB transactions open (restart required)
maxreaders = 256
# Size of mmap() to use when loading LMDB (restart required)
mapsize = 512MB
}
relay {
# Interface to listen on. Use 0.0.0.0 to listen on all interfaces (restart required)
bind = "0.0.0.0"
# Port to open for the nostr websocket protocol (restart required)
port = 7777
# Set OS-limit on maximum number of open files/sockets (if 0, don't attempt to set) (restart required)
nofiles = 1000000
# HTTP header that contains the client's real IP, before reverse proxying (ie x-real-ip) (MUST be all lower-case)
realIpHeader = "x-real-ip"
info {
# NIP-11: Name of this server. Short/descriptive (< 30 characters)
name = "strfry default"
# NIP-11: Detailed plain-text description of relay
description = "This is a strfry instance."
# NIP-11: Administrative nostr pubkey, for contact purposes
pubkey = ""
# NIP-11: Alternative administrative contact (email, website, etc)
contact = ""
}
# Maximum accepted incoming websocket frame size (should be larger than max event and yesstr msg size)
maxWebsocketPayloadSize = 131072
# Websocket-level PING message frequency (should be less than any reverse proxy idle timeouts)
autoPingSeconds = 55
# If TCP keep-alive should be enabled (detect dropped connections to upstream reverse proxy)
enableTcpKeepalive = false
# How much uninterrupted CPU time a REQ query should get during its DB scan
queryTimesliceBudgetMicroseconds = 10000
# Maximum records that can be returned per filter
maxFilterLimit = 500
# Maximum number of subscriptions (concurrent REQs) a connection can have open at any time
maxSubsPerConnection = 20
writePolicy {
# If non-empty, path to an executable script that implements the writePolicy plugin logic
plugin = ""
}
compression {
# Use permessage-deflate compression if supported by client. Reduces bandwidth, but uses more CPU (restart required)
enabled = true
# Maintain a sliding window buffer for each connection. Improves compression, but uses more memory (restart required)
slidingWindow = true
}
logging {
# Dump all incoming messages
dumpInAll = false
# Dump all incoming EVENT messages
dumpInEvents = false
# Dump all incoming REQ/CLOSE messages
dumpInReqs = false
# Log performance metrics for initial REQ database scans
dbScanPerf = false
}
numThreads {
# Ingester threads: route incoming requests, validate events/sigs (restart required)
ingester = 3
# reqWorker threads: Handle initial DB scan for REQ queries (restart required)
reqWorker = 3
# reqMonitor threads: Handle filtering of new events (restart required)
reqMonitor = 3
# yesstr threads: Experimental yesstr protocol (restart required)
yesstr = 1
}
}
EOF
# Create blossom configuration
echo "Creating blossom configuration..."
cat > blossom/config.yml << EOF
# Blossom Server Configuration
# Server settings
server:
port: 3000
host: "0.0.0.0"
# Storage settings
storage:
# Directory to store uploaded files
directory: "/app/data"
# Maximum file size in bytes (100MB)
maxFileSize: 104857600
# Allowed file types (empty array allows all types)
allowedTypes: []
# Enable file deduplication
deduplicate: true
# Authentication settings (optional)
auth:
# Require authentication for uploads
required: false
# Admin public keys (if auth is enabled)
adminKeys: []
# Rate limiting
rateLimit:
# Enable rate limiting
enabled: true
# Requests per minute per IP
requestsPerMinute: 100
# Upload requests per minute per IP
uploadsPerMinute: 10
# Logging
logging:
# Log level: debug, info, warn, error
level: "info"
# Enable access logs
accessLogs: true
# CORS settings
cors:
# Enable CORS
enabled: true
# Allowed origins (* for all)
origins: ["*"]
# Allowed methods
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
# Allowed headers
headers: ["Content-Type", "Authorization"]
# Cleanup settings
cleanup:
# Enable automatic cleanup of old files
enabled: false
# Maximum age of files in days
maxAge: 30
# Cleanup interval in hours
interval: 24
EOF
# Create sample HTML content
echo "Creating sample HTML content..."
cat > WWW/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>Nostr Services - Docker Setup</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
background-color: #f5f5f5;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 { color: #333; }
.service {
margin: 20px 0;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #f9f9f9;
}
.service h3 { margin-top: 0; color: #555; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="container">
<h1>Nostr Services - Docker Setup</h1>
<p>Your Nostr infrastructure is running successfully!</p>
<div class="service">
<h3>🔗 Strfry Nostr Relay</h3>
<p>Nostr relay for storing and retrieving events</p>
<p><strong>Endpoint:</strong> <a href="/strfry" target="_blank">ws://localhost/strfry</a></p>
</div>
<div class="service">
<h3>🌸 Blossom Blob Storage</h3>
<p>Decentralized blob storage for media files</p>
<p><strong>Endpoint:</strong> <a href="/blossom" target="_blank">http://localhost/blossom</a></p>
</div>
<div style="margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee;">
<p><em>Services are proxied through Nginx and running in Docker containers</em></p>
</div>
</div>
</body>
</html>
EOF
# Start services using Docker Compose
echo "Starting Docker services..."
sudo docker-compose up -d
# Go back to original directory
cd ..
# Show running containers
echo "Docker containers status:"
sudo docker ps
echo ""
echo "Installation and setup completed!"
echo ""
echo "Docker directory structure created with:"
echo "- Strfry Nostr relay configuration and data directory"
echo "- Blossom blob storage configuration and data directory"
echo "- Nginx reverse proxy configuration"
echo "- Sample website content"
echo ""
echo "Services are now running and accessible at:"
echo "- Main site: http://localhost"
echo "- Strfry relay: ws://localhost/strfry"
echo "- Blossom storage: http://localhost/blossom"
echo "- External IP: http://$(hostname -I | awk '{print $1}')"
echo ""
echo "Docker management commands (run from Docker/ directory):"
echo "- Stop services: cd Docker && sudo docker-compose down"
echo "- View logs: cd Docker && sudo docker-compose logs [service_name]"
echo "- Restart services: cd Docker && sudo docker-compose restart"
echo "- View status: sudo docker ps"
echo ""
echo "Note: You may need to logout and login again for docker group permissions to take effect."

View File

@@ -0,0 +1,603 @@
<!DOCTYPE html>
<!-- saved from url=(0091)https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#tutorial-1 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
examples -
Debian Live Manual
</title>
<meta name="dc.title" content="Debian Live Manual">
<meta name="dc.author" content="Debian Live Project &lt;debian-live@lists.debian.org&gt;">
<meta name="dc.publisher" content="Debian Live Project &lt;debian-live@lists.debian.org&gt;">
<meta name="dc.date" content="2023-03-19">
<meta name="dc.rights" content="Copyright: Copyright (C) 2006-2015 Live Systems Project, Copyright (C) 2016-2023 The Debian Live team \\ License: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. \\ \\ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. \\ \\ You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. \\ \\ The complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-3 file.">
<meta name="generator" content="SiSU 7.2.1_pre_rel of 2019w35/4 (2019-09-05) (n*x and Ruby!)">
<link rel="generator" href="http://www.sisudoc.org/">
<link rel="shortcut icon" href="https://live-team.pages.debian.net/live-manual/html/_sisu/image/rb7.ico">
<link href="./examples - Debian Live Manual_files/html.css" rel="stylesheet">
</head>
<body lang="en">
<a name="top" id="top"></a><table summary="segment navigation band with banner" bgcolor="#ffffff" width="100%"><tbody><tr>
<td width="20%" align="left">
<table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">
<tbody><tr><td align="left" bgcolor="#ffffff">
<p class="tiny_left"><a href="https://live-team.pages.debian.net/live-manual/" target="_top">
Live manual
</a></p>
<p class="tiny_left"><a href="https://wiki.debian.org/DebianLive" target="_top">
Debian Live
</a></p>
</td></tr>
</tbody></table>
</td>
<td width="75%" align="center">
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td align="center" bgcolor="#ffffff">
</td></tr></tbody></table>
</td>
<td width="5%" align="right">
<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td align="center" bgcolor="#ffffff">
<a href="https://live-team.pages.debian.net/live-manual/html/live-manual/coding-style.en.html" target="_top">
<img border="0" width="22" height="22" src="./examples - Debian Live Manual_files/arrow_prev_red.png" alt="&lt;&lt; previous">
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html" target="_top">
<img border="0" width="22" height="22" src="./examples - Debian Live Manual_files/arrow_up_red.png" alt="toc">
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="https://live-team.pages.debian.net/live-manual/html/live-manual/style-guide.en.html" target="_top">
<img border="0" width="22" height="22" src="./examples - Debian Live Manual_files/arrow_next_red.png" alt="next &gt;&gt;">
</a>
</td>
<td>
</td></tr>
</tbody></table>
</td></tr>
</tbody></table><div class="content0">
<h1 class="tiny">
Debian Live Manual
</h1>
</div><div class="content0">
<h1 class="tiny">
Examples
</h1>
</div><div class="content0"><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#803" class="lnkocn">803</a></label>
<h1 class="norm" id="803"><a name="803"></a>
16. Examples
</h1>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#804" class="lnkocn">804</a></label>
<p class="i0" id="804">
This chapter covers example builds for specific use cases with live systems. If you are new to building your own live system images, we recommend you first look at the three tutorials in sequence, as each one teaches new techniques that will help you use and understand the remaining examples.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#805" class="lnkocn">805</a></label>
<p class="bold" id="805"><a name="805"></a> <a id="husing-the-examples"></a>
<a name="h16.1"></a><a name="using-the-examples"></a>16.1 Using the examples
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#806" class="lnkocn">806</a></label>
<p class="i0" id="806">
To use these examples you need a system to build them on that meets the requirements listed in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/installation.en.html#requirements">Requirements</a> and has <i>live-build</i> installed as described in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/installation.en.html#installing-live-build">Installing live-build</a>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#807" class="lnkocn">807</a></label>
<p class="i0" id="807">
Note that, for the sake of brevity, in these examples we do not specify a local mirror to use for the build. You can speed up downloads considerably if you use a local mirror. You may specify the options when you use <tt>lb config</tt>, as described in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#distribution-mirrors-build-time">Distribution mirrors used at build time</a>, or for more convenience, set the default for your build system in <tt>/etc/live/build.conf</tt>. Simply create this file and in it, set the corresponding <tt>LB_MIRROR_*</tt> variables to your preferred mirror. All other mirrors used in the build will be defaulted from these values. For example:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#808" class="lnkocn">808</a></label>
<p class="code" id="808">
LB_MIRROR_BOOTSTRAP="http://mirror/debian/" <br>
LB_MIRROR_CHROOT_SECURITY="http://mirror/debian-security/" <br>
LB_MIRROR_CHROOT_BACKPORTS="http://mirror/debian-backports/"<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#809" class="lnkocn">809</a></label>
<p class="bold" id="809"><a name="809"></a> <a id="htutorial-1"></a>
<a name="h16.2"></a><a name="tutorial-1"></a>16.2 Tutorial 1: A default image
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#810" class="lnkocn">810</a></label>
<p class="i0" id="810">
<b>Use case:</b> Create a simple first image, learning the basics of <i>live-build</i>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#811" class="lnkocn">811</a></label>
<p class="i0" id="811">
In this tutorial, we will build a default ISO hybrid live system image containing only base packages (no Xorg) and some live system support packages, as a first exercise in using <i>live-build</i>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#812" class="lnkocn">812</a></label>
<p class="i0" id="812">
You can't get much simpler than this:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#813" class="lnkocn">813</a></label>
<p class="code" id="813">
$ mkdir tutorial1 ; cd tutorial1 ; lb config<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#814" class="lnkocn">814</a></label>
<p class="i0" id="814">
Examine the contents of the <tt>config/</tt> directory if you wish. You will see stored here a skeletal configuration, ready to customize or, in this case, use immediately to build a default image.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#815" class="lnkocn">815</a></label>
<p class="i0" id="815">
Now, as superuser, build the image, saving a log as you build with <tt>tee</tt>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#816" class="lnkocn">816</a></label>
<p class="code" id="816">
# lb build 2&gt;&amp;1 | tee build.log<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#817" class="lnkocn">817</a></label>
<p class="i0" id="817">
Assuming all goes well, after a while, the current directory will contain <tt>live-image-amd64.hybrid.iso</tt>. This ISO hybrid image can be booted directly in a virtual machine as described in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/the-basics.en.html#testing-iso-with-qemu">Testing an ISO image with Qemu</a> and <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/the-basics.en.html#testing-iso-with-virtualbox">Testing an ISO image with VirtualBox</a>, or else imaged onto optical media or a USB flash device as described in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/the-basics.en.html#burning-iso-image">Burning an ISO image to a physical medium</a> and <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/the-basics.en.html#copying-iso-hybrid-to-usb">Copying an ISO hybrid image to a USB stick</a>, respectively.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#818" class="lnkocn">818</a></label>
<p class="bold" id="818"><a name="818"></a> <a id="htutorial-2"></a>
<a name="h16.3"></a><a name="tutorial-2"></a>16.3 Tutorial 2: A web browser utility
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#819" class="lnkocn">819</a></label>
<p class="i0" id="819">
<b>Use case:</b> Create a web browser utility image, learning how to apply customizations.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#820" class="lnkocn">820</a></label>
<p class="i0" id="820">
In this tutorial, we will create an image suitable for use as a web browser utility, serving as an introduction to customizing live system images.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#821" class="lnkocn">821</a></label>
<p class="code" id="821">
$ mkdir tutorial2<br>
$ cd tutorial2<br>
$ lb config<br>
$ echo "task-lxde-desktop firefox-esr" &gt;&gt; config/package-lists/my.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#822" class="lnkocn">822</a></label>
<p class="i0" id="822">
Our choice of LXDE for this example reflects our desire to provide a minimal desktop environment, since the focus of the image is the single use we have in mind, the web browser. We could go even further and provide a default configuration for the web browser in <tt>config/includes.chroot/etc/iceweasel/profile/</tt>, or additional support packages for viewing various kinds of web content, but we leave this as an exercise for the reader.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#823" class="lnkocn">823</a></label>
<p class="i0" id="823">
Build the image, again as superuser, keeping a log as in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#tutorial-1">Tutorial 1</a>:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#824" class="lnkocn">824</a></label>
<p class="code" id="824">
# lb build 2&gt;&amp;1 | tee build.log<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#825" class="lnkocn">825</a></label>
<p class="i0" id="825">
Again, verify the image is OK and test, as in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#tutorial-1">Tutorial 1</a>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#826" class="lnkocn">826</a></label>
<p class="bold" id="826"><a name="826"></a> <a id="htutorial-3"></a>
<a name="h16.4"></a><a name="tutorial-3"></a>16.4 Tutorial 3: A personalized image
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#827" class="lnkocn">827</a></label>
<p class="i0" id="827">
<b>Use case:</b> Create a project to build a personalized image, containing your favourite software to take with you on a USB stick wherever you go, and evolving in successive revisions as your needs and preferences change.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#828" class="lnkocn">828</a></label>
<p class="i0" id="828">
Since we will be changing our personalized image over a number of revisions, and we want to track those changes, trying things experimentally and possibly reverting them if things don't work out, we will keep our configuration in the popular <tt>git</tt> version control system. We will also use the best practice of autoconfiguration via <tt>auto</tt> scripts as described in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/managing-a-configuration.en.html#managing-a-configuration">Managing a configuration</a>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#829" class="lnkocn">829</a></label>
<p class="bold" id="829"><a name="829"></a> <a id="hc16.4.1"></a>
<a name="c16.4.1"></a><a name="h16.4.1"></a>16.4.1 First revision
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#830" class="lnkocn">830</a></label>
<p class="code" id="830">
$ mkdir -p tutorial3/auto<br>
$ cp /usr/share/doc/live-build/examples/auto/* tutorial3/auto/<br>
$ cd tutorial3<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#831" class="lnkocn">831</a></label>
<p class="i0" id="831">
Edit <tt>auto/config</tt> to read as follows:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#832" class="lnkocn">832</a></label>
<p class="code" id="832">
#!/bin/sh<br><br>
lb config noauto \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--distribution stable \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"${@}"<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#833" class="lnkocn">833</a></label>
<p class="i0" id="833">
Perform <tt>lb config</tt> to generate the config tree, using the <tt>auto/config</tt> script you just created:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#834" class="lnkocn">834</a></label>
<p class="code" id="834">
$ lb config<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#835" class="lnkocn">835</a></label>
<p class="i0" id="835">
Now populate your local package list:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#836" class="lnkocn">836</a></label>
<p class="code" id="836">
$ echo "task-lxde-desktop spice-vdagent hexchat" &gt;&gt; config/package-lists/my.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#837" class="lnkocn">837</a></label>
<p class="i0" id="837">
First, <tt>--distribution stable</tt> ensures that ⌠stable} is used instead of the default {testing⌡. Second, we have added <i>spice-vdagent</i> for easier testing the image in <i>qemu</i>. And finally, we have added an initial favourite package: <i>hexchat</i>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#838" class="lnkocn">838</a></label>
<p class="i0" id="838">
Now, build the image:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#839" class="lnkocn">839</a></label>
<p class="code" id="839">
# lb build<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#840" class="lnkocn">840</a></label>
<p class="i0" id="840">
Note that unlike in the first two tutorials, we no longer have to type <tt>2&gt;&amp;1 | tee build.log</tt> as that is now included in <tt>auto/build</tt>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#841" class="lnkocn">841</a></label>
<p class="i0" id="841">
Once you've tested the image (as in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#tutorial-1">Tutorial 1</a>) and are satisfied it works, it's time to initialize our <tt>git</tt> repository, adding only the auto scripts we just created, and then make the first commit:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#842" class="lnkocn">842</a></label>
<p class="code" id="842">
$ git init<br>
$ cp /usr/share/doc/live-build/examples/gitignore .gitignore<br>
$ git add .gitignore auto config<br>
$ git commit -m "Initial import."<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#843" class="lnkocn">843</a></label>
<p class="bold" id="843"><a name="843"></a> <a id="hc16.4.2"></a>
<a name="c16.4.2"></a><a name="h16.4.2"></a>16.4.2 Second revision
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#844" class="lnkocn">844</a></label>
<p class="i0" id="844">
In this revision, we're going to clean up from the first build, replace the <i>smplayer</i> package with <i>vlc</i> package, rebuild, test and commit.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#845" class="lnkocn">845</a></label>
<p class="i0" id="845">
The <tt>lb clean</tt> command will clean up all generated files from the previous build except for the cache, which saves having to re-download packages. This ensures that the subsequent <tt>lb build</tt> will re-run all stages to regenerate the files from our new configuration.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#846" class="lnkocn">846</a></label>
<p class="code" id="846">
# lb clean<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#847" class="lnkocn">847</a></label>
<p class="i0" id="847">
Now install the <i>vlc</i> package before the <i>lxde</i> package chooses between <i>smplayer</i>, <i>vlc</i> and <i>mplayer-gui</i> in our local package list in <tt>config/package-lists/my.list.chroot</tt>:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#848" class="lnkocn">848</a></label>
<p class="code" id="848">
$ echo "vlc task-lxde-desktop spice-vdagent hexchat" &gt;&gt; config/package-lists/my.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#849" class="lnkocn">849</a></label>
<p class="i0" id="849">
Build again:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#850" class="lnkocn">850</a></label>
<p class="code" id="850">
# lb build<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#851" class="lnkocn">851</a></label>
<p class="i0" id="851">
Test, and when you're satisfied, commit the next revision:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#852" class="lnkocn">852</a></label>
<p class="code" id="852">
$ git commit -a -m "Replacing smplayer with vlc."<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#853" class="lnkocn">853</a></label>
<p class="i0" id="853">
Of course, more complicated changes to the configuration are possible, perhaps adding files in subdirectories of <tt>config/</tt>. When you commit new revisions, just take care not to hand edit or commit the top-level files in <tt>config</tt> containing <tt>LB_*</tt> variables, as these are build products, too, and are always cleaned up by <tt>lb clean</tt> and re-created with <tt>lb config</tt> via their respective <tt>auto</tt> scripts.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#854" class="lnkocn">854</a></label>
<p class="i0" id="854">
We've come to the end of our tutorial series. While many more kinds of customization are possible, even just using the few features explored in these simple examples, an almost infinite variety of different images can be created. The remaining examples in this section cover several other use cases drawn from the collected experiences of users of live systems.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#855" class="lnkocn">855</a></label>
<p class="bold" id="855"><a name="855"></a> <a id="hc16.5"></a>
<a name="c16.5"></a><a name="h16.5"></a>16.5 A VNC Kiosk Client
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#856" class="lnkocn">856</a></label>
<p class="i0" id="856">
<b>Use case:</b> Create an image with <i>live-build</i> to boot directly to a VNC server.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#857" class="lnkocn">857</a></label>
<p class="i0" id="857">
Make a build directory and create an skeletal configuration inside it, disabling recommends to make a minimal system. And then create two initial package lists: the first one generated with a script provided by <i>live-build</i> named <tt>Packages</tt> (see <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#generated-package-lists">Generated package lists</a>), and the second one including <i>xorg</i>, <i>gdm3</i>, <i>metacity</i> and <i>xvnc4viewer</i>.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#858" class="lnkocn">858</a></label>
<p class="code" id="858">
$ mkdir vnc-kiosk-client<br>
$ cd vnc-kiosk-client<br>
$ lb config --apt-recommends false<br>
$ echo '! Packages Priority standard' &gt; config/package-lists/standard.list.chroot<br>
$ echo "xorg gdm3 metacity xtightvncviewer" &gt; config/package-lists/my.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#859" class="lnkocn">859</a></label>
<p class="i0" id="859">
As explained in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#tweaking-apt-to-save-space">Tweaking APT to save space</a> you may need to re-add some recommended packages to make your image work properly.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#860" class="lnkocn">860</a></label>
<p class="i0" id="860">
An easy way to list recommends is using <i>apt-cache</i>. For example:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#861" class="lnkocn">861</a></label>
<p class="code" id="861">
$ apt-cache depends live-config live-boot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#862" class="lnkocn">862</a></label>
<p class="i0" id="862">
In this example we found out that we had to re-include several packages recommended by <i>live-config</i> and <i>live-boot</i>: <tt>user-setup</tt> to make autologin work and <tt>sudo</tt> as an essential program to shutdown the system. Besides, it could be handy to add <tt>live-tools</tt> to be able to copy the image to RAM and <tt>eject</tt> to eventually eject the live medium. So:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#863" class="lnkocn">863</a></label>
<p class="code" id="863">
$ echo "live-tools user-setup sudo eject" &gt; config/package-lists/recommends.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#864" class="lnkocn">864</a></label>
<p class="i0" id="864">
After that, create the directory <tt>/etc/skel</tt> in <tt>config/includes.chroot</tt> and put a custom <tt>.xsession</tt> in it for the default user that will launch <i>metacity</i> and start <i>xvncviewer</i>, connecting to port <tt>5901</tt> on a server at <tt>192.168.1.2</tt>:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#865" class="lnkocn">865</a></label>
<p class="code" id="865">
$ mkdir -p config/includes.chroot/etc/skel<br>
$ cat &gt; config/includes.chroot/etc/skel/.xsession &lt;&lt; EOF<br>
#!/bin/sh<br><br>
/usr/bin/metacity &amp;<br>
/usr/bin/xvncviewer 192.168.1.2:1<br><br>
exit<br>
EOF<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#866" class="lnkocn">866</a></label>
<p class="i0" id="866">
Build the image:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#867" class="lnkocn">867</a></label>
<p class="code" id="867">
# lb build<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#868" class="lnkocn">868</a></label>
<p class="i0" id="868">
Enjoy.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#869" class="lnkocn">869</a></label>
<p class="bold" id="869"><a name="869"></a> <a id="hc16.6"></a>
<a name="c16.6"></a><a name="h16.6"></a>16.6 A minimal image for a 512MB USB key
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#870" class="lnkocn">870</a></label>
<p class="i0" id="870">
<b>Use case:</b> Create a default image with some components removed in order to fit on a 512MB USB key with a little space left over to use as you see fit.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#871" class="lnkocn">871</a></label>
<p class="i0" id="871">
When optimizing an image to fit a certain media size, you need to understand the tradeoffs you are making between size and functionality. In this example, we trim only so much as to make room for additional material within a 512MB media size, but without doing anything to destroy the integrity of the packages contained within, such as the purging of locale data via the <i>localepurge</i> package, or other such "intrusive" optimizations. Of particular note, we use <tt>--debootstrap-options</tt> to create a minimal system from scratch and <tt>--binary image hdd</tt> to create an image that can be copied to a USB key.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#872" class="lnkocn">872</a></label>
<p class="code" id="872">
$ lb config --binary-image hdd --apt-indices false --apt-recommends false --debootstrap-options "--variant=minbase" --firmware-chroot false --memtest none<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#873" class="lnkocn">873</a></label>
<p class="i0" id="873">
To make the image work properly, we must re-add, at least, two recommended packages which are left out by the <tt>--apt-recommends false</tt> option. See <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#tweaking-apt-to-save-space">Tweaking APT to save space</a>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#874" class="lnkocn">874</a></label>
<p class="code" id="874">
$ echo "user-setup sudo" &gt; config/package-lists/recommends.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#875" class="lnkocn">875</a></label>
<p class="i0" id="875">
Additionally, you'll want to have network access, so another two recommended packages need to be re-added:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#876" class="lnkocn">876</a></label>
<p class="code" id="876">
$ echo "ifupdown isc-dhcp-client" &gt;&gt; config/package-lists/recommends.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#877" class="lnkocn">877</a></label>
<p class="i0" id="877">
Now, build the image in the usual way:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#878" class="lnkocn">878</a></label>
<p class="code" id="878">
# lb build 2&gt;&amp;1 | tee build.log<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#879" class="lnkocn">879</a></label>
<p class="i0" id="879">
On the author's system at the time of writing this, the above configuration produced a 298MiB image. This compares favourably with the 380MiB image produced by the default configuration in <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#tutorial-1">Tutorial 1</a>, when <tt>--binary-image hdd</tt> is added.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#880" class="lnkocn">880</a></label>
<p class="i0" id="880">
Leaving off APT's indices with <tt>--apt-indices false</tt> saves a fair amount of space, the tradeoff being that you need to do an <tt>apt-get update</tt> before using <i>apt</i> in the live system. Dropping recommended packages with <tt>--apt-recommends false</tt> saves some additional space, at the expense of omitting some packages you might otherwise expect to be there. <tt>--debootstrap-options "--variant=minbase"</tt> bootstraps a minimal system from the start. Not automatically including firmware packages with <tt>--firmware-chroot false</tt> saves some space too. And finally, <tt>--memtest none</tt> prevents the installation of a memory tester.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#881" class="lnkocn">881</a></label>
<p class="i0" id="881">
<b>Note:</b> A minimal system can also be achieved using hooks, like for example the <tt>stripped.hook.chroot</tt> hook found in <tt>/usr/share/doc/live-build/examples/hooks</tt>. It may shave off additional small amounts of space and produce an image of 277MiB. However, it does so by removal of documentation and other files from packages installed on the system. This violates the integrity of those packages and that, as the comment header warns, may have unforeseen consequences. That is why using a minimal <i>debootstrap</i> is the recommended way of achieving this goal.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#882" class="lnkocn">882</a></label>
<p class="bold" id="882"><a name="882"></a> <a id="hc16.7"></a>
<a name="c16.7"></a><a name="h16.7"></a>16.7 A localized GNOME desktop and installer
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#883" class="lnkocn">883</a></label>
<p class="i0" id="883">
<b>Use case:</b> Create a GNOME desktop image, localized for Switzerland and including an installer.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#884" class="lnkocn">884</a></label>
<p class="i0" id="884">
We want to make an iso-hybrid image using our preferred desktop, in this case GNOME, containing all of the same packages that would be installed by the standard Debian installer for GNOME.
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#885" class="lnkocn">885</a></label>
<p class="i0" id="885">
Our initial problem is the discovery of the names of the appropriate language tasks. Currently, <i>live-build</i> cannot help with this. While we might get lucky and find this by trial-and-error, there is a tool, <tt>grep-dctrl</tt>, which can be used to dig it out of the task descriptions in tasksel-data, so to prepare, make sure you have both of those things:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#886" class="lnkocn">886</a></label>
<p class="code" id="886">
# apt-get install dctrl-tools tasksel-data<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#887" class="lnkocn">887</a></label>
<p class="i0" id="887">
Now we can search for the appropriate tasks, first with:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#888" class="lnkocn">888</a></label>
<p class="code" id="888">
$ grep-dctrl -FTest-lang de /usr/share/tasksel/descs/debian-tasks.desc -sTask<br>
Task: german<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#889" class="lnkocn">889</a></label>
<p class="i0" id="889">
By this command, we discover the task is called, plainly enough, german. Now to find the related tasks:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#890" class="lnkocn">890</a></label>
<p class="code" id="890">
$ grep-dctrl -FEnhances german /usr/share/tasksel/descs/debian-tasks.desc -sTask<br>
Task: german-desktop<br>
Task: german-kde-desktop<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#891" class="lnkocn">891</a></label>
<p class="i0" id="891">
At boot time we will generate the <b>de_CH.UTF-8</b> locale and select the <b>ch</b> keyboard layout. Now let's put the pieces together. Recalling from <a href="https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-package-installation.en.html#using-metapackages">Using metapackages</a> that task metapackages are prefixed <tt>task-</tt>, we just specify these language boot parameters, then add standard priority packages and all our discovered task metapackages to our package list as follows:
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#892" class="lnkocn">892</a></label>
<p class="code" id="892">
$ mkdir live-gnome-ch<br>
$ cd live-gnome-ch<br>
$ lb config \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--bootappend-live "boot=live components locales=de_CH.UTF-8 keyboard-layouts=ch" \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--debian-installer live<br>
$ echo '! Packages Priority standard' &gt; config/package-lists/standard.list.chroot<br>
$ echo task-gnome-desktop task-german task-german-desktop &gt;&gt; config/package-lists/desktop.list.chroot<br>
$ echo debian-installer-launcher &gt;&gt; config/package-lists/installer.list.chroot<br>
</p>
</div><div class="substance">
<label class="ocn"><a href="https://live-team.pages.debian.net/live-manual/html/live-manual/examples.en.html#893" class="lnkocn">893</a></label>
<p class="i0" id="893">
Note that we have included the <i>debian-installer-launcher</i> package to launch the installer from the live desktop.
</p>
</div></div><br><div class="main_column">
<table summary="segment navigation band" bgcolor="#ffffff" width="100%"><tbody><tr>
<td width="70%" align="center">
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td align="center" bgcolor="#ffffff">
</td></tr></tbody></table>
</td>
<td width="5%" align="right">
<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td align="center" bgcolor="#ffffff">
<a href="https://live-team.pages.debian.net/live-manual/html/live-manual/coding-style.en.html" target="_top">
<img border="0" width="22" height="22" src="./examples - Debian Live Manual_files/arrow_prev_red.png" alt="&lt;&lt; previous">
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html" target="_top">
<img border="0" width="22" height="22" src="./examples - Debian Live Manual_files/arrow_up_red.png" alt="toc">
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="https://live-team.pages.debian.net/live-manual/html/live-manual/style-guide.en.html" target="_top">
<img border="0" width="22" height="22" src="./examples - Debian Live Manual_files/arrow_next_red.png" alt="next &gt;&gt;">
</a>
</td>
<td>
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</div><div class="main_column">
<a name="bottom" id="bottom"></a>
<a name="end" id="end"></a>
</div>
</body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

File diff suppressed because it is too large Load Diff

11
lb-wrapper.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Live-build wrapper script
# This script allows you to run live-build commands from the local repository
# without needing to type the full path each time
# Set the LIVE_BUILD environment variable to point to our local repository
export LIVE_BUILD="/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build"
# Execute the lb command from our repository with all passed arguments
exec "${LIVE_BUILD}/frontend/lb" "$@"

1
live-build Submodule

Submodule live-build added at c2c3f77929

700
n-os-tr.sh Executable file
View File

@@ -0,0 +1,700 @@
#!/bin/bash
# To download and execute
# curl -s https://corpum.com/root.sh | bash
# To set up larger font on system
# dpkg-reconfigure console-setup
echo "";
echo " ██████ ███████ ";
echo " ██ ██ ██ ";
echo " ███████ ██ ██ ███████ ██████ █████ ";
echo " ██ ██ ██ ██ ██ ██ ██ ██ ";
echo " ██ ██ █████ ██████ ███████ █████ ██ ██ ";
echo "";
printf "\n\n
#############################################################################
# Setup System
#############################################################################
\n\n"
sudo hostnamectl set-hostname nostr
#CREATE MY DIRECTORIES
mkdir -p ~/Downloads
mkdir -p ~/Applications
mkdir -p ~/Pictures
mkdir -p ~/Music
mkdir -p ~/Temp
mkdir -p ~/Trash
# ALIAI
#############################################################################
echo "alias ll='ls -l'" >> ~/.bashrc
echo "alias la='ls -a'" >> ~/.bashrc
echo "alias lla='ls -al'" >> ~/.bashrc
echo "alias l='ls -CF'" >> ~/.bashrc
echo "alias ss='gnome-screenshot -a'" >> ~/.bashrc
echo "alias untargz='tar -xzf'" >> ~/.bashrc
# (DE)COMPRESSION
#############################################################################
echo "alias un.tar.bz2='tar xvjf'" >> ~/.bashrc
echo "alias un.tar.gz='tar -xzf'" >> ~/.bashrc
echo "alias un.gz=gunzip" >> ~/.bashrc
printf "\n\n
#############################################################################
# INSTALL GENERAL SOFTWARE BEFORE WE GO DARK ...
#############################################################################
\n\n"
#UPDATE THE SYTEM
sudo add-apt-repository ppa:arduino-team/arduino-stable
sudo apt update -y;
# sudo apt upgrade -y;
#GENERAL TOOLS
sudo apt install htop -y
sudo apt install ranger -y
sudo apt install sshfs -y
sudo apt install curl -y
sudo apt install vim -y
sudo apt install secure-delete -y
sudo apt install jq -y
sudo apt install wget -y
sudo apt install arduino -y
sudo apt install font-manager -y
sudo apt install moreutils -y;
#FUN
sudo apt install cmatrix -y
printf "\n\n
#############################################################################
# BRAVE BROWSER
#############################################################################
\n\n"
sudo curl -fsS https://dl.brave.com/install.sh | sh
printf "\n
#############################################################################
# CODIUM
#############################################################################
\n
"
# Detect system architecture
ARCH=$(dpkg --print-architecture)
# Get the latest release info and extract the appropriate .deb download URL
CODIUM_URL=$(curl -s https://api.github.com/repos/vscodium/vscodium/releases/latest \
| grep "browser_download_url.*codium_.*_${ARCH}\.deb" \
| grep -v "\.sha" \
| cut -d'"' -f4)
echo "Found VSCodium URL: $CODIUM_URL"
# Check if URL was found
if [ -z "$CODIUM_URL" ]; then
echo "Error: Could not find VSCodium .deb download URL"
exit 1
fi
# Download the .deb file using curl
echo "Downloading VSCodium..."
curl -L -o "codium_${ARCH}.deb" "$CODIUM_URL"
# Check if download was successful
if [ $? -ne 0 ]; then
echo "Error: Failed to download VSCodium"
exit 1
fi
# Install the .deb package
echo "Installing VSCodium..."
sudo apt update
sudo apt install -y "./codium_${ARCH}.deb"
# Clean up the downloaded file
sudo rm "codium_${ARCH}.deb"
echo "VSCodium installation completed!"
printf "\n\n
#############################################################################
# TIME TO GO DARK
#############################################################################
\n\n
#############################################################################
# INSTALL TOR
#############################################################################
\n\n"
# apt update;
sudo apt install -y tor;
sudo apt install -y apt-transport-tor;
sudo sed -i 's/#ControlPort 9051/ControlPort 9051/' /etc/tor/torrc
sudo sed -i 's/#CookieAuthentication 1/CookieAuthentication 0/' /etc/tor/torrc
sudo /etc/init.d/tor restart
printf "\n\n****** Current IP******"
curl ifconfig.me
printf "\n\n****** Tor IP ******"
# torify curl ifconfig.me 2>/dev/null
torify curl checkip.amazonaws.com
echo "Press any key to continue..."
read -n 1 -s
printf "\n"
printf "\n\n
#############################################################################
# MULLVAD
#############################################################################
\n\n"
sudo torify curl -fsSLo /usr/share/keyrings/mullvad-keyring.asc https://repository.mullvad.net/deb/mullvad-keyring.asc;
printf "deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=$( dpkg --print-architecture )] https://repository.mullvad.net/deb/stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/mullvad.list;
sudo apt update;
sudo apt install mullvad-vpn;
mullvad account login 6627506529903776;
mullvad lockdown-mode set on;
mullvad relay set location ch;
mullvad connect;
while true; do
# Run the command
mullvad status;
# Ask for confirmation to run it again
read -p "Run again? It may take a couple tries (y/n) " answer
# Check the answer and break the loop if it's not "y"
case $answer in
y|Y) continue ;;
n|N) break ;;
*) echo "Invalid input. Please enter y or n." ;;
esac
done
printf "\n\n
#############################################################################
# NAK - Nostr Army Knife
#############################################################################
\n\n"
# Detect architecture for NAK
if [ "$ARCH" = "amd64" ]; then
NAK_ARCH="amd64"
elif [ "$ARCH" = "arm64" ]; then
NAK_ARCH="arm64"
else
NAK_ARCH="amd64" # fallback
fi
NAK_URL=$(curl -s https://api.github.com/repos/fiatjaf/nak/releases/latest \
| grep "browser_download_url" \
| grep "linux-${NAK_ARCH}" \
| cut -d'"' -f4)
echo "Found NAK URL: $NAK_URL"
sudo curl -s -L $NAK_URL -o /usr/local/bin/nak
sudo chmod +x /usr/local/bin/nak
echo "NAK deployed. Thank you FiatJaf!"
printf "\n\n
#############################################################################
# DOCKER - NGINX - STRFRY - BLOSSOM
#############################################################################
\n\n"
#!/bin/bash
# Docker Compose Installation and Nginx Setup Script for Debian
set -e
echo "Starting Docker Compose installation and Nginx setup..."
# Install prerequisites
echo "Installing prerequisites..."
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
# Add Docker's official GPG key
echo "Adding Docker's GPG key..."
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker repository
echo "Adding Docker repository..."
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update package index again
echo "Updating package index with Docker repository..."
sudo apt update
# Install Docker Engine
echo "Installing Docker Engine..."
sudo apt install -y docker-ce docker-ce-cli containerd.io
# Start and enable Docker service
echo "Starting Docker service..."
sudo systemctl start docker
sudo systemctl enable docker
# Add current user to docker group (optional, requires logout/login to take effect)
echo "Adding current user to docker group..."
sudo usermod -aG docker $USER
# Install Docker Compose
echo "Installing Docker Compose..."
DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')
sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Verify Docker Compose installation
echo "Verifying Docker Compose installation..."
docker-compose --version
# Create Docker directory structure
echo "Creating Docker directory structure..."
mkdir -p Docker
cd Docker
# Create subdirectories
mkdir -p strfry/data blossom/data conf.d WWW
# Create docker-compose.yml
echo "Creating docker-compose.yml..."
cat > docker-compose.yml << EOF
version: '3.8'
services:
nginx:
image: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./conf.d:/etc/nginx/conf.d:ro
- ./WWW:/var/www/html:ro
- /etc/letsencrypt:/etc/letsencrypt:ro
restart: unless-stopped
networks:
- web
depends_on:
- strfry
- blossom
strfry:
image: dockurr/strfry
container_name: strfry
ports:
- "7777:7777" # Internal port for nginx proxy
volumes:
- ./strfry/data:/app/strfry-db
- ./strfry/strfry.conf:/etc/strfry.conf
restart: always
stop_grace_period: 2m
networks:
- web
blossom:
image: ghcr.io/hzrd149/blossom-server:master
container_name: blossom
ports:
- "3000:3000" # Internal port for nginx proxy
volumes:
- ./blossom/data:/app/data
- ./blossom/config.yml:/app/config.yml
restart: always
networks:
- web
networks:
web:
driver: bridge
EOF
# Create nginx main configuration
echo "Creating nginx.conf..."
cat > nginx.conf << EOF
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '
'\$status \$body_bytes_sent "\$http_referer" '
'"\$http_user_agent" "\$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}
EOF
# Create nginx site configuration
echo "Creating nginx site configuration..."
cat > conf.d/default.conf << EOF
server {
listen 80;
server_name localhost;
# Main website
location / {
root /var/www/html;
index index.html index.htm;
try_files \$uri \$uri/ =404;
}
# Strfry Nostr relay proxy
location /strfry {
rewrite ^/strfry(.*) \$1 break;
proxy_pass http://strfry:7777;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade;
proxy_read_timeout 86400;
}
# Blossom blob storage proxy
location /blossom {
rewrite ^/blossom(.*) \$1 break;
proxy_pass http://blossom:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade;
client_max_body_size 100M;
}
}
EOF
# Create strfry configuration
echo "Creating strfry configuration..."
cat > strfry/strfry.conf << EOF
##
## Default strfry config
##
# Directory that contains the strfry LMDB database (restart required)
db = "./strfry-db/"
dbParams {
# Maximum number of threads/processes that can simultaneously have LMDB transactions open (restart required)
maxreaders = 256
# Size of mmap() to use when loading LMDB (restart required)
mapsize = 512MB
}
relay {
# Interface to listen on. Use 0.0.0.0 to listen on all interfaces (restart required)
bind = "0.0.0.0"
# Port to open for the nostr websocket protocol (restart required)
port = 7777
# Set OS-limit on maximum number of open files/sockets (if 0, don't attempt to set) (restart required)
nofiles = 1000000
# HTTP header that contains the client's real IP, before reverse proxying (ie x-real-ip) (MUST be all lower-case)
realIpHeader = "x-real-ip"
info {
# NIP-11: Name of this server. Short/descriptive (< 30 characters)
name = "strfry default"
# NIP-11: Detailed plain-text description of relay
description = "This is a strfry instance."
# NIP-11: Administrative nostr pubkey, for contact purposes
pubkey = ""
# NIP-11: Alternative administrative contact (email, website, etc)
contact = ""
}
# Maximum accepted incoming websocket frame size (should be larger than max event and yesstr msg size)
maxWebsocketPayloadSize = 131072
# Websocket-level PING message frequency (should be less than any reverse proxy idle timeouts)
autoPingSeconds = 55
# If TCP keep-alive should be enabled (detect dropped connections to upstream reverse proxy)
enableTcpKeepalive = false
# How much uninterrupted CPU time a REQ query should get during its DB scan
queryTimesliceBudgetMicroseconds = 10000
# Maximum records that can be returned per filter
maxFilterLimit = 500
# Maximum number of subscriptions (concurrent REQs) a connection can have open at any time
maxSubsPerConnection = 20
writePolicy {
# If non-empty, path to an executable script that implements the writePolicy plugin logic
plugin = ""
}
compression {
# Use permessage-deflate compression if supported by client. Reduces bandwidth, but uses more CPU (restart required)
enabled = true
# Maintain a sliding window buffer for each connection. Improves compression, but uses more memory (restart required)
slidingWindow = true
}
logging {
# Dump all incoming messages
dumpInAll = false
# Dump all incoming EVENT messages
dumpInEvents = false
# Dump all incoming REQ/CLOSE messages
dumpInReqs = false
# Log performance metrics for initial REQ database scans
dbScanPerf = false
}
numThreads {
# Ingester threads: route incoming requests, validate events/sigs (restart required)
ingester = 3
# reqWorker threads: Handle initial DB scan for REQ queries (restart required)
reqWorker = 3
# reqMonitor threads: Handle filtering of new events (restart required)
reqMonitor = 3
# yesstr threads: Experimental yesstr protocol (restart required)
yesstr = 1
}
}
EOF
# Create blossom configuration
echo "Creating blossom configuration..."
cat > blossom/config.yml << EOF
# Blossom Server Configuration
# Server settings
server:
port: 3000
host: "0.0.0.0"
# Storage settings
storage:
# Directory to store uploaded files
directory: "/app/data"
# Maximum file size in bytes (100MB)
maxFileSize: 104857600
# Allowed file types (empty array allows all types)
allowedTypes: []
# Enable file deduplication
deduplicate: true
# Authentication settings (optional)
auth:
# Require authentication for uploads
required: false
# Admin public keys (if auth is enabled)
adminKeys: []
# Rate limiting
rateLimit:
# Enable rate limiting
enabled: true
# Requests per minute per IP
requestsPerMinute: 100
# Upload requests per minute per IP
uploadsPerMinute: 10
# Logging
logging:
# Log level: debug, info, warn, error
level: "info"
# Enable access logs
accessLogs: true
# CORS settings
cors:
# Enable CORS
enabled: true
# Allowed origins (* for all)
origins: ["*"]
# Allowed methods
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
# Allowed headers
headers: ["Content-Type", "Authorization"]
# Cleanup settings
cleanup:
# Enable automatic cleanup of old files
enabled: false
# Maximum age of files in days
maxAge: 30
# Cleanup interval in hours
interval: 24
EOF
# Create sample HTML content
echo "Creating sample HTML content..."
cat > WWW/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>Nostr Services - Docker Setup</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
background-color: #f5f5f5;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 { color: #333; }
.service {
margin: 20px 0;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #f9f9f9;
}
.service h3 { margin-top: 0; color: #555; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="container">
<h1>Nostr Services - Docker Setup</h1>
<p>Your Nostr infrastructure is running successfully!</p>
<div class="service">
<h3>🔗 Strfry Nostr Relay</h3>
<p>Nostr relay for storing and retrieving events</p>
<p><strong>Endpoint:</strong> <a href="/strfry" target="_blank">ws://localhost/strfry</a></p>
</div>
<div class="service">
<h3>🌸 Blossom Blob Storage</h3>
<p>Decentralized blob storage for media files</p>
<p><strong>Endpoint:</strong> <a href="/blossom" target="_blank">http://localhost/blossom</a></p>
</div>
<div style="margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee;">
<p><em>Services are proxied through Nginx and running in Docker containers</em></p>
</div>
</div>
</body>
</html>
EOF
# Start services using Docker Compose
echo "Starting Docker services..."
sudo docker-compose up -d
# Go back to original directory
cd ..
# Show running containers
echo "Docker containers status:"
sudo docker ps
echo ""
echo "Installation and setup completed!"
echo ""
echo "Docker directory structure created with:"
echo "- Strfry Nostr relay configuration and data directory"
echo "- Blossom blob storage configuration and data directory"
echo "- Nginx reverse proxy configuration"
echo "- Sample website content"
echo ""
echo "Services are now running and accessible at:"
echo "- Main site: http://localhost"
echo "- Strfry relay: ws://localhost/strfry"
echo "- Blossom storage: http://localhost/blossom"
echo "- External IP: http://$(hostname -I | awk '{print $1}')"
echo ""
echo "Docker management commands (run from Docker/ directory):"
echo "- Stop services: cd Docker && sudo docker-compose down"
echo "- View logs: cd Docker && sudo docker-compose logs [service_name]"
echo "- Restart services: cd Docker && sudo docker-compose restart"
echo "- View status: sudo docker ps"
echo ""
echo "Note: You may need to logout and login again for docker group permissions to take effect."
printf "\n\n
#############################################################################
# CLEAR COMMAND LINE HISTORY
#############################################################################
\n\n"
history -c
# sudo -u root gnome-terminal --working-directory=/root & exit

BIN
nak Normal file

Binary file not shown.

9
nginx.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
mkdir ~/Nginx;
ln -s /var/www/ ~/Nginx/www
ln -s /etc/nginx/nginx.conf ~/Nginx/nginx.conf
ln -s /etc/nginx/sites-available ~/Nginx/sites-available
ln -s /etc/nginx/sites-enabled ~/Nginx/sites-enabled
mkdir ~/Strfry;

200
root.sh Executable file
View File

@@ -0,0 +1,200 @@
#!/bin/bash
# To download and execute
# curl -s https://corpum.com/root.sh | bash
# To set up larger font on system
# dpkg-reconfigure console-setup
#CHANGE HOSTNAME
#EDIT /etc/hostname
#EDIT /etc/hosts
# or
hostnamectl set-hostname nostr;
#CREATE MY DIRECTORIES
mkdir /root/Downloads;
mkdir /root/Applications;
mkdir /root/Temp;
mkdir /root/Trash;
#UPDATE THE SYTEM
apt update -y;
# apt upgrade -y;
#GENERAL TOOLS
apt install htop -y
apt install ranger -y
apt install sshfs -y
apt install curl -y
apt install vim -y
apt install secure-delete -y
apt install jq -y
apt install wget -y
# apt-get install syncthing -y
add-apt-repository ppa:arduino-team/arduino-stable
apt update
apt install arduino -y
apt install font-manager -y
apt install -y docker.io
systemctl start docker
apt install moreutils -y;
#NODE
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
# nvm install node
#FUN
apt install cmatrix -y
#############################################################################
# ALIAI
#############################################################################
# BASIC COMMANDS
#############################################################################
echo "alias ll='ls -l'" >> ~/.bashrc
echo "alias la='ls -a'" >> ~/.bashrc
echo "alias lla='ls -al'" >> ~/.bashrc
echo "alias l='ls -CF'" >> ~/.bashrc
echo "alias ss='gnome-screenshot -a'" >> ~/.bashrc
echo "alias untargz='tar -xzf'" >> ~/.bashrc
# (DE)COMPRESSION
#############################################################################
echo "alias un.tar.bz2='tar xvjf'" >> ~/.bashrc
echo "alias un.tar.gz='tar -xzf'" >> ~/.bashrc
echo "alias un.gz=gunzip" >> ~/.bashrc
# FINAL
#############################################################################
echo "Run 'source .bashrc' to load aliai."
# BACKGROUND COLOR
#############################################################################
gsettings set org.gnome.desktop.background picture-options 'none'
gsettings set org.gnome.desktop.background primary-color '#000000'
printf "
#############################################################################
# TOR
#############################################################################
"
# apt update;
apt install -y tor;
apt install -y apt-transport-tor;
sed -i 's/#ControlPort 9051/ControlPort 9051/' /etc/tor/torrc
sed -i 's/#CookieAuthentication 1/CookieAuthentication 0/' /etc/tor/torrc
/etc/init.d/tor restart
printf "\n\n****** Current IP******"
curl ifconfig.me
printf "\n\n****** Tor IP ******"
# torify curl ifconfig.me 2>/dev/null
torify curl checkip.amazonaws.com
echo "Press any key to continue..."
read -n 1 -s
printf "\n
#############################################################################
# MULLVAD
#############################################################################
\n
"
#torify wget http://o54hon2e2vj6c7m3aqqu6uyece65by3vgoxxhlqlsvkmacw6a7m7kiad.onion/en/download/app/deb/latest
torify curl -fsSLo /usr/share/keyrings/mullvad-keyring.asc https://repository.mullvad.net/deb/mullvad-keyring.asc;
printf "deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=$( dpkg --print-architecture )] https://repository.mullvad.net/deb/stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/mullvad.list;
apt update;
apt install mullvad-vpn;
mullvad account login 6627506529903776;
mullvad lockdown-mode set on;
mullvad relay set location ch;
mullvad connect;
while true; do
# Run the command
mullvad status;
# Ask for confirmation to run it again
read -p "Run again? (y/n) " answer
# Check the answer and break the loop if it's not "y"
case $answer in
y|Y) continue ;;
n|N) break ;;
*) echo "Invalid input. Please enter y or n." ;;
esac
done
# echo "Press any key to continue..."
# read -n 1 -s
printf "\n
#############################################################################
# NOSTR
#############################################################################
"
# Nostr Army Knife (NAK)
curl -L -o /usr/local/bin/nak https://github.com/fiatjaf/nak/releases/download/v0.11.3/nak-v0.11.3-linux-amd64
chmod +x /usr/local/bin/nak
# Stirfry Nostr Relay
# sudo apt install -y git g++ make libssl-dev zlib1g-dev liblmdb-dev libflatbuffers-dev libsecp256k1-dev libzstd-dev
# cd /usr/local/bin
# git clone https://github.com/hoytech/strfry && cd strfry/
# git submodule update --init
# make setup-golpe
# make -j4
# Nostr Alai
timestamp=$(date +%s); nak req -s $timestamp -k 1 --stream $nak_relays_read | jq -r '"\n\(.pubkey[-5:])\n \(.content)\n"'
echo "alias un.gz=gunzip" >> ~/.bashrc
alias nostr_all='timestamp=$(date +%s); nak req -s $timestamp -k 1 --stream $nak_relays_read | jq -r '\''"\n\(.pubkey[-5:])\n \(.content)\n"'\'''
echo "alias nostr_all='timestamp=\$(date +%s); nak req -s \$timestamp -k 1 --stream \$nak_relays_read | jq -r '\''\"\n\(.pubkey[-5:])\n \(.content)\n\"'\''" >> ~/.bashrc
# Nostr terminal
curl -L -o /usr/local/bin/nt https://corpum.com/nt
chmod +x /usr/local/bin/nt
printf "
#############################################################################
# CLEAR COMMAND LINE HISTORY
#############################################################################
"
history -c

281
set_web_permissions.sh Normal file
View File

@@ -0,0 +1,281 @@
#!/bin/bash
# Web Directory Permission Setup Script
# Sets proper ownership and permissions for web directories
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Default web directory - current working directory
DEFAULT_DIR="$(pwd)"
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Function to show usage
show_usage() {
echo "Usage: $0 [directory_path]"
echo " $0 -h|--help"
echo ""
echo "Sets proper permissions for web directories:"
echo " - Directories: 755 (rwxr-xr-x)"
echo " - Files: 644 (rw-r--r--)"
echo " - Ownership: www-data:www-data"
echo " - Sets group sticky bit on directories"
echo ""
echo "Arguments:"
echo " directory_path Path to web directory (default: current directory)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 # Use current directory and all subdirectories"
echo " $0 /var/www/mysite # Use custom directory"
echo " $0 . # Explicitly use current directory"
echo " $0 .. # Use parent directory"
}
# Function to check if user has sudo privileges
check_sudo() {
if ! sudo -n true 2>/dev/null; then
print_error "This script requires sudo privileges. Please run with sudo or ensure you have sudo access."
exit 1
fi
}
# Function to validate directory
validate_directory() {
local dir="$1"
# Convert to absolute path
dir=$(realpath "$dir" 2>/dev/null)
if [[ ! -d "$dir" ]]; then
print_error "Directory '$dir' does not exist."
read -p "Do you want to create it? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
if sudo mkdir -p "$dir"; then
print_success "Created directory '$dir'"
else
print_error "Failed to create directory '$dir'"
exit 1
fi
else
print_error "Aborting - directory does not exist."
exit 1
fi
fi
echo "$dir"
}
# Function to check if www-data user/group exists
check_www_data() {
if ! getent passwd www-data >/dev/null 2>&1; then
print_error "User 'www-data' does not exist on this system."
print_warning "This might not be a web server or you might need a different user."
read -p "Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
if ! getent group www-data >/dev/null 2>&1; then
print_error "Group 'www-data' does not exist on this system."
exit 1
fi
}
# Function to show directory info
show_directory_info() {
local target_dir="$1"
print_status "Target directory: $target_dir"
print_status "Absolute path: $(realpath "$target_dir")"
# Count files and directories for progress
local dir_count=$(find "$target_dir" -type d | wc -l)
local file_count=$(find "$target_dir" -type f | wc -l)
local total_items=$((dir_count + file_count))
echo " - Directories: $dir_count"
echo " - Files: $file_count"
echo " - Total items: $total_items"
# Show current permissions of the root directory
print_status "Current permissions of root directory:"
ls -ld "$target_dir"
}
# Main function to set permissions
set_permissions() {
local target_dir="$1"
print_status "Starting permission setup for current directory and all subdirectories..."
# Set ownership recursively
print_status "Setting ownership to www-data:www-data..."
if sudo chown -R www-data:www-data "$target_dir"; then
print_success "Ownership set successfully"
else
print_error "Failed to set ownership"
exit 1
fi
# Set directory permissions (755) and enable group sticky bit
print_status "Setting directory permissions to 2755 with group sticky bit..."
if sudo find "$target_dir" -type d -exec chmod 2755 {} \;; then
print_success "Directory permissions set successfully"
else
print_error "Failed to set directory permissions"
exit 1
fi
# Set file permissions (644)
print_status "Setting file permissions to 644..."
if sudo find "$target_dir" -type f -exec chmod 644 {} \;; then
print_success "File permissions set successfully"
else
print_error "Failed to set file permissions"
exit 1
fi
# Make shell scripts executable if any exist
local script_count=$(find "$target_dir" -name "*.sh" -type f | wc -l)
if [[ $script_count -gt 0 ]]; then
print_status "Found $script_count shell scripts, making them executable..."
sudo find "$target_dir" -name "*.sh" -type f -exec chmod 755 {} \;
print_success "Shell scripts made executable"
fi
# Make other executable files executable (Python scripts, etc.)
local py_count=$(find "$target_dir" -name "*.py" -type f | wc -l)
if [[ $py_count -gt 0 ]]; then
print_status "Found $py_count Python scripts, checking for executable ones..."
# Only make Python files executable if they have shebang
sudo find "$target_dir" -name "*.py" -type f -exec sh -c 'head -1 "$1" | grep -q "^#!" && chmod 755 "$1"' _ {} \;
fi
# Set special permissions for common web files
if [[ -f "$target_dir/.htaccess" ]]; then
print_status "Setting .htaccess permissions..."
sudo chmod 644 "$target_dir/.htaccess"
fi
# Handle any .git directories (make them less accessible)
local git_dirs=$(find "$target_dir" -name ".git" -type d | wc -l)
if [[ $git_dirs -gt 0 ]]; then
print_status "Found $git_dirs .git directories, setting restricted permissions..."
sudo find "$target_dir" -name ".git" -type d -exec chmod 750 {} \;
fi
print_success "All permissions set successfully!"
}
# Function to show summary
show_summary() {
local target_dir="$1"
echo ""
print_status "Permission Summary for: $target_dir"
echo "========================================="
echo "Ownership: www-data:www-data (all files and directories)"
echo "Directories: 2755 (rwxr-sr-x) with group sticky bit"
echo "Files: 644 (rw-r--r--)"
echo "Shell scripts (*.sh): 755 (rwxr-xr-x)"
echo "Python scripts with shebang: 755 (rwxr-xr-x)"
echo ".git directories: 750 (rwxr-x---)"
echo ""
# Show some example permissions
print_status "Sample of current permissions:"
echo "Root directory:"
sudo ls -ld "$target_dir"
echo ""
echo "Contents (first 10 items):"
sudo ls -la "$target_dir" | head -11
# Show subdirectory count
local subdir_count=$(find "$target_dir" -mindepth 1 -type d | wc -l)
if [[ $subdir_count -gt 0 ]]; then
echo ""
print_status "Also processed $subdir_count subdirectories recursively"
fi
}
# Main script execution
main() {
local target_dir="$DEFAULT_DIR"
# Parse command line arguments
case "${1:-}" in
-h|--help)
show_usage
exit 0
;;
"")
target_dir="$DEFAULT_DIR"
;;
*)
target_dir="$1"
;;
esac
# Validate inputs and prerequisites
check_sudo
target_dir=$(validate_directory "$target_dir")
check_www_data
# Show directory information
echo ""
show_directory_info "$target_dir"
# Confirm action
echo ""
print_warning "WARNING: This will recursively change ownership and permissions for:"
print_warning " Directory: $target_dir"
print_warning " ALL subdirectories and files within it"
print_warning " Ownership will change to: www-data:www-data"
print_warning " Directory permissions: 2755 (with group sticky bit)"
print_warning " File permissions: 644"
echo ""
read -p "Are you sure you want to continue? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
print_status "Operation cancelled by user."
exit 0
fi
# Execute permission changes
set_permissions "$target_dir"
show_summary "$target_dir"
echo ""
print_success "Web directory permissions have been set successfully!"
print_status "You can now copy files to this directory as a member of www-data group."
print_status "New files will automatically inherit the www-data group due to sticky bit."
}
# Run main function with all arguments
main "$@"

168
strfry.sh Normal file
View File

@@ -0,0 +1,168 @@
[Unit]
Description=strfry service
After=network.target
[Service]
Type=simple
User=user
WorkingDirectory=/media/teknari/Storage/Strfry
ExecStart=/media/user/Storage/Strfry/strfry --config=./strfry.conf relay
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
##
## Default strfry config
##
# Directory that contains the strfry LMDB database (restart required)
db = "./strfry-db/"
dbParams {
# Maximum number of threads/processes that can simultaneously have LMDB transactions open (restart required)
maxreaders = 256
# Size of mmap() to use when loading LMDB (default is 10TB, does *not* correspond to disk-space used) (restart required)
mapsize = 10995116277760
# Disables read-ahead when accessing the LMDB mapping. Reduces IO activity when DB size is larger than RAM. (restart required)
noReadAhead = false
}
events {
# Maximum size of normalised JSON, in bytes
maxEventSize = 65536
# Events newer than this will be rejected
rejectEventsNewerThanSeconds = 900
# Events older than this will be rejected
rejectEventsOlderThanSeconds = 94608000
# Ephemeral events older than this will be rejected
rejectEphemeralEventsOlderThanSeconds = 60
# Ephemeral events will be deleted from the DB when older than this
ephemeralEventsLifetimeSeconds = 300
# Maximum number of tags allowed
maxNumTags = 2000
# Maximum size for tag values, in bytes
maxTagValSize = 1024
}
relay {
# Interface to listen on. Use 0.0.0.0 to listen on all interfaces (restart required)
bind = "127.0.0.1"
# Port to open for the nostr websocket protocol (restart required)
port = 7776
# Set OS-limit on maximum number of open files/sockets (if 0, don't attempt to set) (restart required)
nofiles = 524288
# HTTP header that contains the client's real IP, before reverse proxying (ie x-real-ip) (MUST be all lower-case)
realIpHeader = ""
info {
# NIP-11: Name of this server. Short/descriptive (< 30 characters)
name = "Laan Tungir"
# NIP-11: Detailed information about relay, free-form
description = "This is a strfry instance."
# NIP-11: Administrative nostr pubkey, for contact purposes
pubkey = "1ec454734dcbf6fe54901ce25c0c7c6bca5edd89443416761fadc321d38df139"
# NIP-11: Alternative administrative contact (email, website, etc)
contact = ""
# NIP-11: URL pointing to an image to be used as an icon for the relay
icon = ""
# List of supported lists as JSON array, or empty string to use default. Example: "[1,2]"
nips = ""
}
# Maximum accepted incoming websocket frame size (should be larger than max event) (restart required)
maxWebsocketPayloadSize = 131072
# Maximum number of filters allowed in a REQ
maxReqFilterSize = 200
# Websocket-level PING message frequency (should be less than any reverse proxy idle timeouts) (restart required)
autoPingSeconds = 55
# If TCP keep-alive should be enabled (detect dropped connections to upstream reverse proxy)
enableTcpKeepalive = false
# How much uninterrupted CPU time a REQ query should get during its DB scan
queryTimesliceBudgetMicroseconds = 10000
# Maximum records that can be returned per filter
maxFilterLimit = 500
# Maximum number of subscriptions (concurrent REQs) a connection can have open at any time
maxSubsPerConnection = 20
writePolicy {
# If non-empty, path to an executable script that implements the writePolicy plugin logic
plugin = ""
}
compression {
# Use permessage-deflate compression if supported by client. Reduces bandwidth, but slight increase in CPU (restart required)
enabled = true
# Maintain a sliding window buffer for each connection. Improves compression, but uses more memory (restart required)
slidingWindow = true
}
logging {
# Dump all incoming messages
dumpInAll = false
# Dump all incoming EVENT messages
dumpInEvents = false
# Dump all incoming REQ/CLOSE messages
dumpInReqs = false
# Log performance metrics for initial REQ database scans
dbScanPerf = false
# Log reason for invalid event rejection? Can be disabled to silence excessive logging
invalidEvents = true
}
numThreads {
# Ingester threads: route incoming requests, validate events/sigs (restart required)
ingester = 3
# reqWorker threads: Handle initial DB scan for events (restart required)
reqWorker = 3
# reqMonitor threads: Handle filtering of new events (restart required)
reqMonitor = 3
# negentropy threads: Handle negentropy protocol messages (restart required)
negentropy = 2
}
negentropy {
# Support negentropy protocol messages
enabled = true
# Maximum records that sync will process before returning an error
maxSyncEvents = 1000000
}
}

1
test.sh Executable file
View File

@@ -0,0 +1 @@
5b968086-503c-43b9-9df0-2ca7efc4614c

0
tutorial2/.build/config Normal file
View File

119
tutorial2/config/binary Normal file
View File

@@ -0,0 +1,119 @@
# config/binary - options for live-build(7), binary stage
# Set image type
LB_IMAGE_TYPE="iso-hybrid"
# Set image filesystem
LB_BINARY_FILESYSTEM="fat32"
# Set apt/aptitude generic indices
LB_APT_INDICES="true"
# Set boot parameters
LB_BOOTAPPEND_LIVE="boot=live components quiet splash"
# Set boot parameters
LB_BOOTAPPEND_INSTALL=""
# Set boot parameters
LB_BOOTAPPEND_LIVE_FAILSAFE="boot=live components memtest noapic noapm nodma nomce nosmp nosplash vga=788"
# Set BIOS bootloader
LB_BOOTLOADER_BIOS="syslinux"
# Set EFI bootloader
LB_BOOTLOADER_EFI="grub-efi"
# Set bootloaders
LB_BOOTLOADERS=""
# Set checksums
LB_CHECKSUMS="sha256"
# Set compression
LB_COMPRESSION="none"
# Support dm-verity on rootfs
LB_DM_VERITY=""
# Support FEC on dm-verity rootfs
LB_DM_VERITY_FEC_ROOTS=""
# Set sign script for roothash for dm-verity rootfs
LB_DM_VERITY_SIGN=""
# Set zsync
LB_ZSYNC="false"
# Control if we build binary images chrooted
# NEVER, *EVER*, *E*V*E*R* SET THIS OPTION to false.
LB_BUILD_WITH_CHROOT="true"
# Set debian-installer
LB_DEBIAN_INSTALLER="none"
# Set debian-installer suite
LB_DEBIAN_INSTALLER_DISTRIBUTION="stable"
# Set debian-installer preseed filename/url
LB_DEBIAN_INSTALLER_PRESEEDFILE=""
# Toggle use of GUI debian-installer
LB_DEBIAN_INSTALLER_GUI="true"
# Set hdd label
LB_HDD_LABEL="DEBIAN_LIVE"
# Set hdd filesystem size
LB_HDD_SIZE="auto"
# Set start of partition for the hdd target for BIOSes that expect a specific boot partition start (e.g. "63s"). If empty, use optimal layout.
LB_HDD_PARTITION_START=""
# Set iso author
LB_ISO_APPLICATION="Debian Live"
# Set iso preparer
LB_ISO_PREPARER="live-build @LB_VERSION@; https://salsa.debian.org/live-team/live-build"
# Set iso publisher
LB_ISO_PUBLISHER="Debian Live project; https://wiki.debian.org/DebianLive; debian-live@lists.debian.org"
# Set iso volume (max 32 chars)
LB_ISO_VOLUME="Debian stable @ISOVOLUME_TS@"
# Set jffs2 eraseblock size
LB_JFFS2_ERASEBLOCK=""
# Set memtest
LB_MEMTEST="none"
# Set loadlin
LB_LOADLIN="false"
# Set win32-loader
LB_WIN32_LOADER="false"
# Set net tarball
LB_NET_TARBALL="true"
# Set onie
LB_ONIE="false"
# Set onie additional kernel cmdline options
LB_ONIE_KERNEL_CMDLINE=""
# Set inclusion of firmware packages in debian-installer
LB_FIRMWARE_BINARY="true"
# Set inclusion of firmware packages in the live image
LB_FIRMWARE_CHROOT="true"
# Set swap file path
LB_SWAP_FILE_PATH=""
# Set swap file size
LB_SWAP_FILE_SIZE="512"
# Enable/disable UEFI secure boot support
LB_UEFI_SECURE_BOOT="auto"

View File

@@ -0,0 +1,76 @@
# config/bootstrap - options for live-build(7), bootstrap stage
# Select architecture to use
LB_ARCHITECTURE="amd64"
# Select distribution to use
LB_DISTRIBUTION="stable"
# Select parent distribution to use
LB_PARENT_DISTRIBUTION=""
# Select distribution to use in the chroot
LB_DISTRIBUTION_CHROOT="stable"
# Select parent distribution to use in the chroot
LB_PARENT_DISTRIBUTION_CHROOT="stable"
# Select distribution to use in the final image
LB_DISTRIBUTION_BINARY="stable"
# Select parent distribution to use in the final image
LB_PARENT_DISTRIBUTION_BINARY="stable"
# Select parent distribution for debian-installer to use
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION=""
# Select archive areas to use
LB_ARCHIVE_AREAS="main"
# Select parent archive areas to use
LB_PARENT_ARCHIVE_AREAS="main"
# Set parent mirror to bootstrap from
LB_PARENT_MIRROR_BOOTSTRAP="http://deb.debian.org/debian/"
# Set parent mirror to fetch packages from
LB_PARENT_MIRROR_CHROOT="http://deb.debian.org/debian/"
# Set security parent mirror to fetch packages from
LB_PARENT_MIRROR_CHROOT_SECURITY="http://security.debian.org/"
# Set parent mirror which ends up in the image
LB_PARENT_MIRROR_BINARY="http://deb.debian.org/debian/"
# Set security parent mirror which ends up in the image
LB_PARENT_MIRROR_BINARY_SECURITY="http://security.debian.org/"
# Set debian-installer parent mirror
LB_PARENT_MIRROR_DEBIAN_INSTALLER="http://deb.debian.org/debian/"
# Set mirror to bootstrap from
LB_MIRROR_BOOTSTRAP="http://deb.debian.org/debian/"
# Set mirror to fetch packages from
LB_MIRROR_CHROOT="http://deb.debian.org/debian/"
# Set security mirror to fetch packages from
LB_MIRROR_CHROOT_SECURITY="http://security.debian.org/"
# Set mirror which ends up in the image
LB_MIRROR_BINARY="http://deb.debian.org/debian/"
# Set security mirror which ends up in the image
LB_MIRROR_BINARY_SECURITY="http://security.debian.org/"
# Set debian-installer mirror
LB_MIRROR_DEBIAN_INSTALLER="http://deb.debian.org/debian/"
# Set architectures to use foreign bootstrap
LB_BOOTSTRAP_QEMU_ARCHITECTURE=""
# Set packages to exclude during foreign bootstrap
LB_BOOTSTRAP_QEMU_EXCLUDE=""
# Set static qemu binary for foreign bootstrap
LB_BOOTSTRAP_QEMU_STATIC=""

37
tutorial2/config/chroot Normal file
View File

@@ -0,0 +1,37 @@
# config/chroot - options for live-build(7), chroot stage
# Set chroot filesystem
LB_CHROOT_FILESYSTEM="squashfs"
# Set chroot squashfs compression level
LB_CHROOT_SQUASHFS_COMPRESSION_LEVEL=""
# Set chroot squashfs compression type
LB_CHROOT_SQUASHFS_COMPRESSION_TYPE=""
# Set union filesystem
LB_UNION_FILESYSTEM="overlay"
# Set interactive build
LB_INTERACTIVE="false"
# Set keyring packages
LB_KEYRING_PACKAGES="debian-archive-keyring"
# Set kernel flavour to use (with arch)
LB_LINUX_FLAVOURS_WITH_ARCH="amd64"
# Set kernel packages to use
LB_LINUX_PACKAGES="linux-image"
# Enable security updates
LB_SECURITY="true"
# Enable updates updates
LB_UPDATES="true"
# Enable backports updates
LB_BACKPORTS="false"
# Enable proposed updates
LB_PROPOSED_UPDATES="false"

102
tutorial2/config/common Normal file
View File

@@ -0,0 +1,102 @@
# config/common - common options for live-build(7)
# Version of live-build used to build config (config format version)
LB_CONFIGURATION_VERSION="c2c3f77929987c06946a210509a3231cd4df02ae_2025-08-14T20:24:40+01:00"
# Set package manager
LB_APT="apt"
# Set proxy for HTTP connections
LB_APT_HTTP_PROXY=""
# Set apt/aptitude pipeline depth
LB_APT_PIPELINE=""
# Set apt/aptitude recommends
LB_APT_RECOMMENDS="true"
# Set apt/aptitude security
LB_APT_SECURE="true"
# Set apt/aptitude source entries in sources.list
LB_APT_SOURCE_ARCHIVES="true"
# Control cache
LB_CACHE="true"
# Control if downloaded package indices should be cached
LB_CACHE_INDICES="false"
# Control if downloaded packages files should be cached
LB_CACHE_PACKAGES="true"
# Control if completed stages should be cached
LB_CACHE_STAGES="bootstrap"
# Set debconf(1) frontend to use
LB_DEBCONF_FRONTEND="noninteractive"
# Set debconf(1) priority to use
LB_DEBCONF_PRIORITY="critical"
# Set initramfs hook
LB_INITRAMFS="live-boot"
# Set initramfs compression
LB_INITRAMFS_COMPRESSION="gzip"
# Set init system
LB_INITSYSTEM="systemd"
# Set distribution mode
LB_MODE="debian"
# Set system type
LB_SYSTEM="live"
# Set base name of the image
LB_IMAGE_NAME="live-image"
# Set options to use with apt
APT_OPTIONS="--yes -o Acquire::Retries=5"
# Set options to use with aptitude
APTITUDE_OPTIONS="--assume-yes -o Acquire::Retries=5"
# Set options to use with debootstrap
DEBOOTSTRAP_OPTIONS=""
# Set script to use with debootstrap
DEBOOTSTRAP_SCRIPT=""
# Set options to use with gzip
GZIP_OPTIONS="-6 --rsyncable"
# Enable UTC timestamps
LB_UTC_TIME="false"
# live-build options
# Enable breakpoints
# If set here, overrides the command line option
#_BREAKPOINTS="false"
# Enable debug
# If set here, overrides the command line option
#_DEBUG="false"
# Enable color
# If set here, overrides the command line option
#_COLOR="auto"
# Enable force
# If set here, overrides the command line option
#_FORCE="false"
# Enable quiet
# If set here, overrides the command line option
#_QUIET="false"
# Enable verbose
# If set here, overrides the command line option
#_VERBOSE="false"

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/live/0010-disable-kexec-tools.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/live/0050-disable-sysvinit-tmpfs.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/1000-create-mtab-symlink.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/1010-enable-cryptsetup.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/1020-create-locales-files.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/5000-update-apt-file-cache.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/5010-update-apt-xapian-index.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/5020-update-glx-alternative.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/5030-update-plocate-database.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/5040-update-nvidia-alternative.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/5050-dracut.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8000-remove-adjtime-configuration.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8010-remove-backup-files.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8020-remove-dbus-machine-id.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8030-truncate-log-files.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8040-remove-mdadm-configuration.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8050-remove-openssh-server-host-keys.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8060-remove-systemd-machine-id.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8070-remove-temporary-files.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8080-reproducible-glibc.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8090-remove-ssl-cert-snakeoil.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8100-remove-udev-persistent-cd-rules.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/8110-remove-udev-persistent-net-rules.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/9000-remove-gnome-icon-cache.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/9010-remove-python-pyc.hook.chroot

View File

@@ -0,0 +1 @@
/home/teknari/Sync/Programming/VibeCoding/n_os_tr/live-build/share/hooks/normal/9020-remove-man-cache.hook.chroot

View File

@@ -0,0 +1,4 @@
live-boot
live-config
live-config-systemd
systemd-sysv

7
tutorial2/config/source Normal file
View File

@@ -0,0 +1,7 @@
# config/source - options for live-build(7), source stage
# Set source option
LB_SOURCE="false"
# Set image type
LB_SOURCE_IMAGES="tar"