Initial development server setup for Ubuntu 18.04

When I start a new project, I carry out the same basic steps. In most cases it starts with a server install of Ubuntu. Watch the following screencast where I walk through the initial dev server setup I use for Ubuntu 18.04.

Here are the main snippets of what I carry out on a fresh install of Ubuntu 18.04 Server:

First commands after installing, and logged in to the server as the user account:

sudo apt update
sudo apt upgrade
sudo apt install curl emacs-nox nginx git ufw fail2ban
mkdir ~/bin #for future use
ip addr

The ip addr command gets an IP address, e.g. 192.168.2.26, so we can replace with the ip address in the code below with what it returns.

My minimal emacs config file (in ~/.emacs.d/init.el) is as follows [1]:

(defvar autosave-backup-directory "~/.emacs.d/autosave-backup/")
(setq backup-directory-alist
	`((".*" . ,autosave-backup-directory)))
(setq auto-save-file-name-transforms
	`((".*" ,autosave-backup-directory t)))
(setq-default tab-width 2)
(global-visual-line-mode 1)
(setq inhibit-startup-screen t)

[1] Source on github

Changes in /etc/ssh/sshd_config:

# What ports, IPs and protocols we listen for
Port 2922
...
PermitRootLogin no

Uncomplicated Firewall: ufw

sudo ufw app list
sudo ufw allow OpenSSH
sudo ufw allow "Nginx Full"
sudo ufw enable
sudo ufw status

Prepare /var/www folder for future applications:

sudo usermod -aG www-data $USER
sudo chgrp -R www-data /var/www
sudo chmod -R 775 /var/www
sudo chmod g+s /var/www

The rest of the setup happens on the local workstation (in my case it’s either Mac or Linux).

Add the server IP address and hostname to /etc/hosts on my local workstation:

sudo -- sh -c "echo '192.168.2.26 perseus' >> /etc/hosts"

Make ssh a little quicker with .ssh/config addition:

Host perseus
  Hostname perseus
  User steve
  Port 2922

Add ssh key-based authentication:

## If you don't have an ssh keypair already, run keygen first, otherwise just run ssh-copy-id
ssh-keygen -b 4096
ssh-copy-id perseus

Bash alias for sshfs on the workstation (.bash_profile on MacOS, .bashrc on Ubuntu workstations):

mkdir -p ~/perseus/www ~/perseus/home
echo "alias map-perseus='sshfs perseus:/var/www ~/perseus/www && sshfs perseus:/home/steve ~/perseus/home'" >> ~/.bash_profile

Verify nginx is accessible from the workstation using curl:

curl http://perseus/

At this point the server is installed with its basic packages and configuration and I can edit files from my workstation. From here I can install an application’s stack-specific packages on the server.

Feel free to get in touch with your suggestions. I look to improve and refine this. Or let me know if you adopt what I have or made use of it in some way.

(Edited from a previous version on 2019-01-14)

... keep reading

Art Opening - Photography Exhibition at the Sackville Commons

Reposted from: Coworking Sackville - Steve Scott Art Opening

From June 12, 2017

Join us at The Commons this Friday to celebrate one of our Dynamic members’ art! Steve Scott is one of the founding members of The Sackville Commons, a talented Computing Technology Design Scientist, amazing father, athlete & entrepreneur– Steve Scott’s art is a celebration of the natural beauty of New Brunswick.

... keep reading

Goodbye Instagram and Social Media

In a previous post I described my exit from social media save for one holdout: Instagram. I intended to keep a presence on Instagram, at least for a while longer, because of my photography. My Instagram experiment, as I have been calling it, came to an abrupt end because of a privacy over-step on Instagram’s part.

... keep reading

Static-Site Comments via Email

Comments for statically generated blogs are often done through 3rd-party providers, e.g. Disqus, et al. I was uncomfortable with that approach. I wanted to keep things static with minimal JavaScript and minimal back-end code. But there are a number of features and concerns that still need to be addressed, namely: spam, privacy, and security. I didn’t want to reinvent the wheel. I just wanted to allow comments in a minimalistic way without ending up down a rabbit hole.

... keep reading

Can an iPad Pro Replace My Laptop?

I’ve read a number of iPad Pro reviews, many posted mere weeks after it launched, and they all sounded like they were written based on the device specs and not its actual use. They were all judge-a-book-by-its-cover reviews and not the contents.

... keep reading