Skip to content

Instantly share code, notes, and snippets.

@jakebrinkmann
Last active August 5, 2018 22:12
Show Gist options
  • Save jakebrinkmann/08e933dbcbc21805d9dfb2d09e1e7eaf to your computer and use it in GitHub Desktop.
Save jakebrinkmann/08e933dbcbc21805d9dfb2d09e1e7eaf to your computer and use it in GitHub Desktop.
setup centos 7 from scratch as a virtual machine (vmware) on Windows 10

Download

Go here and snag the "CentOS-7-x86_64-Minimal-1804.iso" or equivalent.

Infrastructure

Open up VMWare (or VirtualBox) and make a VM with:

  1. 50GB HDD, single-file
  2. 2GB RAM
  3. 2CPU threads
  4. "Bridged" network adapter, replicate physical network (configure to only keep the connected interface)
  • Or, use "Custom:Specific" and select "VMnet8(NAT)"
  1. Auto display adapter

Note: If having trouble with starting the VM from ISO, try after disabling all firewall applications. Can also try running cmd as admin, and netsh winsock reset

Installation

  1. Install with all the defaults, making sure to check "Auto connect" under network
  2. Make a root:root account
  3. Make a jake:admin123 account
  4. Reboot when prompted

Network issues

  • run nmcli d to list connections
  • run nmtui to Activate or edit connections
    • Use to enable or disable options
  • get IP Address from DHCP: service network {status|restart}

Setup

echo 'jake ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/jake
yum install -y vim git which wget httpie sudo tmux epel-release

vi /etc/ssh/sshd_config
# uncomment `PubkeyAuthentication yes`

# Check sshd is running 
systemctl status sshd

# Live dangerously 
systemctl disable firewalld

Setup samba windows share

yum install samba samba-client samba-common
sudo vim /etc/samba/smb.conf
setsebool -P samba_enable_home_dirs on
sudo systemctl enable smb.service
sudo systemctl enable nmb.service
sudo systemctl start smb.service
sudo systemctl start nmb.service
sudo smbpasswd -a jake

# Check the ip address:
ip addr

# List the samba shares:
smbtree 
  • Now, Win + E and Map a Network Drive to the share

Setup docker

yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --enable docker-ce-edge
yum install docker-ce
systemctl start docker
usermod -aG docker jake

Add docker-compose

curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# This is the main Samba configuration file. For detailed information about the
# options listed here, refer to the smb.conf(5) manual page. Samba has a huge
# number of configurable options, most of which are not shown in this example.
#
# The Samba Wiki contains a lot of step-by-step guides installing, configuring,
# and using Samba:
# https://wiki.samba.org/index.php/User_Documentation
#
# NOTE: Run the "testparm" command after modifying this file to check for basic
# syntax errors.
#
#---------------
# Security-Enhanced Linux (SELinux) Notes:
#
# Run the "ls -ldZ /path/to/directory" command to view the current SELinux
# label for a given directory.
#
# Set SELinux labels only on files and directories you have created. Use the
# chcon command to temporarily change a label:
# chcon -t samba_share_t /path/to/directory
#
#--------------
#
#======================= Global Settings =====================================
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = MYSERVER
invalid users = root
# --------------------------- Logging Options -----------------------------
# log files split per-machine:
log file = /var/log/samba/log.%m
# maximum size of 50KB per log file, then rotate:
max log size = 50
# ----------------------- Standalone Server Options ------------------------
security = user
passdb backend = tdbsam
#============================ Share Definitions ==============================
[homes]
comment = Home Directories
browseable = no
writable = yes
valid users = %S
; valid users = MYDOMAIN\%S
hide dot files = no
@jakebrinkmann
Copy link
Author

jakebrinkmann commented Jul 17, 2018

yum install nfs-utils
echo '<ip-addr>:/path/to/folder  /path/to/folder  nfs     noauto,bg,ro,soft,intr,intr       0 0' >> /etc/fstab
mkdir -p /path/to/folder

Mount everything without noauto

sudo mount -a

or, things with autonfs:

sudo mount /path/to/folder

@jakebrinkmann
Copy link
Author

jakebrinkmann commented Jul 28, 2018

Sync system time with ntp server after every 5 min:

timedatectl set-timezone America/Chicago
sudo yum install -y ntpdate
echo '*/5 * * * * root ntpdate 0.pool.ntp.org' | sudo tee /etc/cron.d/ntpdate

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