Package management

https://help.ubuntu.com/community/AptGet/Howto

Ubuntu comparison of apt-get vs. yum commands

# show installed packages
dpkg --list

# show info for a package
dpkg --status package_name

# show files owned by a package
dpkg --listfiles package_name

# resynchronize the package index files from their sources
apt-get update

# install the newest versions installed packages
apt-get upgrade

# install packages that are "kept back"
apt-get dist-upgrade

# for clearing out unused linux-headers, for example
apt-get autoremove

# search for packages with a given string (i.e. json)
apt-cache search json

apt-get dist-upgrade

"-y Assume Yes to all queries and do not prompt" is not recommended for apt-get dist-upgrade

http://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it

http://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade

User management

useradd -m myuser -s /bin/bash

https://help.ubuntu.com/community/AddUsersHowto

Shutdown and restart

poweroff

reboot

Change default $EDITOR from nano to vim

update-alternatives --config editor

Choose "vim.basic".

Give user sudo access

newuser    ALL=(ALL:ALL) ALL

or

newuser    ALL=NOPASSWD: ALL

https://www.digitalocean.com/community/tutorials/how-to-add-delete-and-grant-sudo-privileges-to-users-on-a-debian-vps

iptables

# so that firewall rules load at boot
apt-get install iptables-persistent
# edit rules
vim /etc/iptables/rules.v4 
# reload rules
iptables-restore < /etc/iptables/rules.v4
# save rules
invoke-rc.d iptables-persistent save

Sample iptables firewall rules

root@server2:~# cat /etc/iptables/rules.v4
# Generated by iptables-save v1.4.21 on Wed Oct 14 22:17:08 2015
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [72:34181]
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -j DROP
COMMIT
# Completed on Wed Oct 14 22:17:08 2015
root@server2:~#

https://help.ubuntu.com/community/IptablesHowTo

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04

Apache httpd

sudo apt-get install apache2

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts

MySQL

sudo apt-get install mysql-server

https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial


Home | About | Sitemap | Recent changes | © 2017 Philip Durbin | @philipdurbin | philipdurbin@gmail.com