Skip to content

Instantly share code, notes, and snippets.

@bogdanRada
Forked from TomasKulhanek/README.md
Created June 21, 2018 16:34
Show Gist options
  • Save bogdanRada/a009737a0b01bb7e7d011dccf87514fa to your computer and use it in GitHub Desktop.
Save bogdanRada/a009737a0b01bb7e7d011dccf87514fa to your computer and use it in GitHub Desktop.
Script to prepare SL7 vagrant box
# expected that SL7 is installed as minimal system, vagrant account as administrator, run with sudo privileges
yum groupinstall "X Window System"
yum -y install gnome-classic-session gnome-terminal nautilus-open-terminal control-center dejavu-sans-mono-fonts
systemctl set-default graphical.target
# enable ssh
systemctl enable sshd
yum install -y wget
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate \
https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub \
-O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
#install vboxguest
yum install -y bzip2 gcc kernel-devel
mount /dev/cdrom /mnt
cd /mnt
./VBoxLinuxAdditions.run
# clean
yum remove -y gcc kernel-devel
yum autoremove -y
yum remove -y perl-*
cd /home/vagrant
wget https://gist.github.com/TomasKulhanek/21e4544823dfcd181b3d0787a5b525a1/raw/1973aad8ebb9754ee1c598c0cb568b55fd625c5a/sshd_config -O /etc/ssh/sshd_config
wget https://gist.githubusercontent.com/TomasKulhanek/fb3554f1265fb9b9fc71310a2678a0bc/raw/vagrant-clean.sh
chmod +x vagrant-clean.sh
./vagrant-clean.sh
#enable sudo
echo 'vagrant ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo
# enable ssh
systemctl enable sshd
yum install -y wget
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate \
https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub \
-O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
#install vboxguest
yum install -y bzip2 gcc kernel-devel
mount /dev/cdrom /mnt
cd /mnt
./VBoxLinuxAdditions.run
# clean
yum remove -y gcc kernel-devel
yum autoremove -y
yum remove -y perl-*
cd /home/vagrant
wget https://gist.github.com/TomasKulhanek/21e4544823dfcd181b3d0787a5b525a1/raw/1973aad8ebb9754ee1c598c0cb568b55fd625c5a/sshd_config -O /etc/ssh/sshd_config
wget https://gist.githubusercontent.com/TomasKulhanek/fb3554f1265fb9b9fc71310a2678a0bc/raw/vagrant-clean.sh
chmod +x vagrant-clean.sh
./vagrant-clean.sh
Port 22
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PermitEmptyPasswords no
PasswordAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
UsePrivilegeSeparation sandbox # Default for new installations.
UseDNS no
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/libexec/openssh/sftp-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment