vk | testing | publicar rss en twitter desde php | json_encode quote escape | convert init.d systemd


Debian 7 Wheezy RC1 LAMP Server Setup Step by Step

...goodbye Squeeze! Welcome, Wheezy!

Debian 7.0 (Wheezy) Release Candidate 1 was released on February 17th, 2013. This is not the final stable release, which expected in a few months. It is still a "testing" release (not recommended for production servers). However, it is a foretaste of the final (stable) version that will follow.

New features include Linux kernel 3.2 with longterm support, ext4 is now the default filesystem, systemd support. Read the full list here.

Here I will setup a Debian 7 system intended for LAMP server. "systemd" is a system and service manager for Linux, compatible with SysV and LSB init scripts. "systemd" has been adopted from many distributions. See why. So, I will activate it in the following setup. As an example, you will see:

systemctl restart apache2.service instead of service apache2 restart.

Create virtual machine

Debian 7 RC1 can be downloded from http://www.debian.org/devel/debian-installer/. I will use the netinst amd64 ISO image from here (about 230 MB).

Debian 7 RC1 amd64 will be installed in a virtual machine, using Virtualbox:

(click the thumb for full image)


Power on virtual machine will start Debian setup. Select boot from CD (pressing F12 during start-up.

(click the thumb for full image)

If you need advanced configuration (e.g. creating Partition table), select

Advanced options → Expert install


Configure language, location and keyboard.

(click the thumb for full image)


Set Hostname and Domain

(click the thumb for full image)


Set root password and create a common user.

(click the thumb for full image)

Disk Partitioning

I use EXT4 file system, which is default to Debian 7. All partitions are Primary. I prefer to create partitions manually, as following:

  • /boot partition 5 GB
  • swap partition 4 GB (usually RAM x 4)
  • /tmp partition 5 GB
  • / partition the rest of the disk from root partition

Below is described /boot partition creation in details. Rest partitions are created using the same procedure (only /boot partition has bootable flag ON).

(click the thumb for full image)

Base system

Installing the base system.

(click the thumb for full image)

Package manager

Select Debian archive mirror and apt configuration.

(click the thumb for full image)

Software installation

Software installation progress.

(click the thumb for full image)

Popularity contest

Choose if you want to participate in Popularity contest.

(click the thumb for full image)

Select additional software

After the installation of core system, additional software could be selected for installation. This is a server system, so only SSH server and Standard system utilities have been selected. Any additional software (web server, database server etc) will be installed manually after base installation (see below).

(click the thumb for full image)

Install additional software

Additional software installation progress.

(click the thumb for full image)

Grub boot loader

Grub boot loader installation.

(click the thumb for full image)

Finish installation

Base Setup is finished. Reboot and login for first time.

(click the thumb for full image)

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


GRUB_CMDLINE_LINUX_DEFAULT="quiet init=/bin/systemd"


update-grub && reboot

Install time server

Using apt-get:

apt-get install ntp

Add static IP

To set the static IP modify network configuration:

nano /etc/network/interfaces


allow-hotplug eth0
iface eth0 inet dhcp


auto eth0
iface eth0 inet static

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 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 brd 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: (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.

Related Posts

You may also be interested in

Sign-up for our free email newsletter. Get updates when new tutorials and tips are published. You can unsubscribe anytime with a click.

Your comments are welcomed!

This site actively encourages commenting on any post. Comments are not pre-moderated, but this community does not tolerate direct or indirect attacks, name-calling or insults. Please, read terms of use and Comment Policy at privacy policy.

Is it time to Remove MySQL in favor of MariaDB in Production Servers? Migration from initscripts to systemd on Archlinux