Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Last active November 6, 2025 17:00
Show Gist options
  • Select an option

  • Save peteristhegreat/7bffdcaf6c4ed9286aa88cdaa3082971 to your computer and use it in GitHub Desktop.

Select an option

Save peteristhegreat/7bffdcaf6c4ed9286aa88cdaa3082971 to your computer and use it in GitHub Desktop.
Rocky Linux setup in VirtualBox, docker, ssh

Start with an image from here

https://www.linuxvmimages.com/images/rockylinux-8/ (MINIMAL INSTALLATION)

Or get VirtualBox started with an ISO from here:

https://rockylinux.org/download (minimal ISO)

Install it with something like:

  • 2 GB memory
  • 2 Processors
  • Dynamic allocated storage
  • username: rockylinux
  • machine name: rocky8
  • hostname: rocky8.vbox
  • network: NAT Network
sudo yum update
sudo dnf -y install dnf-plugins-core
sudo yum install vim openssh-server net-tools -y
sudo dnf install openssh-server
sudo systemctl start sshd
sudo systemctl enable sshd
# install docker and docker compose
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
sudo systemctl enable docker
sudo docker version
sudo dnf install -y shadow-utils fuse-overlayfs slirp4netns
sudo dnf install -y docker-ce-rootless-extras
sudo sh -eux <<EOF
# Load ip_tables module
modprobe ip_tables
EOF
dockerd-rootless-setuptool.sh install
docker ps
sudo curl -kL "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)"  -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version
# GSSAPIAuthentication is super slow to fail... turn it off for faster ssh.
sudo sed -i 's/^GSSAPIAuthentication[[:space:]]\+yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sudo systemctl restart sshd
# clean up banners
sudo vim /etc/issue.net
sudo vim /etc/issue
sudo vim /etc/motd
# change the default password
sudo passwd rockylinux
sudo hostnamectl set-hostname rocky8.vbox
history | cut -c 8-

Be sure to set up a named Nat Network in VirtualBox and port forward (e.g. Host 2022 to Guest 10.0.3.3 port 22)

The ssh command could look something like:

ssh -p 2022 [email protected]

TODO: setup auto security patching on a schedule

https://www.cyberciti.biz/faq/install-enable-automatic-updates-rhel-centos-8/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment