Friday, February 27, 2009

Ubuntu / Debian Survival Kit


  • Install / Packages 
    • instal .deb
      • sudo dpkg -i nomachine_5.1.26_1_amd64.deb
    • install LAMP on a fresh Ubuntu
    sudo tasksel install lamp-server
    • If you want to use the "Gnome classic" desktop instead of Unity from Ubuntu 14:
    sudo apt-get install gnome-session-fallback then reboot, and you will get the gnome icon in the user login part
    • Font: FreeSans 16 is not bad for firefox
    • dpkg -l |grep emacs (list installed packages)
    • alien (package conversions: rpm, tgz, etc). Usually not working for me when trying to convert Debian packages
    • To install a Debian package (read dpkg before, since it can mess up your config)
      sudo dpkg -i mysql-workbench-gpl-5.2.33b-1ubu1010-amd64.deb
    • aptitude install mysql-workbench
    • search:
      • apt-cache search libtool
      • or aptitude search libtool
  • Network
    • ip adress   (ifconfig is obsolete, see "ip" command)
    • restart network interface:
      • ifdown eth0
      • ifup eth0
    • Network, command line (dhcp/static)
      sudo vi /etc/network/interfaces
    • If your network is disabled, first right click on the network icon and enable connections (sometimes these get disabled at reboot)
    • NetworkManager
    • look at your /etc/resolv.conf, the first line will tell you if the network management of your machine is done through the NetworkManager server. You need to start it in case of failure: sudo /etc/init.d/network-manager restart The other network management way is sudo /etc/init.d/networking
    • If your IP is static, you need to specify your DNS servers manually
      /etc/resolv.conf, should look like this:
      search mydomain.example
      nameserver 212.27.40.254
    • # dns google nameserver 8.8.8.8 Note that resolv.conf is overwritten with another dns nameserver when going through DHCP
      To know what is the dns of a specific network interface
      nmcli device show eth0
    • Network config:
      sudo apt-get install gnome-network-admin
      network-admin (do not use sudo, otherwise, everything is grayed out)
      sudo /etc/init.d/networking restart
      (you need to use this command when you go on standby and come back on, the networking get a new IP address throuch DHCP in this case)
    • WIFI
      • To use WIFI, you need to stop firestarter. So better stop apache and samba also while you use WIFI. RPCbind port 111 remains open. If you really want to close this port too (you don't have to):
        /etc/init.d/portmap stop
      • Also, at some point NetworkManager was not working anymore, not sure why. I could not use WIFI anymore. I installed wicd and it worked fine. Useful commands to trouble shoot WIFI on Ubuntu are:
        lshw, sudo iwlist scan
        Note that when login identification is required on a web site, the WIFI connection will show alternate "connected"/"disconnected" on wicd until you login.
        wicd 1.7.0 shows "wrong password" for WPA2 (Ubuntu 10.04 LTS). Seems working with wicd 1.6. Just use the regular wifi icon on the tray.
      • wifi not working after Ubuntu suspend
        • sudo nmcli nm sleep false
      • list wifi connections
        • sudo nmcli dev wifi list
    • firewall: "sudo firestarter"
    • When using wireshark, do not forget to use sudo, otherwise, it does not see any network interface. There is no snoop on ubuntu
    • tcpdump -n -A -p -i lo host 127.0.0.1 and port 8086
    • tcpdump -n -A -p -i eth0  host 192.168.0.202 and port 8080 |grep GET
    • tcpdump -n -A -p -i lo host 127.0.0.1 and dst port  8080
    • tcpdump -n -A -p -i eth0 host 192.168.0.195 and port 12501 |grep kWords --color=auto
    • tcpdump -n -A -p -i eth0 host 192.168.4.101 and port 12560 |grep kWords --color=auto
    • sudo tcpdump -n -A -p -i bond1  host   10.64.113.173 and port 8080 |grep GET
    • tcpdump -n -A -p -i em2  host 192.168.4.188 and port 8384 |grep solr
    • tcpdump -n -A -p -i em1 |grep 10\.1\.65\.208
    • (proxy / threesint2) tcpdump -n -A -p -i bond1  host 10.64.114.35 and port 8080 |grep GET              (can be run from threesint2, not from docker)
    • [proxy vv157]# tcpdump -n -A -p -i eth1  host  10.64.115.157 and port 8080 |grep "siteId=" --color
    • some packets are filtered by tcpdump (local machine)

  • Flush RAM / Clear memory cache
    x14:/data/data_ref/DE# echo "1" > /proc/sys/vm/drop_caches
    x14:/data/data_ref/DE# echo "0" > /proc/sys/vm/drop_caches
    x14:/data/data_ref/DE# free -m

  • Config / Settings / Display
    • Need a .profile file to specify to exec .bashrc See dot files
    • compiz settings:  sudo ccsm &
    • BUG Ubuntu: "Display settings" not taken into account when using nvidia driver:
      • pkill -9 -f gnome-settings-daemon
  • Services
    • sudo service "equivalent to" sudo /etc/init.d/serviceName (start|stop|rerstart)
    • see /etc/inetd.conf : services made available by this machine over the net - see System/Administration/Services to disable samba for example
    • dpkg -S /sbin/init   - is either "upstart" or  "systemd"
      • systemd => /etc/init.d
      • upstart => /etc/init
    • service --status-all
    • initctl list
    • remove a service started at boot time
      • update-rc.d -f  hbase-master  remove
      • see also    "ls -al /etc/rc*.d/"
    • some services (updatedb / mlocate) are started from
      • /etc/cron.daily     (/etc/cron.*)
      • the way to disable this services seems to be:
        • /etc/cron.daily#   chmod -x mlocate
  • version
    cat /etc/lsb-release
    cat /etc/issue

  • CPU temperature
    • "sensors" to get processor temperature
    • The following gets the BIOS info but the system freezes shortly after that:
      - "sudo modprobe i8k force=1" to be able to use i8kctl on vostro. A folder /proc/i8ctl is created (and disappear after reboot). Seems disabled after reboot.
      - "i8kctl" to display infos
  • boot
    • /etc/rc.local
    • /etc/fstab for boot time mounts
  • To mount a remote directory on my machine:
    vi /etc/fstab (add the my_folder line)
    mkdir /mnt/my_folder
    ln -s /mnt/my_folder /my_folder
    mount -a
    df
    exportfs
  • alias
    alias h='history 50'
    alias l.='ls -ald .*'
    alias ll='ls -l'
    alias ls='ls --color=auto'
  • To get colors when using vi
    • apt-get install vim
  • To acces an NT machine file system
    from the "Places" Ubuntu file explorer:
    smb://192.168.0.22/
  • unmount Sony-Ericsson:
    sudo eject /media/PHONE
  • If mouse and keyboard are frozen at login
    sudo apt-get update
    sudo reboot
    or plug a USB mouse
  • alsa force-reload       (restart audio device)
.

No comments: