Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How I setup my VPS on ovh-com

Config is 2vCPU, 2 GB RAM and running Debian 7 on 64 bits.

apt-get update
apt-get upgrade
apt-get install htop

Add localadmin user

adduser localadmin
apt-get install sudo
sudo update-alternatives --config editor

Add the localadmin user as root

localadmin  ALL=(ALL) NOPASSWD: ALL

Put SSH port to something else

vim /etc/ssh/sshd_config

Set Port to the value you like. Hidden for security purpose Restart SSH

service ssh restart

Setting up service to ban IP's on many failed login attempts

apt-get install fail2ban

Change port of SSH action to the port defined earlier, and restart service

service fail2ban restart

Installed LAMP stack

tasksel install web-server
adduser trefex
mkdir /home/trefex/public_html
mkdir /home/trefex/logs
chown trefex.www-data /home/trefex/public_html/
chmod 750 /home/trefex/public_html/
chmod 750 /home/trefex/logs/
chmod 711 /home/trefex/
apt-get install php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql
apt-get install phpmyadmin

Configured Virtual Hosts

ls -al
cd /etc/apache2/sites-available/
ls -al
less default
cp default
service apache2 reload

Contents of /etc/apache2/sites-available/

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /home/trefex/public_html

        ErrorLog /home/trefex/logs/error.log
        CustomLog /home/trefex/logs/access.log combined

Install webmin to administer unix machine in a more user friendly way

apt-get update

Edit /etc/apt/sources.list and add

deb sarge contrib
deb sarge contrib
cd /root
apt-key add jcameron-key.asc

Add public SSH key to server to prevent password logon and ease of use

mkdir ~/.ssh
chmod 0700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 0644 ~/.ssh/authorized_keys
vim ~/.ssh/authorized_keys

Enable mod_rewrite in Apache 2

a2enmod rewrite
service apache2 restart

Ruby - to get latest version, do not use apt-get install ruby

wget -O ruby-install-0.5.0.tar.gz
tar -xzvf ruby-install-0.5.0.tar.gz
cd ruby-install-0.5.0/
sudo make install

Installing ruby gem and ruby env. Install rbenvusing

ruby-install --install-dir ~/.rbenv/versions/2.1.3 ruby 2.1.3
rbenv global 2.1.3
tar -zxvf rubygems-2.4.5.tgz
cd rubygems-2.4.5
ruby setup.rb
gem install backup
gem install whenever

Also enable suPHP to execute PHP as owner of files

apt-get install libapache2-mod-suphp
service apache2 restart

In Jessie, suPHP is not available anymore and should be replaced by php-fpm

apt install php5-fpm php5-dev libapache2-mod-fastcgi

Follow this guide:


This comment has been minimized.

Copy link

JamesSwift commented Mar 1, 2017

Interesting overview. Thanks for sharing.

You find my little project of interest:

It's basically an automated version of what you do (although I use a different stack (nginx)). So that when I spin up new VPS instances I can get them setup just how I like quickly and without forgetting anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.