Things you might want to tweak on your new Ubuntu 16.04 server – because you need a pretty prompt and a text editor.
I figured this is a good place to put some notes for next time I want to make a new server feel a bit more homely.
jed
apt-get install jed
/etc/jed.d/99defaults.sl
No_Backups = 1;
Locales
dpkg-reconfigure locales
Hostname
edit /etc/hosts and add a hostname for the server
edit /etc/hostname and add a hostname
run hostname -F /etc/hostname
apt via IPv4
echo ‘Acquire::ForceIPv4 “true”;’ | sudo tee /etc/apt/apt.conf.d/99force-ipv4
update packages
apt-get update
apt-get dist-upgrade
Clone some packages from another box, maybe?
Old:
sudo apt-get install apt-clone
apt-clone clone foo
New:
sudo apt-get install apt-clone
sudo apt-clone restore foo.apt-clone.tar.gz
ssh
apt-get install openssh-server
ssh-keygen -t ed25519
ssh-copy-id -i ~/.ssh/id_ed25519.pub -p 2211 user@host
Setup ssh keys.
Change the port your server runs on in /etc/ssh/sshd_config
mosh
apt-get install mosh
Add something like this in .zshrc (on your laptop):
alias mocms=”mosh -p 2345 –ssh=\”ssh -p 2345 \” joe@cms.my.server.co”
motd
apt-get install update-motd landscape-common update-notifier-common
ln -s /var/run/motd.dynamic /etc/motd
Postfix
apt-get install postfix
edit /etc/mailname
edit /etc/aliases
newaliases
root: youremail@yourdomain.com
Auto Security Updates
apt-get install unattended-upgrades
/etc/apt/apt.conf.d/10periodic
APT::Periodic::Update-Package-Lists “1”;
APT::Periodic::Download-Upgradeable-Packages “1”;
APT::Periodic::AutocleanInterval “7”;
APT::Periodic::Unattended-Upgrade “1”;
/etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Mail “your@email.address”;
sudo apt install apticron
/etc/apticron/apticron.conf
EMAIL=”your@email.address”
zsh
apt-get install zsh
apt-get install git
install oh-my-zsh:
sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”
use this .zshrc if you like.
edit your .zshrc
plugins=(autojump brew pip git django python docker screen)
change prompt colours like so:
base_prompt, play with integer values to change colours
emacs
apt-get install emacs aspell
install prelude:
wget –no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O – | sh
edit .emacs.d/prelude-modules.el
You may want to run emacs as a daemon for more than one user on your server.
Add (setq server-use-tcp t) to the top of init.el config files – so emacs starts as a tcp server.
/home/joe/.zshrc:
alias emacsinit=”emacs -u joe –daemon=joe”
alias e=”emacsclient –server-file=joe -t”
/root/.zshrc:
alias emacsinit=”emacs -u root –daemon=root”
alias e=”emacsclient –server-file=root -t”
Apache HTTP2
apt-get install software-properties-common
add-apt-repository ppa:ondrej/apache2
apt-get update
apt-get dist-upgrade
install apache2
a2enmod http2
service apache2 restart
Add this to your vhosts:
Protocols h2 http/1.1
MySQL and PHP
apt-get install mysql-server
apt-get install php7.0
apt-get install libapache2-mod-php
apt-get install php7.0-mysql