Skip to content

Instantly share code, notes, and snippets.

@jtomaszewski
Last active December 29, 2015 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtomaszewski/7630253 to your computer and use it in GitHub Desktop.
Save jtomaszewski/7630253 to your computer and use it in GitHub Desktop.
Example, quick VPS configuration (debian 7 wheeze). Submit changes or fork it and we'll make it better! =)

ssh

  1. create your own user
adduser johndoe # root@vps

# now, relogin onto johndoe 
mkdir .ssh

# copy ssh key from your local machine to johndoe's account
scp ~/.ssh/id_rsa.pub vps:./.ssh/authorized_keys

# now, lets check if `su` works
su

# if yes, then disable permitRootLogin option in:
vim /etc/ssh/sshd_config
service ssh restart

swap file

Swap file should be site to 1-2xRAM size.

https://www.digitalocean.com/community/questions/swap-debian-7-64-bits

base packages

@thanksto https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md for great similar guide

apt-get update -y
apt-get upgrade -y
apt-get install sudo -y

# Install vim and set as default editor
sudo apt-get install -y vim
sudo update-alternatives --set editor /usr/bin/vim.basic

#Install the required packages:
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-s

Python

# Install Python
sudo apt-get install -y python
# Make sure that Python is 2.5+ (3.x is not supported at the moment)
python --version
# If it's Python 3 you might need to install Python 2 separately
sudo apt-get install -y python2.7
# Make sure you can access Python via python2
python2 --version
# If you get a "command not found" error create a link to the python binary
sudo ln -s /usr/bin/python /usr/bin/python2
# For reStructuredText markup language support install required package:
sudo apt-get install -y python-docutils

Git

sudo apt-get install -y git-core

## Do you want to have the most-update git? if yes, then do:
# Remove packaged Git
sudo apt-get remove git-core

# Install dependencies
sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

# Download and compile from source
cd /tmp
curl --progress https://git-core.googlecode.com/files/git-1.8.4.1.tar.gz | tar xz
cd git-1.8.4.1/
make prefix=/usr/local all

# Install into /usr/local/bin
sudo make prefix=/usr/local install

Mails

sudo apt-get install -y postfix

If you want to also have IMAP & SMTP server, install dovecot (although this sounds like being in the `90... think about moving email service to somewhere else (SaaS):

If you want to configure only SMTP server for your web apps:

rbenv & ruby

@see https://github.com/sstephenson/rbenv

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev
rbenv install -l
rbenv install 2.0.0-p353
rbenv global 2.0.0-p353

gem install bundler --no-ri --no-rdoc

iptables

https://gist.github.com/jtomaszewski/7630081

Database

MySQL, PostgreSQL: https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/databases.md

MySQL

MongoDB

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/

apache

php

crontab

  • you can write in first line: MAILTO="john@doe.me" in case of invalid configuration of crontab -e

unnecessary rkhunter warnings?

Warning: No output found from the lsmod command or the /proc/modules file: /proc/modules output: lsmod output:

Solution: add "avail_modules loaded_modules" to DISABLE_TESTS in /etc/rkhunter.conf

Warning: Hidden directory found: /dev/.udev

Solution: comment out: ALLOWHIDDENDIR=/dev/.udev

additional apt-get-repository :

auto-send mail to admin on high server load

http://abusedcompetence.com/2011/03/13/get-automatic-email-or-text-message-alerts-when-your-server-load-is-too-high/

too large ibdata file in mysql

http://dba.stackexchange.com/questions/8982/what-is-the-best-way-to-reduce-the-size-of-ibdata-in-mysql http://erikimh.com/how-to-shrink-an-ibdata1-file-with-minimal-mysql-downtime/

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