Last updated 2018-03-02
VirtualBox guest machine setup §
- Name: “CentOS7”; Operating System: “Red Hat (64-bit)”
- Base Memory: 1024 MB
- Create a virtual hard disk now, VDI, fixed size
- Shared Clipboard: “Bidirectional”; Drag’n’Drop: “Bidirectional”
- Boot Order: Optical, Hard Disk (deselect Floppy)
- Enable extended features and all processor acceleration
- Enable 3D Acceleration
- Remove IDE storage device, add optical drive to SATA controller
- Disable audio and USB
- Change network card to preferred network and select Paravirtualized Interface
- Set up shared folders:
- C:/Users/xxxxx/Downloads -> Win_Downloads, auto-mount, permanent
- /home/xxxxx/Downloads -> Lin_Downloads, auto-mount, permanent
OS installation §
- Install from minimal installation disk (1708)
- Set disk partitioning to Standard Partitions and automatically create partitions, then change
swap
and/boot
to 512 MB each and set/
as large as possible - Set hostname , turn on networking
- Set root password
- Create user, with administrator privileges
- Reboot, log in as “stick”,
sudo yum update
, reboot
Security §
Secure SSH §
sudo vim /etc/ssh/sshd_config
- Optionally, set SSH to listen on IPv4 only.
...
AddressFamily inet
...
- Use only secure ciphers and macs.
...
# Ciphers and keying
Ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
Macs umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512
#RekeyLimit default none
...
- Disallow root login, and make it harder to brute force guesses.
...
LoginGraceTime 30
PermitRootLogin no
#StrictModes yes
MaxAuthTries 2
MaxSessions 2
...
- Optinally, set SSH to use pubkey login only. Ensure you set up public key authentication for you user before you do this.
- From other machine:
ssh-copy-id stick@centos7.stma
sudo vim /etc/ssh/sshd_config
...
#PubkeyAuthentication yes
...
PasswordAuthentication no
...
Disable IPv6 and set other networking options §
sudo nmtui
- Edit a connection -> eth0 -> Edit… -> IPv6 CONFIGURATION
<Ignore>
-> OK
- Edit a connection -> eth0 -> Edit… -> IPv6 CONFIGURATION
sudo curl -L https://raw.githubusercontent.com/nstickney/dotfiles/master/aconfmgr/files/etc/sysctl.d/51-net.conf -o /etc/sysctl.d/51-net.conf
sudo reboot
You can use ip addr
to check that IPv6 really is turned off.. The various options specified in 51-net.conf
are mostly from the ArchWiki.
Optional: Remove unwanted network listeners: §
sudo yum remove chrony postfix
Set up firewall §
curl -o fw.sh https://raw.githubusercontent.com/nstickney/dotfiles/master/bin/fw.sh
sudo ./fw.sh
rm fw.sh
Disable root account §
sudo usermod -p '!' root
sudo passwd -l root
.
Skip the grub
timeout on boot §
sudo vim /etc/default/grub
- Change
GRUB_TIMEOUT=5
toGRUB_TIMEOUT=0
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Install additional software §
Install VirtualBox Guest Additions §
See CentOS wiki.
sudo yum install bzip2 dkms gcc kernel-devel make
- “Devices -> Insert Guest Additions CD image”
sudo mount /dev/sr0 /mnt && sudo /mnt/VBoxLinuxAdditions.run
- Reboot and remove the Guest Additions CD image (or remove optical device entirely)
Install Vim (version 8) §
Thanks to SysTutorials QA.
sudo curl -L https://copr.fedorainfracloud.org/coprs/mcepl/vim8/repo/epel-7/mcepl-vim8-epel-7.repo -o /etc/yum.repos.d/mcepl-vim8-epel-7.repo
sudo yum update
sudo yum install vim
Optional: Install the EPEL repo §
The EPEL repository contains a large number of extra packages for Enterprise Linux (and by extension CentOS).
sudo yum install epel-release && sudo yum update
Install other useful packages §
The dig
and nslookup
commands on CentOS 7 are in the bind-utils
package. You should know what git
is. The mlocate
package is a way to find files across your entire system.
sudo yum install bind-utils git mlocate && sudo updatedb
If you installed the EPEL repo above, you can also install ag
, the silver searcher.
sudo yum install the_silver_searcher
Configure the system §
Optional: Install dotfiles §
cd ~ && git clone https://github.com/nstickney/dotfiles && ./dotfiles/install.sh
- Refresh bash session (logout/login, etc)
Optional: Create a snapshot §
history -c
- Close -> ACPI Shutdown
- Snapshots -> Take