Debian 9 (Stretch) release candidate 3 (RC3) is available since April 10th, 2017. Debian 9 RC3 is still a “testing” release (not recommended for production servers). Which is the release date of stable Debian 9? “When it’s ready” is the Debian answer. But, as Full freeze announced on February 5th, 2017 we can suppose that the final stable release will be available in about six months (mid of 2017). Please, note that no major differences are added after Full freeze (only bug fixes).
There are two very important changes in Debian 9 (Stretch):
- PHP 7 is the default PHP version
In addition to the new features, version 7 of PHP is much more faster than PHP 5.6. - MariaDB is the default MySQL flavor
So, it is crucial to test your projects, probably based on php 5.* and MySQL, in order to use Debian 9 official release in your server.
For this purpose, I setup Debian 9 RC3 in a virtual machine
using Virtualbox. As MariaDB is a drop-in replacement
for MySQL, moving to MariaDB seems to be easy. Use
mysqldump
to export your databases and then import
them to MariaDB. You may encounter some problems moving to php7, depending on your php code. But
generally, the migration is not so difficult. Below I describe my
experience.
Base system installation
Debian 9 RC3 can be downloded from this page. I downloaded the netinst amd64 ISO image from here (generally 150-280 MB).
I created a Virtualbox with 200GB disk. The downloaded CD image must be attached to created virtualbox:
I prefer “bridged” network adapter:
Start the virtual machine. It will boot from CD, so the Debian installation will start. See the screenshots below.
Start installation
Power on virtual machine will start Debian setup. Select boot from CD (pressing F12 during start-up.
Settings
Configure language, location and keyboard.
Network
DHCP auto configuration, set Hostname and Domain
Users
Set root password and create a common user.
Disk Partitioning
I use EXT4 file system. All partitions are Primary. I prefer to create partitions manually, as following:
- /boot partition 4 GB
- / partition 200 GB
- swap partition the rest of the disk: 10+ GB (usually RAM x 4)
Below is described partition creation in details (please, note: only /boot partition has bootable flag ON).
Base system
Installing the base system.
Package manager
Select Debian archive mirror and apt configuration.
Software installation
Software installation progress.
Popularity contest
Choose if you want to participate in Popularity contest.
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).
Grub boot loader
Grub boot loader installation.
Finish installation
Base Setup is finished. Reboot and login for first time.
This was the "base system" setup. From this point, I will customize the server according to my needs (LAMP setup etc).
Add static IP
The ifconfig
command (included in
net-tools package) has been deprecated, so it is missing
by default on Debian, starting from Debian 9 (Stretch). To get the
IP address you have to use the ip
command.
pontikis@stretch-rc3:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:4e:4c:15 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.3/24 brd 192.168.1.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 2a02:587:a012:e000:a00:27ff:fe4e:4c15/64 scope global mngtmpaddr dynamic
valid_lft 46155sec preferred_lft 46155sec
inet6 fe80::a00:27ff:fe4e:4c15/64 scope link
valid_lft forever preferred_lft forever
So, to change the autoconfigured with DHCP IP 192.168.1.3 to static 192.168.1.103:
Login as root. Then
nano /etc/network/interfaces
replace this
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp0s3
iface enp0s3 inet dhcp
# This is an autoconfigured IPv6 interface
iface enp0s3 inet6 auto
with
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug enp0s3
#iface enp0s3 inet dhcp
auto enp0s3
iface enp0s3 inet static
address 192.168.1.103
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
# This is an autoconfigured IPv6 interface
#iface enp0s3 inet6 auto
Finally, restart the network:
systemctl restart networking.service
Connect using SSH
From workstation computer:
ssh 192.168.1.103
then become root to perform administrative tasks
su -l root
Perform a full system update
Using apt-get:
apt-get update && apt-get -V upgrade
Update files database
Install the packages (if not installed):
apt-get install locate mlocate
then
updatedb
Harden SSH
This is optional in a LAN machine. Anyway, edit SSH configuration:
nano /etc/ssh/sshd_config
Make the following changes
...
PermitRootLogin no
...
X11Forwarding no
...
AllowUsers your_user_name ...
...
Restart SSH
systemctl restart ssh.service
SSH key based authentication
First, generate a new SSH key
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C "your_email_here"
To connect from workstation to server machine, add your public key to server.
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.103
Color Bash Prompt
To add color to common user prompt:
cd /home/pontikis
nano .bashrc
uncomment #force_color_prompt=yes
...
force_color_prompt=yes
...
To add red color to root prompt:
cd /root
nano .bashrc
Set PS1 as follows:
PS1='${debian_chroot:+($debian_chroot)}[