最近、LXCで実験環境を作ることが多いけど、いつも忘れるのでメモ。
LXC_NAME=test ## lxc launch ubuntu:22.04 $LXC_NAME lxc config device add $LXC_NAME mytap0 nic nictype=macvlan parent=eth0 lxc shell $LXC_NAME ## in shell ## use apt-caching-proxy echo 'Acquire::HTTP::Proxy "http://apt-cacher.lan";' |sudo tee /etc/apt/apt.conf.d/01proxy ## no-man echo -e "APT::Install-Suggests 0;\nAPT::Install-Recommends 0;" | sudo tee /etc/apt/apt.conf.d/00-no-install-recommends ## amd64のみ(armfは国内ミラーはないので何も起きない。) URL=http://ftp.jaist.ac.jp/pub/Linux/ubuntu/ sudo sed -i "s|http://archive.ubuntu.com/ubuntu/\?|${URL}|" /etc/apt/sources.list ## no doc cat <<EOF > 01-nodoc # Delete locales path-exclude=/usr/share/locale/* # Delete man pages path-exclude=/usr/share/man/* # Delete docs path-exclude=/usr/share/doc/* path-include=/usr/share/doc/*/copyrigh EOF sudo mv 01-nodoc /etc/dpkg/dpkg.cfg.d/01-nodoc sudo apt update sudo apt install vim-nox
npm+nodejs
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\ sudo apt-get install -y nodejs npm
vimrc
cat <<EOF > ~/.vimrc syntax on set modeline set modelines=5 set nocompatible set number set smartindent set shiftwidth=2 set tabstop=2 set expandtab set ignorecase set smarttab set nowrap set ruler set incsearch set history=10000 set mouse=a color slate EOF
コピペで作れるから楽ではあるけど。
ここまでシェルスクリプトで自動化するならDockerでもいい気がする。