temp-container -> deb

This commit is contained in:
user 2024-11-12 10:02:25 +01:00
parent 5e9fceeeae
commit 3ef2e7be80
2 changed files with 17 additions and 17 deletions

Binary file not shown.

View File

@ -89,10 +89,10 @@ The following are needed to create a custom image:
\section{Creating a Base Container}
The first step is to create a temporary Debian container that will serve as a base:
\begin{lstlisting}[language=bash]
incus launch images:debian/12 temp-container
incus launch images:debian/12 deb
incus profile device remove default eth0
incus network attach incusbr0 temp-container eth0 eth0
incus network attach incusbr0 deb eth0 eth0
\end{lstlisting}
\newpage
@ -147,8 +147,8 @@ incus config device add deb deb-proxy proxy listen=tcp:0.0.0.0:1234 connect=tcp:
\section{Installing Additional Packages}
Next, use the \texttt{exec} command to launch a shell in the container and install the necessary packages:
\begin{lstlisting}[language=bash]
incus exec temp-container -- apt update
incus exec temp-container -- apt install -y \
incus exec deb -- apt update
incus exec deb -- apt install -y \
netplan.io \
sudo vim nano git tmux mc zip unzip curl wget htop lynx\
iproute2 termshark bridge-utils \
@ -162,17 +162,17 @@ After installing the additional packages, it's important to configure user acces
\subsection{Changing the Root Password}
To change the root password to "passroot", execute the following command:
\begin{lstlisting}[language=bash]
echo "root:passroot" | incus exec temp-container -- chpasswd
echo "root:passroot" | incus exec deb -- chpasswd
\end{lstlisting}
\subsection{Adding a New User}
To add a new user named "user" with the password "pass", and to add this user to the "sudo" and "docker" groups, follow these steps:
\begin{lstlisting}[language=bash]
incus exec temp-container -- useradd -m -s /bin/bash user
echo "user:pass" | incus exec temp-container -- chpasswd
incus exec temp-container -- usermod -aG sudo user
incus exec temp-container -- usermod -aG docker user
incus exec deb -- useradd -m -s /bin/bash user
echo "user:pass" | incus exec deb -- chpasswd
incus exec deb -- usermod -aG sudo user
incus exec deb -- usermod -aG docker user
\end{lstlisting}
This series of commands creates a new user with a home directory and bash shell, sets their password, and adds them to the necessary groups for system administration and Docker management.
@ -182,7 +182,7 @@ This series of commands creates a new user with a home directory and bash shell,
To install Vim-Plug, a plugin manager for Vim, inside the `deb` container, execute the following command from your host system:
\begin{lstlisting}[language=bash]
incus exec temp-container -- bash -c "curl -fLo /home/user/.vim/autoload/plug.vim --create-dirs \
incus exec deb -- bash -c "curl -fLo /home/user/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
\end{lstlisting}
@ -192,31 +192,31 @@ Ensure that the specified user directory exists and the user has the necessary p
\noindent
To transfer a file from your host system to a container, use the `incus file push` command. For example, to push `\_confs.zip` to the `deb` container:
\begin{lstlisting}[language=bash]
incus file push _confs.zip temp-container/home/user/_confs.zip
incus file push _confs.zip deb/home/user/_confs.zip
#Folder _confs must to be zipped with -rj option
incus exec temp-container -- bash -c "unzip /home/user/_confs.zip -d /home/user/ && sudo chown -R user:user /home/user/* /home/user/.*"
incus exec deb -- bash -c "unzip /home/user/_confs.zip -d /home/user/ && sudo chown -R user:user /home/user/* /home/user/.*"
\end{lstlisting}
\section{Cleaning the Container}
Before creating the image, clean the system of unnecessary files:
\begin{lstlisting}[language=bash]
incus exec temp-container -- apt clean
incus exec temp-container -- apt autoremove
incus exec deb -- apt clean
incus exec deb -- apt autoremove
\end{lstlisting}
\section{Creating the Image}
After installing all the necessary packages and cleaning the system, create an image from the container:
\begin{lstlisting}[language=bash]
incus stop temp-container
incus publish temp-container --alias my-custom-image-deb
incus stop deb
incus publish deb --alias my-custom-image-deb
\end{lstlisting}
Replace \texttt{my-custom-image} with the chosen name for your image.
\section{Cleanup}
After creating the image, delete the temporary container:
\begin{lstlisting}[language=bash]
incus delete temp-container
incus delete deb
\end{lstlisting}
\section{Using the Image}