How to setup PPTP Server on Debian 8?

Step 1 – PPTP Installation

Update the APT repository and install the PPTP daemon

[[email protected] #] apt update
[[email protected] #] apt install pptpd

Step 2 – Configuration & Authentication

Edit the config file

[[email protected] #] nano /etc/pptpd.conf

Add the following lines to this file:

localip 192.168.25.1
remoteip 192.168.25.100-199

remoteip: Will be used as VPN gateway/server IP address.
localip: These IPs will be assigned to VPN clients.

Now we need to setup authentication (usernames/passwords) for VPN clients.

[[email protected] #] nano /etc/ppp/chap-secrets


Modify this file according to your needs.

# Secret for authentication using CHAP
# client	server	secret		IP addresses
username1	pptpd	zxD2z8uc	*
username2	pptpd	P3zCuP1s	*
username3	pptpd	9wStTqU7	*

You can also replace * (asterisk) with specific IP address that will be assigned to particular username.

Save the file & exit the editor.

Step 3 – DNS

Now we need to specify the DNS servers that will be used by the VPN clients.

[[email protected] #] nano /etc/ppp/pptpd-options

Add the following lines to the end of this file.

ms-dns 8.8.8.8
ms-dns 8.8.4.4


Save it, and exit the editor.
Now you can start the PPTP service.

[[email protected] #] service pptpd start

Step 4 – Enable IP Forwarding

We need to enable IP forwarding to allow packets transfer between public & private IP addresses.

[[email protected] #] nano /etc/sysctl.conf

Add the following line to the end of this file.

net.ipv4.ip_forward = 1

Save & exit the text editor.

Run the following command to activate IP packets forwarding without rebooting the machine.

[[email protected] #] sysctl -p

Final Step – Firewall Rules

Now you should be able to connect to VPN but won’t be able to access the internet.

We need to create some firewall rules to allow internet access for VPN clients.

[[email protected] #] iptables -t nat -A POSTROUTING --out-interface ppp0 -j MASQUERADE
[[email protected] #] iptables -I INPUT -s 192.168.25.0/24 -i ppp0 -j ACCEPT
[[email protected] #] iptables -A FORWARD --in-interface eth0 -j ACCEPT


You’re all set! Let me know in the comments below if you run into any issues during this process.

How to install Apache, PHP, MySQL with phpMyAdmin on Debian VPS / Dedicated Server?

In this tutorial, we will learn how to install Apache2 with PHP & MySQL. Additionally, we will install phpMyAdmin for easy management of MySQL via web-interface.

Lets get started. Always be sure to update the apt repository. You may do so by using the following command:

[[email protected] #] apt update

Now you can simply install Apache2 on Debian with the following command:

[[email protected] #] apt install apache2

Apache2 service will be automatically on Debian during installation. Now using your favorite text editor on Debian, create a new file:

[[email protected] #] vi /var/www/html/test.php

Use the following piece of code in “test.php”:

<?php
phpinfo();
?>

Save the file, and exit the text editor.

Install the MySQL Server & PHP MySQL library.

[[email protected] #] apt install mysql-server php5-mysql

You will be prompted with password for MySQL root user account during installation.
enter the password and hit enter,
and repeat (re-enter password and hit enter).
mysql server will be started automatially during installtion process.
– test the mysql using:

[[email protected] #] mysql -u root -p

you will be prompted for the password. just hit enter if you didn’t
provide any password
during mysql server installation.

– now its time to install php.

[[email protected] #] apt install php5-common libapache2-mod-php5 php5-cli

– restart the apache2 service

[[email protected] #] service apache2 restart