more ubuntu tips
[wiki.git] / ubuntu.mdwn
1 [[!toc levels=99]]
2
3 ## Package management
4
5 https://help.ubuntu.com/community/AptGet/Howto
6
7 [Ubuntu comparison of apt-get vs. yum commands](https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux/RedHatEnterpriseLinuxAndFedora)
8
9     # show installed packages
10     dpkg --list
11
12     # show info for a package
13     dpkg --status package_name
14
15     # show files owned by a package
16     dpkg --listfiles package_name
17
18     # resynchronize the package index files from their sources
19     apt-get update
20
21     # install the newest versions installed packages
22     apt-get upgrade
23
24     # install packages that are "kept back"
25     apt-get dist-upgrade
26
27     # for clearing out unused linux-headers, for example
28     apt-get autoremove
29
30     # search for packages with a given string (i.e. json)
31     apt-cache search json
32
33 ### `apt-get dist-upgrade`
34
35 "-y  Assume Yes to all queries and do not prompt" is not recommended for `apt-get dist-upgrade`
36
37 http://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it
38
39 http://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade
40
41 ## User management
42
43     useradd -m myuser -s /bin/bash
44
45 https://help.ubuntu.com/community/AddUsersHowto
46
47 ## Shutdown and restart
48
49     poweroff
50
51     reboot
52
53 ## Change default $EDITOR from nano to vim
54
55     update-alternatives --config editor
56
57 Choose "vim.basic".
58
59 ## Give user sudo access
60
61     newuser    ALL=(ALL:ALL) ALL
62
63 or
64
65     newuser    ALL=NOPASSWD: ALL
66
67 https://www.digitalocean.com/community/tutorials/how-to-add-delete-and-grant-sudo-privileges-to-users-on-a-debian-vps
68
69 ## iptables
70
71 https://help.ubuntu.com/community/IptablesHowTo
72
73 https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04
74
75 ## Apache httpd
76
77     sudo apt-get install apache2
78
79 https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
80
81 ## MySQL
82
83     sudo apt-get install mysql-server
84
85 https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial