This article briefly captures the steps I used to build a Debian 8.2 (Jessie) server with nginx 1.6.2, MySQL 5.5 and PHP 7.0.1.
Firstly, I downloaded the first 64-bit (amd64) Debian 8.2.0 ISO (approx. 4GB). I mounted and then booted the ISO from a generation 1 Hyper-V virtual machine with the following configuration: 1GB start-up memory (2GB max, and 512MB min); 2 processors; and 60GB hard disk.
From the installation boot menu, I selected Install (non-graphical), then selected English as the installation language, Australia as the location, and American English as the keyboard layout.
I set the hostname of the server to Dennis, and the domain name to lab.hinchley.net. I also set the root password, and used Peter Hinchley as the full name of a new non-root user with a username of hinchley. I also set the password of the new user.
I configured the timezone based on the location of Australian Capital Territory.
I opted to use the Guided - Entire Disk partitioning method, storing all files in a single partition.
I elected to use an online package mirror from Australia, specifically ftp.au.debian.org (with no proxy). And when prompted to select the software that should be installed, I only chose SSH server and Standard system utilities.
After the software was installed, I agreed to install the GRUB boot loader to the master boot record (MBR) on /dev/sda
. I then restarted the server and logged in as root.
I modified the package repository list (/etc/apt/sources.list
) to comment-out all lines beginning with deb cdrom (as I always intend to use a network mirror), and then updated the list of available packages:
apt-get update
I then configured the server with a static IP address (DHCP was used during installation). To do this I modified /etc/network/interfaces
and replaced:
iface eth0 inet dhcp
With:
auto eth0
iface eth0 inet static
address 10.0.0.50
netmask 255.255.255.0
broadcast 10.0.0.255
network 10.0.0.0
gateway 10.0.0.1
I then modified /etc/resolv.conf
and set nameserver to the IP address of my DNS server (10.0.0.10).
The next step isn't recommended in production, but since this is only a home lab, I permitted root to SSH to the server using a password by modifying /etc/ssh/sshd_config
. In particular, I changed:
PermitRootLogin without-password
To:
PermitRootLogin yes
To restart SSH after the change:
/etc/init.d/ssh restart
And to reboot the server:
shutdown -r now
At this point I was able to connect to the server from a terminal window on my Mac using the following command:
ssh root@10.0.0.50
Next up, I installed MySQL 5.5:
apt-get install mysql-server
mysql_install_db
/usr/bin/mysql_secure_installation
In response to the last command, I provided the following inputs:
- Do not reset root password
- Remove anonymous users
- Disallow root login remotely
- Remove test database (and access to it)
- Reload privilege tables
I then installed nginx 1.6.2:
apt-get install nginx
Next up, I installed git and sudo:
apt-get install git
apt-get install sudo
I then cloned the php-7-debian repository from kasparsd:
git clone https://github.com/kasparsd/php-7-debian.git
I then ran the following commands to install PHP 7.0.1 (the build step will take quite a while):
cd php-7-debian
./build.sh
./install.sh
After the installation completed, I modified /etc/nginx/sites-available/default
, adding index.php as the first default document (insert before index.html on the line that begins with index). I also replaced the block starting with location ~ \.php$
with the following:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9007;
}
Finally, I created a new file under /var/www/html
named index.php
with the following content:
<?php
phpinfo();
I then started PHP-FPM and restarted nginx:
/etc/init.d/php7-fpm start
service nginx restart
At this point I was able to open a browser on my Mac and request: http://10.0.0.50/
The PHP Version 7.0.1 information page was displayed.