### Inštalácia Apache a nastavenie index.html pomocou cloud-init
Source: https://www.websupport.sk/podpora/kb/vytvaranie-instancie-vm-vo-vdc
Táto konfigurácia cloud-init nainštaluje webový server Apache 2, povolí predvolený virtuálny host a prepíše obsah súboru index.html na 'Ahoj svet'. Je užitočná pre rýchle nasadenie webového servera.
```cloud-config
#cloud-config
package_upgrade: false
packages:
- apache2
runcmd:
- [ a2ensite, "000-default" ]
- echo "Ahoj svet" > /var/www/html/index.html
```
--------------------------------
### Install and Manage Nginx Service
Source: https://www.websupport.sk/podpora/kb/nginx-apache-na-jednom-ubuntu-18-04-lts-serveri
Commands to install the Nginx package, enable it to start on boot, and restart the service to apply changes.
```bash
apt install nginx -y
systemctl enable nginx.service
/etc/init.d/nginx restart
```
--------------------------------
### Import obrazu AlmaLinux do VDC
Source: https://www.websupport.sk/podpora/kb/instalacia-almalinux-9-vo-vdc
Príkaz na nahratie QCOW2 obrazu AlmaLinux do VDC pomocou nástroja openstack. Vyžaduje vopred načítané prostredie z RC súboru.
```bash
openstack image create --disk-format qcow2 --container-format bare --private --file AlmaLinux-9-GenericCloud-9.2-20230513.x86_64.qcow2 AlmaLinux-9.2
```
--------------------------------
### Install OpenSSH Server on Windows Server 2019
Source: https://www.websupport.sk/podpora/kb/instalacia-openssh-na-windows
This snippet covers the PowerShell commands required to install the OpenSSH client and server features on Windows Server 2019. It includes commands to add the capabilities, start the SSH service, and set it to start automatically.
```PowerShell
# Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
# Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start-Service sshd
# Set-Service -Name sshd -StartupType 'Automatic'
```
--------------------------------
### Import obrazu disku pomocou OpenStack CLI
Source: https://www.websupport.sk/podpora/kb/vlastne-obrazy-disku-vo-vdc
Príkaz na importovanie vlastného obrazu disku vo formáte QCOW2 do VDC. Vyžaduje špecifikáciu formátu disku, kontajnera a súboru obrazu.
```bash
openstack image create --disk-format qcow2 --container-format bare --private --file Downloads/ISO/openSUSE-Leap-15.1-OpenStack.x86_64-0.0.4-Build2.9.qcow2 openSUSE-Leap-15.1
```
--------------------------------
### Verify Helm Installation
Source: https://www.websupport.sk/podpora/kb/kubernetes-10-helm
After installing Helm, this command verifies the installation by displaying the installed Helm version. This is a crucial step to ensure Helm is ready for use.
```bash
helm version
```
--------------------------------
### Define and Run Multi-Container Application with Docker Compose
Source: https://www.websupport.sk/podpora/kb/docker-compose
This example demonstrates how to configure a docker-compose.yml file to run two Nginx web server containers. Each container serves content from a different host directory and they are connected to the same network. The commands show how to navigate directories, copy content, create the compose file, and then start and manage the services.
```bash
cd ~/docker-test
```
```bash
mv html html-compose-1
```
```bash
cp -r html-compose-1 html-compose-2
```
```yaml
version: "3.8"
services:
nginx-test-compose-1:
image: nginx
volumes:
- "./html-compose-1:/usr/share/nginx/html"
networks:
- siet-test
nginx-test-compose-2:
image: nginx
volumes:
- "./html-compose-2:/usr/share/nginx/html"
networks:
- siet-test
networks:
siet-test:
external: true
```
```bash
docker-compose up -d
```
```bash
docker-compose ps
```
--------------------------------
### Install and Use procs
Source: https://www.websupport.sk/podpora/kb/zakladne-linuxove-nastroje-vylepsene-v-jazyku-rust
Commands to install the procs process viewer via Snap and use it to monitor system processes with tree views and sorting capabilities.
```bash
sudo snap install procs
sudo procs --watch --tree systemd
sudo procs --sortd cpu
sudo procs --sortd mem
```
--------------------------------
### Install Helm 3 Package Manager
Source: https://www.websupport.sk/podpora/kb/kubernetes-10-helm
This snippet shows the commands to download, make executable, and run the Helm 3 installation script. It simplifies the process of setting up Helm on a system with Kubernetes already configured.
```bash
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
```
```bash
chmod 700 get_helm.sh
```
```bash
./get_helm.sh
```
--------------------------------
### Install Terraform on Ubuntu
Source: https://www.websupport.sk/podpora/kb/terraform-v-prostredi-vdc-zakladne-informacie-vyhody-a-instalacia
Installs Terraform on Ubuntu Linux by updating package lists, installing dependencies, adding the HashiCorp GPG key and repository, and finally installing the Terraform package. It also includes steps for verifying the installation and enabling shell autocompletion.
```bash
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
```
```bash
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
```
```bash
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
```
```bash
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
```
```bash
sudo apt update && sudo apt-get install terraform
```
```bash
terraform -version
```
```bash
touch ~/.bashrc && terraform -install-autocomplete
```
--------------------------------
### Install Certbot for Nginx
Source: https://www.websupport.sk/podpora/kb/ubuntu-20-04-lts-lets-encrypt-tls-ssl-pre-nginx-https
Installs the Certbot client and the Nginx plugin, which automates the process of obtaining and installing SSL certificates.
```bash
sudo apt install certbot python3-certbot-nginx
```
--------------------------------
### Initialize and Push a New Git Repository
Source: https://www.websupport.sk/podpora/kb/git-zaklady
Commands to create a local directory, initialize it as a Git repository, create a README file, and push the initial commit to a remote WebSupport GitLab repository.
```bash
mkdir moj_repozitar
cd moj_repozitar
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@gitlab.websupport.sk:/.git
git push -u origin master
```
--------------------------------
### Inštalácia a konfigurácia Dockeru
Source: https://www.websupport.sk/podpora/kb/kubernetes-1-historia-architektura-a-instalacia
Inštalácia kontajnerizačného prostredia Docker a nastavenie jeho automatického spúšťania pri štarte systému.
```bash
sudo apt install docker.io -y
systemctl start docker
systemctl enable docker
```