Dateien hochladen nach „“
This commit is contained in:
144
bullseye
Normal file
144
bullseye
Normal file
@@ -0,0 +1,144 @@
|
||||
#Set repositories
|
||||
echo "deb http://deb.debian.org/debian bullseye contrib non-free" >> /etc/apt/sources.list
|
||||
|
||||
#Update and upgrade base packages
|
||||
apt-get update
|
||||
apt-get -y upgrade
|
||||
|
||||
#Set root password
|
||||
echo "+------------------------+"
|
||||
echo "| Set your root password |"
|
||||
echo "+------------------------+"
|
||||
passwd
|
||||
|
||||
#Add user "debian"
|
||||
useradd -rm debian -s /bin/bash
|
||||
|
||||
#Set password for user "debian"
|
||||
echo "+--------------------------------+"
|
||||
echo "| Set password for user 'debian' |"
|
||||
echo "+--------------------------------+"
|
||||
passwd debian
|
||||
|
||||
#Install basic dependencies
|
||||
apt-get -y install wget curl procps
|
||||
|
||||
#Install noVNC
|
||||
cd /tmp && \
|
||||
wget -O /tmp/novnc.tar.gz https://github.com/novnc/noVNC/archive/v1.2.0.tar.gz && \
|
||||
tar -xvf /tmp/novnc.tar.gz && \
|
||||
cd /tmp/noVNC* && \
|
||||
sed -i 's/credentials: { password: password } });/credentials: { password: password },\n wsProtocols: ["'"binary"'"] });/g' app/ui.js && \
|
||||
mkdir -p /usr/share/novnc && \
|
||||
cp -r app /usr/share/novnc/ && \
|
||||
cp -r core /usr/share/novnc/ && \
|
||||
cp -r utils /usr/share/novnc/ && \
|
||||
cp -r vendor /usr/share/novnc/ && \
|
||||
cp -r vnc.html /usr/share/novnc/ && \
|
||||
cp package.json /usr/share/novnc/ && \
|
||||
cd /usr/share/novnc/ && \
|
||||
chmod -R 755 /usr/share/novnc && \
|
||||
rm -rf /tmp/noVNC* /tmp/novnc.tar.gz
|
||||
|
||||
#Install window manager and dependencies
|
||||
apt-get -y install --no-install-recommends xvfb wmctrl x11vnc websockify fluxbox screen libxcomposite-dev libxcursor1 xauth && \
|
||||
sed -i '/ document.title =/c\ document.title = "DebianBullseye - noVNC";' /usr/share/novnc/app/ui.js
|
||||
|
||||
#Install TurboVNC
|
||||
cd /tmp && \
|
||||
wget -O /tmp/turbovnc.deb https://sourceforge.net/projects/turbovnc/files/2.2.6/turbovnc_2.2.6_amd64.deb/download && \
|
||||
dpkg -i /tmp/turbovnc.deb && \
|
||||
rm -rf /opt/TurboVNC/java /opt/TurboVNC/README.txt && \
|
||||
cp -R /opt/TurboVNC/bin/* /bin/ && \
|
||||
rm -rf /opt/TurboVNC /tmp/turbovnc.deb && \
|
||||
sed -i '/# $enableHTTP = 1;/c\$enableHTTP = 0;' /etc/turbovncserver.conf
|
||||
|
||||
#Install base system for container
|
||||
export TZ=Europe/Rome && \
|
||||
apt-get update && \
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
|
||||
echo $TZ > /etc/timezone && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends man-db hdparm udev whiptail reportbug init \
|
||||
vim-common iproute2 nano gdbm-l10n less iputils-ping netcat-traditional perl bzip2 gettext-base manpages file liblockfile-bin \
|
||||
python3-reportbug libnss-systemd isc-dhcp-common systemd-sysv xz-utils perl-modules debian-faq wamerican bsdmainutils systemd \
|
||||
cpio logrotate traceroute dbus kmod isc-dhcp-client telnet krb5-locales lsof debconf-i18n cron ncurses-term iptables ifupdown \
|
||||
procps rsyslog apt-utils netbase pciutils bash-completion vim-tiny groff-base apt-listchanges bind9-host doc-debian libpam-systemd \
|
||||
openssh-client xfce4 xorg dbus-x11 sudo gvfs-backends gvfs-common gvfs-fuse gvfs firefox-esr at-spi2-core gpg-agent mousepad \
|
||||
xarchiver sylpheed unzip gtk2-engines-pixbuf gnome-themes-standard lxtask xfce4-terminal p7zip unrar curl msttcorefonts \
|
||||
xfce4-screenshooter binutils gedit zip xfce4-taskmanager fonts-vlgothic ffmpeg openssh-server
|
||||
|
||||
#Create directories and set permissions
|
||||
if [ ! -d /tmp/xdg ]; then
|
||||
mkdir /tmp/xdg
|
||||
fi
|
||||
rm -R /home/debian/.dbus/session-bus/* 2> /dev/null
|
||||
if [ ! -d /var/run/dbus ]; then
|
||||
mkdir -p /var/run/dbus
|
||||
fi
|
||||
USER_UID="$(cat /etc/passwd | grep "debian" | cut -d ':' -f3)"
|
||||
USER_GID="$(cat /etc/passwd | grep "debian" | cut -d ':' -f4)"
|
||||
chown -R ${USER_UID}:${USER_GID} /var/run/dbus/
|
||||
chmod -R 770 /var/run/dbus/
|
||||
chown -R ${USER_UID}:${USER_GID} /tmp/xdg
|
||||
chmod -R 0700 /tmp/xdg
|
||||
dbus-uuidgen > /var/lib/dbus/machine-id
|
||||
rm -R /tmp/.* 2> /dev/null
|
||||
mkdir -p /tmp/.ICE-unix
|
||||
chown root:root /tmp/.ICE-unix/
|
||||
chmod 1777 /tmp/.ICE-unix/
|
||||
chown -R ${USER_UID}:${USER_GID} /home/debian
|
||||
chown -R ${USER_UID}:${USER_GID} /tmp/config
|
||||
|
||||
#Create systemd services
|
||||
echo "[Unit]
|
||||
Description=VNC Server
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
ExecStart=Xvnc -geometry 1280x1024 -depth 16 :99 -rfbport 5900 -securitytypes none
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" > /etc/systemd/system/vncserver@debian.service
|
||||
|
||||
echo "[Unit]
|
||||
Description=VNC Server
|
||||
After=vncserver@debian.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
ExecStart=websockify --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 8080 localhost:5900
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" > /etc/systemd/system/novnc@debian.service
|
||||
|
||||
echo "[Unit]
|
||||
Description=XFCE4 session
|
||||
After=novnc@debian.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
Environment="XDG_RUNTIME_DIR=/tmp/xdg"
|
||||
Environment="DISPLAY=:99"
|
||||
ExecStart=startxfce4
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" > /etc/systemd/system/xfce4@debian.service
|
||||
|
||||
#Update, enable and start services
|
||||
systemctl --system daemon-reload
|
||||
systemctl enable vncserver@debian
|
||||
systemctl enable novnc@debian
|
||||
systemctl enable xfce4@debian
|
||||
systemctl start vncserver@debian
|
||||
systemctl start novnc@debian
|
||||
systemctl start xfce4@debian
|
||||
systemctl restart sshd
|
||||
|
||||
#Restart the container once with the command restart
|
||||
|
||||
#Container should now be reachable via noVNC through 'LXCCONTAINERIP:8080/vnc.html' (the VNC port is 5900 if you want to connect
|
||||
#directly with a VNC client) and also via SSH through port 22
|
64
hasscore
Normal file
64
hasscore
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Update and upgrade base packages
|
||||
apt-get update
|
||||
apt-get -y upgrade
|
||||
|
||||
#Set root password
|
||||
echo "+------------------------+"
|
||||
echo "| Set your root password |"
|
||||
echo "+------------------------+"
|
||||
passwd
|
||||
|
||||
#Add user "homeassistant"
|
||||
useradd -rm homeassistant -s /bin/bash
|
||||
|
||||
#Set password for user "homeassistant"
|
||||
echo "+---------------------------------------+"
|
||||
echo "| Set password for user 'homeassistant' |"
|
||||
echo "+---------------------------------------+"
|
||||
passwd homeassistant
|
||||
|
||||
#Install Homeassistant Core
|
||||
apt-get -y install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata
|
||||
mkdir -p /opt/homeassistant
|
||||
chown homeassistant:homeassistant /opt/homeassistant
|
||||
su homeassistant -s /bin/bash -c 'cd /opt/homeassistant; \
|
||||
python3 -m venv .; \
|
||||
source bin/activate; \
|
||||
python3 -m pip install wheel; \
|
||||
pip3 install homeassistant; \
|
||||
echo; \
|
||||
echo "+-----------------------------------------------------"; \
|
||||
echo "| Please connect to HA through IP:8123"; \
|
||||
echo "|"; \
|
||||
echo "| Please note that this is the fist startup and"; \
|
||||
echo "| it can take a while for the site to be reachable!"; \
|
||||
echo "|"; \
|
||||
echo "| Complete the installation wizzard from HomeAssistant"; \
|
||||
echo "| and then press in this window CTRL + C to complete"; \
|
||||
echo "| the installation."; \
|
||||
echo "+-----------------------------------------------------"; \
|
||||
hass 2>/dev/null'
|
||||
|
||||
#Create systemd service
|
||||
echo "[Unit]
|
||||
Description=Home Assistant
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
WorkingDirectory=/home/%i/.homeassistant
|
||||
ExecStart=/opt/homeassistant/bin/hass -c "/home/%i/.homeassistant"
|
||||
RestartForceExitStatus=100
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" > /etc/systemd/system/homeassistant@homeassistant.service
|
||||
|
||||
#Update, enable and start services
|
||||
systemctl --system daemon-reload
|
||||
systemctl enable homeassistant@homeassistant
|
||||
systemctl start homeassistant@homeassistant
|
||||
|
||||
echo "Installation complete, your Hass Core installation is now available at: IP:8123"
|
Reference in New Issue
Block a user