Debian 7 Wheezy Dedicated Web Server Setup Step by Step

Perform a system upgrade

Check your repositories definitions:

nano /etc/apt/sources.list

They must look like:

deb http://ftp.gr.debian.org/debian/ wheezy main
deb-src http://ftp.gr.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

Perform system update:

apt-get update && apt-get -V upgrade

Install systemd

Using apt-get:

apt-get install systemd

Edit Grub options:

nano /etc/default/grub

Modify GRUB_CMDLINE_LINUX_DEFAULT=”quiet” to:

GRUB_CMDLINE_LINUX_DEFAULT="quiet init=/bin/systemd"

Finally:

update-grub && reboot

Install time server

Using apt-get:

apt-get install ntp

Add static IP

To set the static IP 192.168.1.200 modify network configuration:

nano /etc/network/interfaces

Replace

allow-hotplug eth0
iface eth0 inet dhcp

with

auto eth0
iface eth0 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    gateway 192.168.1.1

Restart network

systemctl restart networking.service

Test results:

ip addr

Results must look like:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:e7:e5:87 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.200/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::a00:27ff:fee7:e587/64 scope link
       valid_lft forever preferred_lft forever

Harden SSH

Edit SSH configuration:

nano /etc/ssh/sshd_config

Make the following changes

...
PermitRootLogin no
...
X11Forwarding no
...
AllowUsers pontikis ...
...

Restart SSH

systemctl restart ssh.service

Install Webmin (optional)

According to http://www.webmin.com/deb.html:

Add Webmin repositories KEY:

wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc

Modify repositories definitions:

nano /etc/apt/sources.list

Add Webmin repositories:

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Update repositories:

apt-get update

Finally, install webmin:

apt-get install webmin

Test Webmin at: https://192.168.1.200:10000 (login with root logins)

Install git (optional)

Using apt-get:

apt-get install git

Install some tools (optional)

Using apt-get:

apt-get install mc p7zip-full

Install MySQL

Using apt-get:

apt-get install mysql-server

REMARK: restart MySQL using systemctl restart mysql.service

Install Apache

Using apt-get:

apt-get install apache2 apache2-mpm-prefork

REMARK: restart Apache using systemctl restart apache2.service

Install PHP

Using apt-get:

apt-get install php5

Install MySQL Native Driver (mysqlnd)

apt-get install php5-mysqlnd

REMARK: If, for any reason, you don’t want mysqlnd, try apt-get install php5-mysql instead.

Install php adodb extension (optional).

apt-get install php5-adodb

Install database manager (optional)

phpMyAdmin and adminer are popular. I prefer adminer:

mkdir /var/www/adminer
wget http://downloads.sourceforge.net/adminer/adminer-3.6.3-mysql-en.php

REMARK: you can use apt-get install adminer, but this will remove php5-mysqlnd and install php5-mysql. See here.

Leave a Reply

Your email address will not be published. Required fields are marked *