By default Debian ships without sudo
so it needs to be installed as root:
su -
apt update
apt install sudo
Next you will need to add yourself to the sudoers group. Do this while still as root:
usermod -aG sudo username
You will need to log out of user account and log back in for this to take effect.
You’ll probably want a nice MOTD with debian logo. You can use this one:
#!/bin/bash | |
echo -e "\e[1;31m" | |
echo -e " _,edm\$\$\$\$\$on." | |
echo -e " ,d\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$P." | |
echo -e " ,g\$\$P\"\" \"\"\"Y\$\$.\"." | |
echo -e " ,\$\$P' \`\$\$\$." | |
echo -e " ',\$\$P ,ggs. \`\$\$b:" | |
echo -e " \`d\$\$' ,\$P\"' . \$\$\$" | |
echo -e " \$\$P d\$' , \$\$P" | |
echo -e " \$\$: \$\$. - ,d\$\$'" | |
echo -e " \$\$; Y\$b._ _,d\$P'" | |
echo -e " Y\$\$. \`.\`\"Y\$\$\$\$P\"'" | |
echo -e " \`\$\$b \"-.__" | |
echo -e " \`Y\$\$b" | |
echo -e " \`Y\$\$. \e[0;1mDebian GNU\Linux `cat /etc/debian_version`\e[1;31m" | |
echo -e " \`\$\$b." | |
echo -e " \`Y\$\$b." | |
echo -e " \`\"Y\$b._" | |
echo -e " \`\"\"\"\"" | |
echo -e "\e[0m" |
Copy the file to /etc/update-motd.d/
and rename it to something like 15-logo
.
Log out and log back in to see if it took effect.
If you’re not using your own .bashrc
but want color prompt on the physical tty then edit the stock .bashrc
and uncomment the following line:
force_color_prompt=yes
This will give you color prompt on the physical console.
To make sure your server can be accessed both by hostname
and hostname.local
install Avahi:
sudo apt install avahi-daemon
This should resolve that issue.
Install vim:
sudo apt install vim
If you want a minimal .vimrc you can use this:
source /etc/vim/vimrc | |
" use jj to quickly escape to normal mode while typing | |
inoremap jj <ESC> | |
" press ; to issue commands in normal mode (no more shift holding) | |
nnoremap ; : | |
" move by screen lines, not by real lines - great for creative writing | |
nnoremap j gj | |
nnoremap k gk | |
" also in visual mode | |
xnoremap j gj | |
xnoremap k gk | |
" automatically jump to last misspelled word and attempt replacing it | |
noremap <C-l> [sz= | |
" for when you mess up and hold shift too long (using ! to prevent errors while | |
" sourcing vimrc after it was updated) | |
command! W w | |
command! WQ wq | |
command! Wq wq | |
command! Q q | |
" changing file types: | |
command! DOS set ff=dos " force windows style line endings | |
command! UNIX set ff=unix " force unix style line endings | |
command! MAC set ff=mac " force mac style line endings | |
" enable line numbers | |
set number | |
" hilight cursor line and cursor column markers | |
set cursorline | |
" save more in undo history | |
set history=1000 | |
set undolevels=1000000 | |
" Syntax highlighting | |
syntax on | |
filetype on | |
filetype indent on | |
filetype plugin on | |
filetype plugin indent on | |
" no swap files | |
set noswapfile | |
set nobackup | |
set nowb | |
" disable beeping | |
set noerrorbells | |
set visualbell | |
" Change the leader key to <space> | |
nnoremap <space> <nop> | |
let mapleader="\<space>" |
To make vim the default editor when you use the sudoedit
command:
sudo update-alternatives --config editor
Then choose Vim from the command line.
To install apache:
sudo apt install apache2
If you want users to be able to have personal websites running out of the public_html
folder in their home directory:
sudo a2enmod userdir
The server will then have main website in /var/www/
and each user will be able to set up their own accessible via http://servername/~username/
Next, install a firewall:
sudo apt install ufw
sudo ufw allow OpenSSH
sudo ufw enable
If you are planning to run a web server:
sudo ufw allow http
sudo ufw allow https
This will protect all the ports except the ones you allow.
To configure a print server install the cups
package:
sudo apt install cups
Note that CUPS requires Apache to run the web based UI.
If you’re running headless, you will need to allow remote administration:
sudo cupsctl --remote-admin --remote-any --share-printers
Also, add yourself to the lpadmin
group:
sudo usermod -aG lpadmin username
Finally restart CUPS:
sudo /etc/init.d/cups restart
This should allow you to log into the web UI on port 631
and add any printers you need.