User Tools

Site Tools


software:linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software:linux [2015/08/17 15:10] – [APT and packages] Michele Porellisoftware:linux [2021/12/06 10:54] (current) – [Quick HTTP server] Michele Porelli
Line 11: Line 11:
 # apt-get clean ; apt-get update ; exit</code> # apt-get clean ; apt-get update ; exit</code>
   * [[http://www.torino19.org/mike/pool/apt/fixgpgkeys|script]] to fix GPG keys errors   * [[http://www.torino19.org/mike/pool/apt/fixgpgkeys|script]] to fix GPG keys errors
-  * Manual remove of a package +  * Manual remove of a package (last resort!!) 
-  - First try:<code>dpkg -P --force-all nagios-common</code> +  - The cleanest way to remove the package is:<code>dpkg -P --force-all nagios-common</code> 
-  - If still no joy:<code>List the package contents and take a note of this list+  - If the process fails:<code>List the package contents and take a note of this list
 $ dpkg -L nagios-common $ dpkg -L nagios-common
  
Line 27: Line 27:
 to finish up, remove all files you found previously with 'dpkg -L'</code> to finish up, remove all files you found previously with 'dpkg -L'</code>
   * [[http://snipplr.com/view/13856/remove-all-rc-files-as-listed-in-dpkg/| Remove remaining configuration of all packages uninstalled]]   * [[http://snipplr.com/view/13856/remove-all-rc-files-as-listed-in-dpkg/| Remove remaining configuration of all packages uninstalled]]
 +    * <code>apt list | grep 'residual-config'</code>
 +    * <code>sudo aptitude purge ~c</code>
   * [[http://www.linuxcertif.com/man/1/dlocate/|dlocate]] is a really useful software to find which installed package provide a file on your system   * [[http://www.linuxcertif.com/man/1/dlocate/|dlocate]] is a really useful software to find which installed package provide a file on your system
   * [[http://alioth.debian.org/projects/cruft/|cruft]] search for orphans files (not unpacked by dpkg)   * [[http://alioth.debian.org/projects/cruft/|cruft]] search for orphans files (not unpacked by dpkg)
Line 35: Line 37:
   * [[http://www.skype.com/intl/it/get-skype/on-your-computer/linux/downloading.debian64|Skype 64bit]] for Debian   * [[http://www.skype.com/intl/it/get-skype/on-your-computer/linux/downloading.debian64|Skype 64bit]] for Debian
 ==== How-Tos ==== ==== How-Tos ====
-  * [[software:linux:debianleprimecosedafare|Debian - Le prime cose da fare]] - My guide written for new Debian users (Available only in italian)+  * [[software:linux:debianleprimecosedafare|Debian - Le prime cose da fare]] - My guide written for new Debian users (Available only in italian and really outdated)
   * [[http://guide.debianizzati.org/index.php/Indice_Guide|Guide di Debianizzati.org]] - A lot of guides for Debian (available only in italian)   * [[http://guide.debianizzati.org/index.php/Indice_Guide|Guide di Debianizzati.org]] - A lot of guides for Debian (available only in italian)
   * [[http://netstudent.polito.it/wiki/index.php/HowTo_Debian_Encrypted_Root|Debian encrypted root]] - (Available only in italian)   * [[http://netstudent.polito.it/wiki/index.php/HowTo_Debian_Encrypted_Root|Debian encrypted root]] - (Available only in italian)
Line 43: Line 45:
     nautilus -q     nautilus -q
     Alt-F2 -> nautilus</code>     Alt-F2 -> nautilus</code>
 +  * Fix Debian annoying locales problems: [[http://codetheory.in/fixing-locale-warnings-notices-issues-on-linux-server-or-desktop/|1]], [[https://fruit.je/utf-8|2]], [[http://perlgeek.de/en/article/set-up-a-clean-utf8-environment|3]], [[http://www.linuxquestions.org/questions/blog/bittner-195120/remove-unwanted-locales-on-ubuntu-debian-3281/|4]]
   * Configure PulseAudio: (NOTE: Wheezy is pulseaudio ready, this guide is Debian >=6.x only)   * Configure PulseAudio: (NOTE: Wheezy is pulseaudio ready, this guide is Debian >=6.x only)
     - INSTALL PULSEAUDIO<code># aptitude install pulseaudio pulseaudio-module-gconf     - INSTALL PULSEAUDIO<code># aptitude install pulseaudio pulseaudio-module-gconf
Line 68: Line 71:
 search "ao=alsa" and replace it with "ao=pulse"</code> search "ao=alsa" and replace it with "ao=pulse"</code>
   * To automatically mount NFS shares at boot time put in /etc/default/rcS<code>ASYNCMOUNTNFS="no"</code>   * To automatically mount NFS shares at boot time put in /etc/default/rcS<code>ASYNCMOUNTNFS="no"</code>
 +  * [[https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Buster%20Root%20on%20ZFS.html|Install Debian Buster using ZFS as RootFS]]. If you face problems with the rootfs not being found, you may want to increase the sleep time in initrd [[https://forum.proxmox.com/threads/failed-to-import-rpool-on-bootup-after-system-update.37884/post-273229|as described here]].
 ===== Kernel related ===== ===== Kernel related =====
   * [[http://www.makelinux.net/kernel_map/|Interactive kernel map]]   * [[http://www.makelinux.net/kernel_map/|Interactive kernel map]]
- 
   * [[http://www.linux-tutorial.info/modules.php?name=Howto&pagename=Linux-i386-Boot-Code-HOWTO/makefiles.html|Linux's makefiles]]   * [[http://www.linux-tutorial.info/modules.php?name=Howto&pagename=Linux-i386-Boot-Code-HOWTO/makefiles.html|Linux's makefiles]]
   * [[http://www.codeguru.com/forum/archive/index.php/t-415186.html|Convert vmlinuz to vmlinux]]   * [[http://www.codeguru.com/forum/archive/index.php/t-415186.html|Convert vmlinuz to vmlinux]]
Line 107: Line 109:
 ==== Quick DHCP server ==== ==== Quick DHCP server ====
 <code>sudo dnsmasq -i eth0 -d --dhcp-range=192.168.89.90,192.168.89.100</code> <code>sudo dnsmasq -i eth0 -d --dhcp-range=192.168.89.90,192.168.89.100</code>
 +==== Quick HTTP server ====
 +<code>python -m SimpleHTTPServer 8000
 +python3 -m http.server 8080</code>
 +
 +==== Quick FTP server ====
 +<code>python -m pyftpdlib -p 2121</code>
 ===== Useful commands ===== ===== Useful commands =====
   * [[http://www.webupd8.org/2009/06/16-top-like-linux-apps-commands.html|List of 16 top-like commands]] to monitor network/system/hdd/ecc...   * [[http://www.webupd8.org/2009/06/16-top-like-linux-apps-commands.html|List of 16 top-like commands]] to monitor network/system/hdd/ecc...
   * [[http://ubuntuforums.org/showthread.php?t=869801&page=2|Change UUID of a NTFS partition]]   * [[http://ubuntuforums.org/showthread.php?t=869801&page=2|Change UUID of a NTFS partition]]
   * [[http://linuxaria.com/howto/7-hidden-features-of-bash?lang=it#|7 bash <del>hidden</del> not well known features]] - (Available only in Italian)   * [[http://linuxaria.com/howto/7-hidden-features-of-bash?lang=it#|7 bash <del>hidden</del> not well known features]] - (Available only in Italian)
 +  * [[http://man7.org/linux/man-pages/man1/fallocate.1.html|fallocate - preallocate or deallocate space to a file (Immediately!)]]
   * Scheduled shutdown/hibernate<code># shutdown -h +X     # X = minutes to wait before shutdown   * Scheduled shutdown/hibernate<code># shutdown -h +X     # X = minutes to wait before shutdown
 # shutdown -h 23:20     # 23:20 = hh.mm, system wait until system clock is 22.30 then shutdown # shutdown -h 23:20     # 23:20 = hh.mm, system wait until system clock is 22.30 then shutdown
Line 126: Line 135:
   * [[http://developer.gnome.org/autostart-spec/|Autostart at login]] - Official specification (works with GNOME/KDE)   * [[http://developer.gnome.org/autostart-spec/|Autostart at login]] - Official specification (works with GNOME/KDE)
   * [[https://groups.google.com/forum/?fromgroups=#!topic/google-labs-picasa-for-linux/5zCxxzAx7Xo|Fix Picasa freezes after opening "Places" tab]]   * [[https://groups.google.com/forum/?fromgroups=#!topic/google-labs-picasa-for-linux/5zCxxzAx7Xo|Fix Picasa freezes after opening "Places" tab]]
-  Guides ([[http://linuxconfig.org/linux-authentication-login-with-usb-device|1]], [[https://mattmole.wordpress.com/2008/04/28/authenticate-using-usb/|2]]) to use an USB drive as login token Consider [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=669637|my patch]] to use an SD Card in order to not waste an USB port :)+ 
 +==== Reverse dynamic proxy ==== 
 +  <code>ssh remoteuser@remotehost -R forwardedsshport:localhost:localsshport -t "ssh -D dynamicproxyport localuser@localhost -p forwardedsshport"</code> 
 + 
 +==== Authenticate with USB/SD device with automatic lock/unlock - libpam-usb ==== 
 +This is based on [[http://linuxconfig.org/linux-authentication-login-with-usb-device|1]], [[https://mattmole.wordpress.com/2008/04/28/authenticate-using-usb/|2]] and some stuffs found on the net. The following steps assumes that your using a Debian based distro with Gnome as DM. 
 +  Install libpam-usb package<code>$ sudo apt-get install libpam-usb</code> 
 +  - Add support for SD cards readers with [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=669637|my patch]] in order to not waste an USB port :) 
 +  - Plug-in your device and create a new token<code>$ sudo pamusb-conf --add-user YOURUSER</code> 
 +  - Add pamusb-agent to your startup applications<code>$ echo "[Desktop Entry] 
 +Name=pamusb-agent 
 +GenericName=PAM USB Auth 
 +Exec=/usr/bin/pamusb-agent 
 +Terminal=false 
 +Categories=Tools 
 +Type=Application 
 +StartupNotify=false 
 +X-GNOME-Autostart-enabled=true" > ~/.config/autostart/pamusb-agent.desktop</code> 
 +  - Change automated actions<code>$ sudo vi /etc/pamusb.conf 
 + 
 +Look for the row containing <user id="YOURUSER"> and append before </user> the following lines 
 +                        <agent event="lock">dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock</agent> 
 + <agent event="unlock">dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call --print-reply --reply-timeout=20000 /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:false</agent> 
 +</code> 
 +  - Logout/login and see the magic happen :) 
 ==== Fixed (and automatically) mountpoint for external drives ==== ==== Fixed (and automatically) mountpoint for external drives ====
   - Edit your fstab specifying UUID, mountpoint and options (including "auto")   - Edit your fstab specifying UUID, mountpoint and options (including "auto")
Line 232: Line 266:
   - Connect to server<code>$ ssh user@ip_server -L 1900:ip_vm:1900</code>   - Connect to server<code>$ ssh user@ip_server -L 1900:ip_vm:1900</code>
   - Then connect to your VM<code>$ ssh user@ip_vm</code>   - Then connect to your VM<code>$ ssh user@ip_vm</code>
-  - Start the listener<code>$ tar zc * | nc -l 190</code>+  - Start the listener<code>$ tar zc * | nc -l 1900</code>
   - Open a new terminal and start the receiver<code>nc localhost 1900 | tar zx</code>   - Open a new terminal and start the receiver<code>nc localhost 1900 | tar zx</code>
  
 +==== Copy a big amount of data as fast as possible ====
 +  * <code>tar cpf - . | pv | (cd /dst; tar xf -)</code>
 +==== Add a disk to extend a LVM logical volume ====
 +  - Mark your disk/partition as LVM<code># pvcreate /dev/sdX</code>
 +  - Extend the VolumeGroup containing your logical volume<code># vgextend VolGroup00 /dev/sdX</code>
 +  - Extend the logical volume<code># lvextend -l +100%FREE /dev/VolGroup00/LogVol02</code>
 +  - Extend the filesystem<code># resize2fs /dev/VolGroup00/LogVol02</code>
software/linux.1439817002.txt · Last modified: 2015/08/17 15:10 by Michele Porelli