Table of Contents
Virtual Private Server @ OVH
OVH VPS seem good value, they offer unlimited bandwidth which is pretty useful if you're looking to setup your own VPN. Choose whatever level of VPS you desire and your operating system of choice. I have opted for ArchLinux so thats what the instructions in this guide follow with regards to installing software, configuration of software is somewhat independent, although files may be located in different locations depending on the distribution.
Initial Setup
Once you've got your VPS details you can log in, by default this is done using the root
account and password you are provided.
Version Control
Its simple to version control all of your configuration files, using Git and place the /etc/
directory under version control (as root
).
cd /etc git config --global user.name "Your Name" git config --global user.email "your.email@address" git config --global core.editor "nano" git init git add --all echo 'passwd' > .gitignore git add .gitignore git commit -m "Added .gitignore"
etckeeper
An alternative it to use etckeeper to place your /etc/
directory under version control, there are several options as to which content manager to use, you can set it in the file /etc/etckeeper/etckeeper.conf
after installation which is simple…
pacman -Syu etckeeper
Security
It is prudent to change the password for the root
and the default user account (which is arch
).
ssh root@vps####.ovh.net passwd New password: Retype new password: passwd: password updated successfully passwd arch New password: Retype new password: passwd: password updated successfully
Securing sshd
Disable root
login by editing /etc/ssh/sshd_config
to prevent root
login. Optionally you can change the port on which SSH connections are made. If you change the port be sure to make a note of it as you will need to explicitly specify it when SSHing to the machine (you can edit ~/.ssh/config
on your local computers to hold these details to make your life easier).
PermitRootLogin no
Port ****
…then restart the sshd
using the following systemd command…
systemctl restart sshd.service
Sample user-configuration on local computer ~/.ssh/config
and after doing so you can ssh by simply referring to the hostname, which in this case would be ssh vps_ovh
…
Host vps_ovh HostName vps*******.ovh.net Port **** User arch
Installing Software
This will depend on what you want to do with your VPS, I wish to host NextCloud run my own OpenVPN and host some DokuWiki, but I also want to use editors such as Emacs and run R sometimes. Under ArchLinux installing software is pretty simple using the pacman package manager.
pacman -Syu nextcloud openvpn dnscrypt-proxy emacs r rsync
AUR Software
Longer term I wish to get a Shiny Server and use Emacs Speaks Statistics neither of which are in the official repository but is available from the ArchLinux User Repository.
It is recommended that you read the ArchLinux Wiki : Arch User Repository - Installing Packages. Initially I had problems…
1 Cloning git repositories, I had to update the ''ca-certificates-utils''. 2 No build system installed by default, I needed to install the ''base-devel'' packages
So before I could proceed, as root
…
pacman -Syu ca-certificates-utils base-devel
Now as the user arch
run the following to clone the package and build it…
cd mkdir aur && cd aur git clone https://aur.archlinux.org/package_name.git cd package_name makepkg -si
Repeat these steps (heading the warning about checking files) for any AUR package you wish to install.
Add shiny-server config files to Git
Having installed Shiny-server the configuration files which reside in /etc
they need adding to the git version control, as root
…
cd /etc git add --all shiny-server git commit -m "Adding shiny-server/ dir"
System Administration
ArchLinux uses systemd, you can list processes using systemctl
and then start/stop/restart/status and many other things besides.
Configuring OpenVPN
I used the OpenVPN install script since its supports ArchLinux. Follow the instructions to install and configure OpenVPN. Its preferable to my previous recommendation since its puts everything in the right place by virtue of correctly supporting Arch Linux.
DNS
A good choice is those provided by the OpenNIC Project, visit there and you'll be shown a selection of geographically local DNS servers. You can not explicitly define DNS servers by simply modifying the /etc/resolv.conf
since ArchLinux autogenerates this file and it will be over-written. There are methods of avoiding this though in your VPS.
nameserver 31.3.135.232 nameserver 51.255.48.78 nameserver 146.185.176.36
This can also be achieved by modifying the /etc/openvpn/server/server.conf
that was created above.
push "dhcp-option DNS 31.3.135.232" push "dhcp-option DNS 51.255.48.78" push "dhcp-option DNS 146.185.176.36"
Adblocking
You can block adds so that any client connected to the VPN doesn't see them using Privoxy Ad Blocking.