Diese Zusatzpakete installieren wir im Basiscontainer:
joe
openssh-server
123456789101112
root@helsinki# lxc exec debian-9 /bin/bash
root@debian-9# apt-get install joe
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
Unpacking joe (4.4-1) ...
Setting up joe (4.4-1) ...
update-alternatives: using /usr/bin/joe to provide /usr/bin/editor (editor) in auto mode
root@debian-9# apt-get install openssh-server
...
root@debian-9# apt-get clean
...
HISTFILESIZE=
HISTSIZE=
HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
HISTFILE=~/.bash_eternal_history
# Force prompt to write history after every command.
# http://superuser.com/questions/20900/bash-history-loss
PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-true}"
# Log last command to syslog
log_command () {
echo "${USER} $(HISTTIMEFORMAT='' builtin history 1|cut -c8-)" | logger -t shell -p user.info
}
PROMPT_COMMAND="${PROMPT_COMMAND:-true};log_command"
/etc/skel/.bashrc und /root/.bashrc und /home/ubuntu/.bashrc
Bislang:
1234
...
HISTSIZE=1000
HISTFILESIZE=2000
...
Neu:
1234
...
#HISTSIZE=1000
#HISTFILESIZE=2000
...
Zeitzone korrigieren
12345
root@debian-9:~# date
Fri Apr 10 16:42:11 UTC 2020
root@debian-9:~# timedatectl set-timezone Europe/Berlin
root@debian-9:~# date
Fri Apr 10 18:43:06 CEST 2020
Apt-Cacher-NG vom LXDHOST aktivieren
/root/bin/apt-proxy.sh
12345678910111213141516
#!/bin/sh
# port of apt-cacher-ng on the lxd host
PORT=3142
APT_PROXY_FILE="/etc/apt/apt.conf.d/01proxy"
LXDHOST=
for h in $(ip addr|grep -o "inet [0-9.]*/"|grep -v 127.0.0.1|grep -o "[0-9.]*"|sed -e "s/[.][0-9]*$/.1/"); do
nc -z "${h}" "${PORT}" && { LXDHOST="${h}"; break; }
done
if [ -n "${LXDHOST}" ]; then
echo >"${APT_PROXY_FILE}" "Acquire::http::Proxy \"http://${LXDHOST}:${PORT}\";"
else
rm -f "${APT_PROXY_FILE}"
fi
/root/systemd/apt-proxy.service
123456789101112
[Unit]
Description=Apt proxy to apt-cacher-ng on lxd host
After=network.target
[Service]
ExecStart=/root/bin/apt-proxy.sh
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Aktivieren
123
root@debian-9:~# systemctl enable /root/systemd/apt-proxy.service
Created symlink /etc/systemd/system/multi-user.target.wants/apt-proxy.service → /root/systemd/apt-proxy.service.
Created symlink /etc/systemd/system/apt-proxy.service → /root/systemd/apt-proxy.service.
Test
1234567891011121314
root@debian-9:~# reboot
...
root@debian-9:~# systemctl status apt-proxy
● apt-proxy.service - Apt proxy to apt-cacher-ng on lxd host
Loaded: loaded (/root/systemd/apt-proxy.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2020-04-11 08:51:37 CEST; 36s ago
Process: 102 ExecStart=/root/bin/apt-proxy.sh (code=exited, status=0/SUCCESS)
Main PID: 102 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/apt-proxy.service
Apr 11 08:51:37 debian-9 systemd[1]: Started Apt proxy to apt-cacher-ng on lxd host.
Apr 11 08:51:37 debian-9 systemd[1]: apt-proxy.service: Failed to reset devices.list: Operation not permitted
Apr 11 08:51:37 debian-9 systemd[1]: apt-proxy.service: Failed to set invocation ID on control group /system.slice/apt-proxy.service, ignoring: Operation not permitted