Skip to content

Instantly share code, notes, and snippets.

@raging
Last active May 2, 2016 13:52
Show Gist options
  • Save raging/59ad4e5c888e2909863c to your computer and use it in GitHub Desktop.
Save raging/59ad4e5c888e2909863c to your computer and use it in GitHub Desktop.
Master Server Setup

Server Setup

Ubuntu 14.04 and later versions

sudo add-apt-repository ppa:saiarcot895/myppa

sudo apt-get update

sudo apt-get -y install apt-fast

Ubuntu 11.04~13.10 (out of date)

sudo add-apt-repository ppa:apt-fast/stable

sudo apt-get update

sudo apt-get -y install apt-fast

sudo apt-get install zsh git vim lsb-release scrot curl htop fail2ban unattended-upgrades logwatch ntp ntpdate

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

curl http://j.mp/spf13-vim3 -L -o - | sh

wget http://github.com/downloads/djmelik/archey/archey-0.2.8.deb

sudo dpkg -i archey-0.2.8.deb

echo 'archey' >> .zshrc


Hardening

sudo vim /etc/ssh/sshd_config

PermitRootLogin no

PasswordAuthentication no

AllowUsers edgetor

sudo service ssh restart

sudo ufw allow 22

sudo ufw allow 80

sudo ufw allow 443

sudo ufw enable

sudo vim /etc/apt/apt.conf.d/10periodic

APT::Periodic::Update-Package-Lists "1";

APT::Periodic::Download-Upgradeable-Packages "1";

APT::Periodic::AutocleanInterval "7";

APT::Periodic::Unattended-Upgrade "1";

vim /etc/cron.daily/00logwatch

/usr/sbin/logwatch --output mail --mailto test@gmail.com --detail high


Adding SWAP

sudo fallocate -l 4G /swapfile

ls -lh /swapfile

sudo chmod 600 /swapfile

ls -lh /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

sudo swapon -s

sudo nano /etc/fstab

/swapfile none swap sw 0 0

sudo nano /etc/sysctl.conf

vm.swappiness=10

vm.vfs_cache_pressure=50


Add User

adduser demo

gpasswd -a demo sudo

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