Table of Contents

Ubuntu Post Install

The purpose of this guide is to install a number of useful software for various reasons are not included in the official version. The version used in this guide is referred to ubuntu 64-bit.

Ubuntu ISO

Ubuntu Check-List

Ubuntu Search Engine

Install - Update - Upgrade

Update e Upgrade

Automatic Update e Upgrade

apt-get update --yes
apt-get upgrade --yes
apt-get install gnome-panel gnome-session-fallback --yes
apt-get install dconf-tools --yes
apt-get install ubuntu-restricted-extras --yes
apt-get install libxine1-ffmpeg --yes
apt-get install iotop --yes
apt-get install vpnc --yes
apt-get install filezilla --yes
apt-get install ssh --yes
apt-get install gnome-commander libgnomevfs2-extra gksu --yes
apt-get install apache2 php5 --yes
add-apt-repository ppa:ubuntu-wine/ppa --yes
apt-get update --yes
apt-get install wine1.5 --yes
firefox https://www.google.com/intl/en/chrome/browser/
dpkg-reconfigure keyboard-configuration

Configuring Proxy

System – Preferences – Network Proxy

Install Ubuntu from USB

sudo apt-get install unetbootin

Update Ubuntu Version every 6 mouths

sudo update-manager -d

Ubuntu Latest Update

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Gestione Pacchetti

Ricercare i pacchetti nei repository che contengono una determinata parola chiave

apt-cache search <Key>
sudo dpkg --list | grep <Key>

Visualizzare tutte le informazioni disponibili di un pacchetto

apt-cache show <Package>
apt-cache showsrc <Package>

Visualizzare il contenuto di un pacchetto

dpkg-deb -c <Package>
Es: dpkg-deb -c /var/cache/apt/archives/vpnc_0.5.1r275-1ubuntu1_amd64.deb

Estrarre il contenuto di un pacchetto

dpkg-deb -X <name.deb> <name> 

Visualizzare l'architettura del proprio sistema

 dpkg --print-architecture

Rimuovere un pacchetto dal sistema compresi i suoi file di configurazione

sudo apt-get --purge remove <Package>

Rimuovere i pacchetti gia` installati

du -sh /var/cache/apt/archives/
201M	/var/cache/apt/archives/
sudo apt-get clean
du -sh /var/cache/apt/archives/
24K	/var/cache/apt/archives/

Estrarre la lista pacchetti gia` installati

dpkg --get-selections > ~/listapacchetti.txt

Risolvere il problema the public key is not available

W: GPG error: http://ppa.launchpad.net precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9A06AEF9CB8DB0

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5A9A06AEF9CB8DB0
<code>

=== Installare Alien - Pacchetti Fedora su Debian ===

  sudo apt-get install alien

=== Abilitare l'utente www-data per Amministrazione Web ===

  sudo apt-get install sux
  sudo -s
  sudo passwd www-data
  Digitate la password:
  exit

  sux - www-data
  Digitate la password:

  Ora si possono lanciare anche i programmi che usano Gtk.

  

==== Utility S.O. ====

=== Install Gnome Classic - Gnome Fallback  ===

  sudo apt-get install gnome-panel gnome-session-fallback
  sudo reboot

=== Set Root Password ===

  sudo passwd root

  To get root privilege:
  
  sudo -s

=== Restart X Server with [Ctrl] + [Alt] + [Backspace]  ===

  sudo aptitude install dontzap
  sudo dontzap –enable
  sudo dontzap -e
  sudo dontzap -d

  or

  setxkbmap -option terminate:ctrl_alt_bksp

  or

  [ALT]+[F2] gksudo killall Xorg


=== Changing the menu buttons positions  ===

  Prima di ubuntu 11.10:
  gconf-editor
  Andare al parametro : apps --> metacity --> general --> button_layout
  Inserire il seguente valore:
  :minimize,maximize,close

  Dopo ubuntu 11.10 in ubuntu classic:
  sudo apt-get install gconf-editor
  gconf-editor
  Andare al parametro : apps --> metacity --> general --> button_layout
  Inserire il seguente valore:
  menu:minimize,maximize,close

  Dopo ubuntu 11.10 in ubuntu shell ( Gnome3 ):
  sudo apt-get install gconf-editor
  gconf-editor
  Andare al parametro : desktop --> gnome --> shell --> windows --> button_layout
  Inserire il seguente valore:
  :minimize,maximize,close

  Ubuntu 12.10 - 13.04 - 13.10 - 14.04 
  apt-get install dconf-tools
  With user asdf run:
  gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'


=== Gnome Shell Version  ===

  gnome-shell --version
  

=== Inserire show desktop applet in Gnome Classic  ===

  <alt> + <right click mouse> --> add to panel --> choose show desktop applet

  ubuntu 12.10:
  <windows> + <alt> + <riht click mouse>

=== Rimuovere Item dal Context Menu  ===

  cancellare il rispettivo file.desktop che in genere si trova nelle seguenti directory:
  ~/.local/share/applications
  /usr/share/applications
  ecc..
  Eseguire la seguente ricerca per trovare tutti i files in tutte le directory:
  sudo find / -name *.desktop >desktop.txt

=== Formattare la chiavetta USB vergine o corrotta ===

  Se non formattata o invalida occorre utilizzare gparted per creare la partition table:
  gparted /dev/sdg


=== Formattare la chiavetta USB con un file system ext3 ===


  Individuare il nome del device: es: /dev/sdg1  e smontarlo e formattarlo:
  sudo umount /dev/sdg1
  sudo mkfs.ext3 /dev/sdg1

=== Formattare la chiavetta USB con un file system vfat ( Windows Fat ) ===

  Individuare il nome del device: es: /dev/sdg1  e smontarlo e formattarlo:
  sudo umount /dev/sdg1
  sudo mkfs.vfat /dev/sdg1

===== Drivers =====

==== Hardware ====

=== Hardware Gui ===

  sudo apt-get install lshw-gtk
  gksudo lshw-gtk


=== Keyboard Configuration ===

  dpkg-reconfigure keyboard-configuration

==== Driver Schede Video ====

=== Installare i driver NVidia con il supporto al rendering OpenGL ===

  sudo apt-get install nvidia-current

=== Installare i driver ATI Catalist con il supporto al rendering OpenGL ===

Sui vecchi portatili:
<code>
sudo apt-get install fglrx-updates

Sulle nuovissime schede video occorre ricompilare l'ultimo driver:

-) Removing (purging) existing drivers:
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*

-) Install these dependencies:
sudo apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 dh-modaliases

-) For 64-bit Only
sudo apt-get install lib32gcc1 libc6-i386

-) Installing the lastest ATI/AMD driver. Work for "Cape Verde XT [Radeon HD 7770 GHz Edition] [1002:683D]"
Download with Firefox the beta driver: http://support.amd.com/en-us/download

mkdir temp
cd temp
cp ../Downloads/amd-catalyst-13.11-beta-v9.4-linux-x86.x86_64.run.zip .
unzip amd-catalyst-13.11-beta-v9.4-linux-x86.x86_64.run.zip
sudo sh *.run --buildpkg Ubuntu/saucy
sudo dpkg -i *.deb
sudo aticonfig --initial

fglrxinfo
display: :0.0  screen: 0
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD CAPE VERDE
OpenGL version string: 1.4 (2.1 Mesa 9.2.1)

reboot

fglrxinfo
display: :0.0  screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 7700 Series  
OpenGL version string: 4.3.12614 Compatibility Profile Context 13.25.18

Ritornare alla risoluzione iniziale dopo aver lanciato i giochi con Wine

xrandr -s 0

Configurare nuove risoluzioni video

>cvt 1104 800
# 1104x800 59.75 Hz (CVT) hsync: 49.65 kHz; pclk: 71.50 MHz
Modeline "1104x800_60.00"   71.50  1104 1160 1272 1440  800 803 813 831 -hsync +vsync
>xrandr | grep " connected"
DVI-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
>xrandr --newmode "1104x800_60.00"   71.50  1104 1160 1272 1440  800 803 813 831 -hsync +vsync
>xrandr --addmode DVI-0 1104x800_60.00 

res_1600x900.ksh:

cvt 1600 900
xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
xrandr --addmode VGA1 "1600x900_60.00"

Open startup applications and click “ADD”. Give a name and type in the command line /home/asdf/res_1600x900.ksh click save. The change appears after you log out and log in.

Supporto Bluetooth

Installare il supporto Bluetooth

sudo apt-get install gnome-vfs-obexftp
sudo apt-get install bluetooth nautilus-sendto bluez-gnome gnome-bluetooth

Supporto WIFI

Installare e configurare la rete Wireless con Wicd

sudo apt-get install wicd
oppure per le vecchie versioni:
Questi sono alcuni comandi per reperire informazioni sul nostro sistema wireless
dmesg | grep -i -e wlan  -e eth1 -e 8185 -e ipw2200 -e 80211
lspci
lsusb
lshw -C network
iwconfig
iwlist wlan0 scan
Iniziamo la configurazione:
sudo cp /etc/network/interfaces /etc/network/interfaces.old
sudo >/etc/network/interfaces
vi /etc/network/interfaces
Inserire solo le righe:
auto lo
iface lo inet loopback
e salvare ed uscire
Ora configurare il repository :
Administration --> Synaptic Package Manager --> Settings --> Repositories --> Third Party Software --> Add 
aggiungere: deb http://apt.wicd.net feisty extras
Cliccare Reload
Cercare il pacchetto Wicd, selezionarlo ed installarlo
Installiamo la tray icon da menu:
System --> Preferences --> Sessions --> Startup Programs --> New --> Name Wicd 
--> Command --> /opt/wicd/ tray.py
Lanciare da menu Gnome Wicd e' configurare da interfaccia grafica la connessione Wireless.

Driver Monitor

Installare la definizione hardware del proprio Monitor, partendo dal file inf per Windows

wget http://fr.archive.ubuntu.com/ubuntu/pool/main/k/kde-guidance/guidance-backends_0.8.0svn20080103-0ubuntu16_amd64.deb
sudo dpkg -i --force-all guidance-backends_0.8.0svn20080103-0ubuntu16_amd64.deb
wget http://fr.archive.ubuntu.com/ubuntu/pool/main/d/displayconfig-gtk/displayconfig-gtk_0.3.10_all.d
sudo dpkg -i --force-all displayconfig-gtk_0.3.10_all.deb
wget http://88.38.80.62/Monitor/L70B/L70B.inf ( file di configurazione di windows del proprio Monitor )
gksudo displayconfig-gtk
click su Model -->  Add --> Import ( selezionare il file .inf )

Display Resolution Overscan Issue Resolved

cvt 1200 960
xrandr --newmode "1280x960_60.00"  101.25  1280 1360 1488 1696  960 963 967 996 -hsync +vsync
xrandr --addmode VGA1 "1280x960_60.00"
sleep 6
xrandr --output VGA1 --fb 1200x900
sleep 6
xrandr --output VGA1 --fb 1280x960

Improve overall system performance

Install Preload

sudo apt-get install preload

Setting home to shared memory

Before user asdf login:
ALT-F2
user root
rsync -av /home/ /run/shm
mount --bind  /run/shm/asdf /home/asdf
chmod 1777 /dev/shm
and login as usual with asdf user

Monitoring IO

sudo apt-get install iotop

Mount/Format

Mount Partition/ISO

Montare le partizioni Windows/Linux

sudo blkid
sudo fdisk -l
cd /mnt
mkdir win_c
aggiungere nel file /etc/fstab la seguente riga:
/dev/sda1               /mnt/win_c              auto umask=0,iocharset=iso8859-15,codepage=850 0 0
reboot

Montare i file ISO e renderli disponibili sul Desktop

 cd /media
 sudo mkdir iso
 sudo mount file.iso /media/iso/ -t iso9660 -o loop

Montare i file HTTP con Fuse

sudo apt-get install httpfs2
mkdir ~/test
httpfs2 http://rkpisanu.altervista.org/wdtv/Hello.flv ~/test
vlc ~/test/Hello.flv

Convertire i file uif in iso

sudo apt-get install uif2iso

Convertire i file CloneCD img in iso

sudo apt-get install ccd2iso
ccd2iso foo.img foo.iso

Recovery NTFS

Recuperare i file cancellati per errore su partizioni NTFS

sudo apt-get install ntfsprogs
sudo umount /dev/sdb2
sudo ntfsundelete /dev/sdb2
sudo ntfsundelete /dev/sdb2 -s -m "*.avi"
sudo mount /dev/sdb2

Format

Formattare un CD RW

sudo apt-get install cdrecord
Per visualizzare l'elenco dei masterizzatori installati:
wodim --devices
Per cancellare un cd rw:
cdrecord blank=fast dev=/dev/scd0
Per formattare un cd rw:
cdrecord blank=all dev=/dev/scd0

Motd

sudo apt-get install figlet
figlet Welcome

Multimedia

Install Restricted Support

Install support for mp3,divx,etc.. files

sudo apt-get install ubuntu-restricted-extras
sudo apt-get install libxine1-ffmpeg ffmpeg

Install support for Commercial DVD

sudo /usr/share/doc/libdvdread3/install-css.sh
sudo /usr/share/doc/libdvdread4/install-css.sh ( Ubuntu 12.10 - 13.04 )
sudo apt-get install regionset
1 North America (USA and Canada)
2 Europe, Middle East, South Africa and Japan
3 Southeast Asia, Taiwan, Korea
4 Latin America, Australia, New Zealand
5 Former Soviet Union (Russia, Ukraine, etc.), rest of Africa, India
6 China

Install Flash Browser Support

sudo apt-get install flashplugin-installer

or download tar

http://get.adobe.com/flashplayer/
su
cd /home/asdf/Downloads/
tar xvfz install_flash_player_11_linux.x86_64.tar.gz 
cp libflashplayer.so /usr/lib/mozilla/plugins/ 

Install Non-Restricted Support

Install EPub Support

sudo apt-get install calibre

Masterizzazione

Installare il software per la masterizzazione CD-DVD con il supporto masterizzazione diretta mp3

sudo apt-get install k3b
sudo apt-get install libk3b2-extracodecs

Installare il software per la masterizzazione CD-DVD Nero

http://www.nero.com/eng/downloads-linux4-update.php
wget ftp://ftp5.usw.nero.com/PUB/291ff554f0f0069b34e5614bed96d081/nerolinux-4.0.0.0-x86_64.deb
sudo dpkg -i nerolinux-*.deb

Video Editor

Installare AviDemux, Clone di Virtualdub

sudo apt-get install avidemux

Installare DeVeDe, per creare video DVDs e CDs (VCD, sVCD or CVD)

sudo apt-get install devede

Installare DVDAuthor, per creare propri DVD

sudo apt-get install dvdauthor qdvdauthor
Creare la shell make_dvd.ksh che implementa xml da dare in pasto a dvdauhtor
partendo da file mpeg contenuti nella directory corrente:

vi ./make_dvd.ksh 
echo "<dvdauthor>"
echo "    <vmgm />"
echo "    <titleset>"
echo "        <titles>"
let j=2
ls -lt *.mpg | cut -d":" -f2 | cut -d" " -f2 | 
  while read i; 
  do
  echo "            <pgc>"
  echo '                <vob file="'${i}'" chapters="0" />'
  echo '                <post> jump title '${j}'; </post> '
  echo "            </pgc>"
  let j=j+1
  done
echo "        </titles>"
echo "    </titleset>"
echo "</dvdauthor>"
Lanciare il seguente comando:
./make_dvd.ksh >test01.xml

editare manualmente test01.xml nell'ultimo tag jump title ed inserire il numero 1
poi lanciare:
dvdauthor -o . -x test01.xml
che creera' due directory VIDEO_TS e AUDIO_TS
da masterizzare su DVD in formato DVDVideo

SlideShow

Come ruotare di 90 gradi le proprie foto

ls *.jpg | while read i; do jpegtran -rotate 90 "$i" >"$i".jpeg ; done;

Installare Smile Slideshow

sudo apt-get install libqt4-opengl-dev libqt4-dev libqt4-webkit
sudo apt-get install sox libsox-fmt-all
wget http://download.tuxfamily.org/smiletool/smile-0.8.9.tar.gz
tar zxvf smile-0.8.9.tar.gz
cd smile
qmake-qt4 smile.pro
make
./smile

Installare Image2Mpeg Slideshow

sudo apt-get install libmagick9-dev madplay make build-essential libmad0-dev toolame mjpegtools ffmpeg
wget http://www.gromeck.de/uploads/media/image2mpeg-1.02.tar.gz
tar xvfz image2mpeg-1.02.tar.gz 
cd image2mpeg-1.02/
./configure
make
sudo make install

Installare Dvd-Slideshow

wget "http://downloads.sourceforge.net/dvd-slideshow/dvd-slideshow-0.8.2-2_all.deb?modtime=1228435648&big_mirror=0"
sudo dpkg -i dvd-slideshow-0.8.2-2_all.deb
Per creare la Slideshow si procede nel seguente modo:
dir2slideshow -k -p -n 'My Slideshow' -t 5 -c 1 <My Dir Photos>
dvd-slideshow -n 'My Slideshow' -f My_Slideshow.txt -a <Sound.mp3>

Installare Dvd-Baker

Per funzionare correttamente occorre aver installato l'ultima versione di Dvd-Slideshow
wget "http://downloads.sourceforge.net/dvd-baker/dvd-baker_0.7.43-1_all.deb?modtime=1144888663&big_mirror=0"
sudo dpkg -i dvd-baker_0.7.43-1_all.deb
dvd-baker <root dir my photos>
dvdauthor -x "/home/asdf/dvdauthor.xml"

Installare Dvd Slideshow Gui con WINE

mkdir ~/.DVDsGUI0910
cd ~/.DVDsGUI0910
wget http://www.videohelp.com/download/DVDsGUI0910.exe
env $PWD='pwd' WINEPREFIX=$PWD wine DVDsGUI0910.exe 

Editor di Sottotitoli

Installare Subtitle Edit con Wine

sudo apt-get install wine1.3
sudo apt-get install rar wget
mkdir ~/.SE293
cd ~/.SE293
wget http://downloads.sourceforge.net/project/vlc/1.1.4/win32/vlc-1.1.4-win32.exe
wget http://www.kegel.com/wine/winetricks && sudo mv ./winetricks /usr/local/bin && sudo chmod +x /usr/local/bin/winetricks 
env $PWD='pwd' WINEPREFIX=$PWD winetricks dotnet20
env $PWD='pwd' WINEPREFIX=$PWD wine vlc-*.exe
mkdir ./drive_c/SE293/
cd ./drive_c/SE293/
wget http://www.nikse.dk/se/SE293.rar
rar x SE293.rar
cd ~/.SE293 && env $PWD='pwd' WINEPREFIX=$PWD wine ./drive_c/SE293/SubtitleEdit.exe 
exit program SubtitleEdit
sed 's/<VideoPlayer \/>/<VideoPlayer>VLC<\/VideoPlayer>/' Settings.xml > Settings.xml.patch ; cp Settings.xml.patch Settings.xml
To run program: 
cd ~/.SE293 && env $PWD='pwd' WINEPREFIX=$PWD wine ./drive_c/SE293/SubtitleEdit.exe 
Il menu e' nascosto. Per farlo apparire premere [ALT]+[DOWN]

Installare Gnome Subtitles

sudo apt-get install gnome-subtitles

Installare Subtitle Editor

wget http://download.gna.org/subtitleeditor/0.37/subtitleeditor-0.37.1.tar.gz
tar xvfz subtitleeditor-0.37.1.tar.gz 
cd subtitleeditor-0.37.1/
sudo apt-get install autoconf automake bison flex libtool intltool xorg-dev
sudo apt-get install libgtkmm-2.4-dev libglademm-2.4-dev libenchant-dev  libxml++2.6-dev 
sudo apt-get install libgtkmm-2.4 libglademm-2.4 libenchant-dev libenchant1c2a  libxml++2.6-2
sudo apt-get install gstreamer0.10* gstreamer*
./autogen.sh
make
sudo make install
sudo ln -s /usr/local/lib/libsubtitleeditor.so.0.0.0 /usr/lib/libsubtitleeditor.so.0
Lanciare Subtitle Editor da Menu

Installare le utilities tofrodos

sudo apt-get install tofrodos
sudo apt-get install dos2unix
unix2dos <file.srt>

Lettori multimediali

Installare Kaffeine

sudo apt-get install libxine1-ffmpeg kaffeine

Installare SongBird -The Open Music Player

sudo apt-get remove libvisual-0.4-plugins 
wget http://s3.amazonaws.com/download.songbirdnest.com/installer/linux/x86_64/Songbird_1.2.0-1146_linux-x86_64.tar.gz
tar xvfz Songbird*
cd Songbird
./songbird

Installare Videolan

sudo apt-get install vlc

Stream Recorder

Installare Streamripper e Streamtuner

sudo apt-get install streamripper streamtuner 

Midi e Karaoke

Installare il supporto file midi Timidity e Karaoke

sudo apt-get install timidity
sudo apt-get install timidity-interfaces-extra
Interfaccia grafica:
timidity -iatv <file.mid>
timidity -iatv <file.kar>
Interfaccia a carattere:
timidity -Oe <file.mid>
timidity -Oe <file.kar>

Installare vanBasko's Karaoke Player con Wine

mkdir ~/.vkaraoke
cd ~/.vkaraoke
env $PWD='pwd' WINEPREFIX=$PWD winecfg --> WinXP
wget http://www.vanbasco.com/downloads/vkaraoke.exe
env $PWD='pwd' WINEPREFIX=$PWD wine vkaraoke.exe
Tasto destro sulla finestra principale --> Setup --> MIDI --> Output Device --> Selezionare dal
menu a tendina : Timidity - Timidity port 0
Lanciare i file midi di esempio per verificare la corretta installazione

Sequencer

LMMS

sudo apt-get install lmms

Fruity Loops with Wine

Install Realtime Kernel for better latency:
sudo apt-get install linux-rt
Install Program:
mkdir ~/.frloops
cd ~/.frloops
Download Fruity Loops Demo at http://flstudio.image-line.com/documents/download.html
env $PWD='pwd' WINEPREFIX=$PWD wine flstudio_*.exe
On Error click OK
Finally kill it
Activate the OGG Vorbis codec:
sed -i 's/\[drivers32\]/\[drivers32\]\nMSACM.vorbis=vorbis.acm/' ~/.frloops/drive_c/windows/system.ini
Use font smothing:
echo 'REGEDIT4
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:00000001
"FontSmoothingType"=dword:00000002
' > wine-fonts.reg
env $PWD='pwd' WINEPREFIX=$PWD wine regedit wine-fonts.reg
cd ~/.frloops; env $PWD='pwd' WINEPREFIX=$PWD wine "./drive_c/Program Files/Image-Line/FL Studio 9/FL.exe"

Set the Buffer:
Option --> Audio Setting --> Buffer lenght: 8192

Youtube

Installare Youtube Downloader

http://rg3.github.io/youtube-dl/download.html
youtube-dl -w -t http://www.youtube.com/watch?v=SEfhM3T4aV0
Search batch downloading: 
  
#!/usr/bin/env bash
total_playlist_search=20
let i=1
while [ $i -le $total_playlist_search ]
do
echo SerchList Number $i
wget -qO- -c "http://www.youtube.com/results?search_query=gregorian&page=$i" | grep yt-uix-tile-link | grep '<a href="\/watch?v=' | cut -d\"  -f2,4 | cut -d\"  -f2 | grep watch | grep -v "list=PL" | awk '{ print "http://www.youtube.com"$0 }' | xargs youtube-dl -w -t
let i=i+1
done
dove:
gregorian e' la stringa di ricerca, se ci sono piu stringe, sostituire lo spazio con il +, es: tom+jerry
page=$i e' la pagina della ricerca
oppure si puo' usare questo script:
wget -qO- -c “http://www.youtube.com/results?search_query=tom+jerry&page=1″ | awk -v RS=’[]’ -F\” ‘/^a href=/ && $2 ~ /watch/ && !
a[$2]++ { print “http://www.youtube.com” $2 }’ | xargs -i wget -qO- -c {} | awk ‘/fullscreen/ { match($0,/video_id/);
video_id=substr($0, RSTART-1, 21); match($0,/\&t/); t=substr($0, RSTART, 35); l=length($0); match($0,/title/); title=substr($0,
RSTART+6, l-RSTART-7); print “\”http://www.youtube.com/get_video?” video_id t “\”" ” -O ” “\”" title “.flv\”" }’ | xargs wget

Installare Youtube Batch Downloader per Linux

Per scaricare i video di una playlist di Youtube, ad es:

http://www.youtube.com/watch?v=AjtpplE39_g&p=1A0F03A32CB7D307&playnext=1&index=39

Utilizzare il seguente script per le playlist:

#!/usr/bin/env bash
#Youtube Batch Downloader for Linux 
total_playlist_video=$(wget -qO- -c "http://www.youtube.com/results?search_query=1A0F03A32CB7D307" | grep playlist-video-count | cut -d">" -f2 |cut -d" " -f1)
let i=1
while [ $i -le $total_playlist_video ]
do
xml_data=$(wget -qO- -c "http://gdata.youtube.com/feeds/api/playlists/1A0F03A32CB7D307?v=2&max-results=1&start-index=$i")
#echo $xml_data
video=$(echo $xml_data |  sed "s/>/>\\`echo -e '\n\r'`/g" | grep  youtube_gdata | grep player | awk -v RS=\' '!(NR%2)' | awk 'BEGIN { FS = "&" } ; { print $1 }' )
echo $video
youtube-dl -w -t $video
let i=i+1
done

Utilizzare il seguente script gli user uploads:

#!/usr/bin/env bash
#Youtube Batch Downloader for Linux 
total_playlist_video=100
let i=1
while [ $i -le $total_playlist_video ]
do
xml_data=$(wget -qO- -c "http://gdata.youtube.com/feeds/base/users/ThePumkinShow/uploads")
#echo $xml_data
video=$(echo $xml_data |  sed "s/>/>\\`echo -e '\n\r'`/g" | grep  youtube_gdata | grep player | awk -v RS=\' '!(NR%2)' | awk 'BEGIN { FS = "&" } ; { print $1 }' )
echo $video
youtube-dl -w -t $video
let i=i+1
done

Installare PyTube, Front-End Grafico per YouTube, MyspaceTV, Google Video e Metacafe

wget http://mirrors.dotsrc.org/getdeb/ubuntu/hardy/py/pytube_0.0.11.4~getdeb1_all.deb
sudo apt-get install ffmpeg2theora sox libsox0
sudo dpkg -i pytube_0.0.11.4~getdeb1_all.deb

Installare Mencoder, Convertitore di formati video

sudo apt-get install mencoder
Convertire i video youtube in formato xdiv:
mencoder "Depeche_Mode_Wrong_HQ_HD_Live_at_Echo_Awards_Berlin-L2GaCnAiuvo.mp4" -ovc xvid -oac mp3lame -xvidencopts pass=2:bitrate=800 -lameopts cbr:br=192 -vf scale=720:576,harddup -o "Depeche_Mode_Wrong_HQ_HD_Live_at_Echo_Awards_Berlin-L2GaCnAiuvo_xdiv.avi"
Convertire i video youtube in formato xdiv senza audio:
mencoder "Maslow_s_Hierarchy_By_Camille-E67bJ4Lc2OI.mp4" -ovc xvid -xvidencopts pass=2:bitrate=800 -lameopts cbr:br=192 -vf scale=720:576,harddup -nosound -o "Maslow_s_Hierarchy_By_Camille-E67bJ4Lc2OI_xdiv_noaudio.avi"
Convertire i video youtube in formato xdiv con nuovo audio:
mencoder "Maslow_s_Hierarchy_By_Camille-E67bJ4Lc2OI.mp4" -ovc xvid -xvidencopts pass=2:bitrate=800 -lameopts cbr:br=192 -vf scale=720:576,harddup -audiofile "01 - La Fille De Pekin (Frederick Rousseau).mp3" -oac mp3lame -o "Maslow_s_Hierarchy_By_Camille-E67bJ4Lc2OI_xdiv_newaudio.avi"
Estrarre la traccia audio dai video youtube: 
mencoder -of rawaudio -ovc copy -oac mp3lame -o file.mp3 file.mp4
Estrarre la traccia audio dai video youtube in batch mode:
for file in *.flv *.mp4
  do
  echo $file
  newfile=`echo ${file}.mp3`;
  echo ${newfile}
  mencoder -of rawaudio -ovc copy -oac mp3lame -o "${newfile}" "${file}"
  done

Google

Links Extract for Google Custom Search Engine

One Level links:
lynx -dump "http://www3.telus.net/lordfoul/pics/useful%20ubuntu%20links/useful%20unbuntu%20links.html" | egrep -o "http:.*" |  cut -d"/" -f3 | sed 's/$/\/*/' | sort -u
Two Level links:
lynx -dump "http://www.agendaweb.org/" | egrep -o "http:.*" | xargs lynx -dump | egrep -o "http:.*" |  cut -d"/" -f3 | sed 's/$/\/*/' | sort -u >eng_links.txt

Utility MP3

Installare Mp3Splt, per splittare mp3 di grosse dimensioni

sudo apt-get install mp3splt
Per splittare un file mp3 in tanti file da 10 minuti ciascuno si esegue:
mp3splt -t 10.00 "file.mp3"

Installare Randomize Lines

sudo apt-get install randomize-lines
rl pl.m3u >pl01.m3u

XBMC Mediacenter

Install XBMC Mediacenter

sudo apt-get install xbmc

Install Youtube Addon Manually

cd ~/.xbmc/addons
wget http://mirrors.xbmc.org/addons/frodo/plugin.video.youtube/plugin.video.youtube-4.4.6.zip
wget http://mirrors.xbmc.org/addons/frodo/script.module.simple.downloader/script.module.simple.downloader-1.9.4.zip
wget http://mirrors.xbmc.org/addons/frodo/script.module.parsedom/script.module.parsedom-2.5.2.zip
unzip script.module.simple.downloader-1.9.4.zip
unzip plugin.video.youtube-4.4.6.zip
unzip script.module.parsedom-2.5.2.zip
rm *.zip
Set Ask

Desktop

Remote Desktop

XRDP

sudo apt-get install xrdp
sudo apt-get install xfce4
echo xfce4-session >~/.xsession
sudo service xrdp restart

VNC Viewer

sudo apt-get install vinagre

Wallpaper

Install Perl Wallpaper Script

vi wallpaper.pl
#!/usr/bin/perl -w
use strict;
use warnings;

my $searchPath = '~/backgrounds/';   # Set to the directory you want to have searched for photos
my $switchTime = 10;                 # Edit to the number of seconds between photo switches

my @photos = `find $searchPath -type f | grep [jJ][pP][eE]*[gG]`;             
chomp(@photos);
my $photo;

while(1)
{
    $photo = $photos[rand($#photos)];
    #`gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$photo"`;
    `gsettings set org.gnome.desktop.background picture-uri "file:///$photo"`; 
    sleep($switchTime);
}
chmod +x ./wallpaper.pl 
./wallpaper.pl
Insert the script in:
System Tools --> Preferences --> Startup Applications

Install Wallpaper-Tray

sudo apt-get install wallpaper-tray

Install WallPaper Webilder

sudo apt-get install python-gtk2 python-glade2 python-imaging python-setuptools python-gnome2 libglib2.0-0 python-gnomeapplet gettext
wget http://www.webilder.org/static/downloads/Webilder-0.6.9.tar.gz
tar xvfz Webilder-0.6.9.tar.gz
cd Webilder-0.6.9/
sudo python setup.py install
sudo cp ./servers/GNOME_WebilderApplet.server /usr/lib/bonobo/servers
Add to panel Webilder
Menu select: Downloading photos

Download WallPaper Images from Google

mkdir /home/asdf/backgrounds
vi google_image_dl.ksh 
str=$1
wget -UM -qO- -c $str | sed "s/>/>\\`echo -e '\n\r'`/g" | grep imgres |  cut -d\= -f3 |  cut -d\& -f1 >/tmp/google_image.tmp 
cd /home/asdf/backgrounds 
wget -UM -T 5 -i /tmp/google_image.tmp
chmod +x google_image_dl.ksh
./google_image_dl.ksh "http://www.google.com/search?tbm=isch&hl=en&tbs=isz:lt,islt:2mp&q=wallpaper&start=0"
where:
http://www.google.com/search?tbm=isch&hl=en	base url	
&tbs=isz:lt,islt:2mp				>2 mega pixel
&q=wallpaper					search wallpaper
&start=0					0,20,40,60,80,100

ScreenSaver

Installare The Really Slick Screensavers

Da Menu:
System --> Preferences --> Screensaver

Installare Dream Aquarium Screensavers con Wine

mkdir ~/.Aquarium
cd ~/.Aquarium
env $PWD='pwd' WINEPREFIX=$PWD winecfg --> win2000
wget http://www.dreamaquarium.com/DreamAquariumXP.exe
wget http://www.dreamaquarium.com/gdiplus.dll --output-document=$PWD/drive_c/windows/system32/gdiplus.dll
env $PWD='pwd' WINEPREFIX=$PWD wine DreamAquariumXP.exe

File Manager

Installare Krusader, un commander evoluto per GNU/Linux

sudo apt-get install md5deep cfv konsole kmail krename
sudo apt-get install kompare xxdiff ark arj lha rpm unace kdebase-bin rar ncompress p7zip-full zoo
sudo apt-get install p7zip-rar unrar alien xxdiff-scripts
sudo apt-get install krusader

Installare Tux Commander

wget http://prdownloads.sourceforge.net/tuxcmd/tuxcmd_0.6.50-1_amd64.deb?download
sudo dpkg -i tuxcmd_0.6.50-1_amd64.deb

Installare Gnome Commander

sudo apt-get install gnome-commander libgnomevfs2-extra gksu

Installare Double Commander

sudo apt-get install libqtwebkit4 libqt4pas5
wget "http://optimate.dl.sourceforge.net/project/doublecmd/DC%20for%20Linux%2064%20bit/Double%20Commander%200.5.7%20beta/doublecmd-0.5.7.qt.x86_64.tar.xz"
tar xvfJ doublecmd*.tar.xz 
gnome-desktop-item-edit --create-new ~/Desktop/doublecmd.desktop 
sudo cp ~/Desktop/doublecmd.desktop /usr/share/applications/

Effetti Desktop

Installare Compiz Fusion

sudo apt-get install compizconfig-settings-manager fusion-icon
System --> Preferences --> Advanced Desktop Effects Setting --> Configurare i tuoi effetti
Oppure lanciare il tool di configurazione dalla tray icon:
Applications --> System Tools --> Compiz Fusion Icon

Gadget

Installare GKrellM - System Monitoring Tool

sudo acccpt-get install gkrellm
gkrellm

Installare GDeskLets

sudo apt-get install gdesklets
http://launchpadlibrarian.net/7542161/gdesklets_0.35.4-1ubuntu1_amd64.deb

Google Utility

Installare Google Earth

wget http://dl.google.com/earth/client/current/GoogleEarthLinux.bin
chmod +x GoogleEarthLinux.bin
sudo linux32 ./GoogleEarthLinux.bin

Installare Google Desktop

wget http://dl.google.com/linux/deb/pool/non-free/g/google-desktop-linux/google-desktop-linux_current_amd64.deb
sudo dpkg -i google-desktop-linux_current_amd64.deb

Installare Google Picasa

wget http://dl.google.com/linux/deb/pool/non-free/p/picasa/picasa_2.2.2820-5_i386.deb
sudo dpkg -i --force-architecture picasa_2.2.2820-5_i386.deb

Hotkeys

Installare il supporto per il copia ed incolla e per la gestione delle hotkeys

sudo apt-get install xsel xosd-bin xbindkeys kdebase-bin
a questo punto possiamo creare il file .xbindkeysrc nella home del nostro utente personale e configurare una   hotkeys per il richiamo di un dizionario online alla pressione di tasti sul testo selezionato:

"firefox http://www.wordreference.com/enit/"`xsel -p -o`"" 
  control+shift + x
"firefox http://www.wordreference.com/iten/"`xsel -p -o`"" 
 control+shift + c
"firefox http://translate.google.com/translate_t?sl=en\&tl=it\&text="`xsel -p -o`"" 
  control+shift + a
"firefox http://www.google.it/search?q="`xsel -p -o`"" 
  control+shift + g
"/home/asdf/TransGoogle.py en it `xsel -p -o`"
  control+shift + q
"/home/asdf/TransBabylon.py 0 2 `xsel -p -o`"
  control+shift + w
"/home/asdf/TransGoogle.py it en `xsel -p -o`"
  control+shift + e
"/home/asdf/TransBabylon.py 2 0 `xsel -p -o`"
  control+shift + r
"ps -ef | grep /home/asdf/Trans | awk '{print $2}'|xargs kill -9"
  control+shift + p
"str=`xsel -p -o`; kdialog --passivepopup "Downloading...$str"; cd /mnt/win_d/avi/Francesco/Youtube/; fname=$(youtube-dl -b -t "$str" | tail -1| cut -d" " -f5); kdialog --passivepopup "$fname Downloaded...Now Converting...";bname=$(basename $fname .mp4); /usr/bin/mencoder -srate 48000 -af lavcresample=48000 -oac lavc -aid 0 -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -ofps 25 -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:trell:mbd=2:sc_threshold=1000000000:cgop:vstrict=0:vrc_maxrate=8500:vrc_buf_size=1835:vbitrate=5001:keyint=12:acodec=ac3:abitrate=224:aspect=4/3 -o ./mpeg/$bname.mpg $fname; kdialog --passivepopup "$fname Converted...";"
  control+shift + y
"str=`xsel -p -o`; kdialog --passivepopup "Downloading...$str"; cd /mnt/win_d/avi/Francesco/Youtube/; fname=$(youtube-dl -t "$str" | tail -1| cut -d" " -f5); kdialog --passivepopup "$fname Downloaded...Now Converting...";bname=$(basename $fname .flv); /usr/bin/mencoder -srate 48000 -af lavcresample=48000 -oac lavc -aid 1 -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -ofps 25 -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:trell:mbd=2:sc_threshold=1000000000:cgop:vstrict=0:vrc_maxrate=8500:vrc_buf_size=1835:vbitrate=5001:keyint=12:acodec=ac3:abitrate=224:aspect=4/3 -o ./mpeg/$bname.mpg $fname; kdialog --passivepopup "$fname Converted...";"
  control+shift + u
"str=`xsel -p -o`; cd /mnt/win_d/avi/Francesco/Youtube/; kdialog --passivepopup "Now Converting $str ...";bname=$(basename $str .flv); /usr/bin/mencoder -srate 48000 -af lavcresample=48000 -oac lavc -aid 1 -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -ofps 25 -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:trell:mbd=2:sc_threshold=1000000000:cgop:vstrict=0:vrc_maxrate=8500:vrc_buf_size=1835:vbitrate=5001:keyint=12:acodec=ac3:abitrate=224:aspect=4/3 -o ./mpeg/$bname.mpg $str; kdialog --passivepopup "$str Converted...";"
  control+shift + i

Interfaccia python per la traduzione tramite Google

#!/usr/bin/python
import pygtk
pygtk.require('2.0')
import pynotify
import urllib2
from urllib import urlencode
import sys

#TransGoogle Source Target Words
#Example:
#./TransGoogle.py en it where are you

if __name__ == '__main__':
        if not pynotify.init("Basics"):
          sys.exit(1)
	lang1=sys.argv[1]
	lang2=sys.argv[2]
	text=' '.join(sys.argv[3:])
        base_url='http://translate.google.com/translate_a/t?'
        params=urlencode( (
                   ('client','t'),
                   ('text',text),
                   ('hl',lang1),
                   ('tl',lang2),) )
	url=base_url+params
        headers = { 'User-Agent' : 'Mozilla/6.0' }
        req = urllib2.Request(url, None, headers)
	content=urllib2.urlopen(req).read()
	start_idx=content.find('[[["')+4
	translation=content[start_idx:]
	end_idx=translation.find('","')
	translation=translation[:end_idx]  
        translation=text + ' = ' + translation
        n = pynotify.Notification("Google Translate", translation)
        if not n.show():
          print "Failed to send notification"
          sys.exit(1)

Interfaccia python per la traduzione tramite Babylon

#!/usr/bin/python
import gobject
import pynotify
from urllib2 import urlopen
from urllib import urlencode
import sys
import re

#TransBabylon Source Target Words
#Example: ( 0=eng 2=it )
#./TransBabylon.py 0 2 where are you

def remove_html_tags(data):
    p = re.compile(r'<.*?>')
    striphtml=p.sub('', data)
    p = re.compile(r'\\n')
    striplfcr=p.sub('\n', striphtml)
    p = re.compile(r'&nbsp;')
    stripnbsp=p.sub('', striplfcr)
    return stripnbsp.decode("unicode-escape")


if __name__ == '__main__':
	lang1=sys.argv[1]
	lang2=sys.argv[2]
	langpair='%s|%s'%(lang1,lang2)
	text=' '.join(sys.argv[3:])
	base_url='http://translation.babylon.com/translate/babylon.php?'
	params=urlencode( (('v',1.0),
                   ('q',text),
                   ('langpair',langpair),
                   ('callback','babylonTranslator.callback')))
	url=base_url+params
	content=urlopen(url).read()
	start_idx=content.find('"translatedText":"')+18
	translation=content[start_idx:]
	end_idx=translation.find('"},')
	translation=translation[:end_idx]
	translation=remove_html_tags(translation)        
	loop = gobject.MainLoop ()
        alert = pynotify.Notification(text, translation)
        alert.set_urgency(pynotify.URGENCY_CRITICAL)
        alert.show()
        loop.run ()

OSD

xlsfonts | more

echo -e "Hello World\nHello World\n" | osd_cat --align=center --pos=middle --delay=5 --font 9x15bold --color=green

echo -e "Hello World\nHello World\n" | osd_cat --align=right --pos=top --delay=2 --font 9x15bold --color=green --offset 40

echo -e "HELLO WORLD\nHello World dgs hstrhsdfg tssdfhsgh\n" | osd_cat --align=right --pos=top --delay=2 --font 12x24romankana --color=green --offset 40

echo -e "HELLO WORLD\nHello World dgs hstrhsdfg tssdfhsgh\n" | osd_cat --align=right --pos=top --delay=2 -f '-*-fixed-*-*-*-*-20-*-*-*-*-*-*-*' --color=green --offset 40 -s5

echo -e "HELLO WORLD\nHello World dgs hstrhsdfg tssdfhsgh\n" | osd_cat --align=right --pos=top --delay=2 -f "-*-fixed-*-*-*-*-20-*-*-*-*-*-*-*" --color=green --offset 40 -s5

Office

Dizionari

Installare TW - Translate Word, traduttore a linea di comamndo

wget http://ftp.cc.uoc.gr/mirrors/nongnu.org/twandgtw/tw-0.1.3.tar.bz2
tar xvfj tw-0.1.3.tar.bz2 
cd tw-0.1.3/
sudo apt-get install elinks
./configure
make
sudo make install
tw translate.google.com.en-it "Hello Peter"
oppure in .xbindkeysrc aggiungere il seguente shortcut:

"kdialog --passivepopup "$(tw translate.google.com.en-it "`xsel -p -o`")""
control+shift + q

Installare StarDict con i dizionari Babylon

sudo apt-get install stardict
sudo apt-get install build-essential
sudo apt-get install libxml2-dev
wget http://mattneri.altervista.org/files/dictconv-0.2.1.tar.gz
tar xvfz dictconv-0.2.1.tar.gz
cd dictconv-0.2.1
sudo ./configure
sudo make all install
cd ..
wget http://info.babylon.com/glossaries/38A/Babylon_English_Italian.BGL
dictconv -o Babylon_English_Italian.ifo Babylon_English_Italian.BGL
sudo cp Babylon_English_Italian.ifo Babylon_English_Italian.idx Babylon_English_Italian.dict /usr/share/stardict/dic
wget http://info.babylon.com/glossaries/4E8/Babylon_Italian_English_dictio.BGL
dictconv -o Babylon_Italian_English_dictio.ifo Babylon_Italian_English_dictio.BGL
sudo cp Babylon_Italian_English_dictio.ifo Babylon_Italian_English_dictio.idx Babylon_Italian_English_dictio.dict /usr/share/stardict/dic

Utility PDF

Installare Adobe Reader - Un Reader di file PDF

wget http://ardownload.adobe.com/pub/adobe/reader/unix/8.x/8.1.2/enu/AdobeReader_enu-8.1.2-1.i386.deb
sudo dpkg -i --force-architecture AdobeReader_enu-8.1.2-1.i386.deb
cd
cd .mozilla/plugins
nspluginwrapper -v -a -i
nspluginwrapper -l

Installare Chm2Pdf - Converte file CHM in PDF

sudo apt-get install chm2pdf
chm2pdf --book --title file.chm

Installare PdfEdit - Un ottimo editor di file PDF

sudo apt-get install pdfedit

Utility CHM

Installare GnoChm - per leggere i file .chm

sudo apt-get install gnochm
Da Menu: Applications --> Accessories --> CHM Viewer

WIKI

Install MediaWiki

sudo apt-get install mysql-server
Insert mysql root password from console
sudo apt-get install php5 php5-mysql
mysql -u root -p mysql
create database wikidb;
grant create, select, insert, update, delete, lock tables on wikidb.* to 'wikiuser'@'localhost' identified by  'xxxxxxx';
flush privileges;
exit
sudo apt-get install mediawiki
sudo mkdir /var/www/wiki/
sudo ln -s  /usr/share/mediawiki1.10/ /var/www/wiki/
http://localhost/wiki/mediawiki1.10/

Install DokuWiki

su
apt-get install apache2 php5
cd /opt/
wget http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
tar xvfz dokuwiki-stable.tgz
mv dokuwiki-2012-10-13 dokuwiki
cd /etc/apache2/conf.d

vi dokuwiki.conf
# dokuwiki default Apache configuration

Alias /dokuwiki "/opt/dokuwiki"
<Directory "/opt/dokuwiki/">

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

</Directory>

******
In ubuntu 13.10:

vi /etc/apache2/sites-available/000-default.conf

Alias /dokuwiki "/opt/dokuwiki"
<Directory "/opt/dokuwiki/">

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted

</Directory>
******

chown -R www-data:www-data /opt/dokuwiki
service apache2 restart
firefox http://localhost/dokuwiki/install.php
cd /opt/dokuwiki
mv install.php install.php.ori

cd lib/tpl/
wget http://r.notomorrow.de/dokuwiki-template-arctic/pkg/arctic-stable.tgz
tar xvfz arctic-stable.tgz
Customize Artic Template:
http://rkpisanu.altervista.org/doku.php?id=dokuwiki:template_mods:sidebar#css_mods1

firefox http://localhost/dokuwiki/doku.php
Admin --> Configuration Settings --> Basic Settings --> Template aka. the design of the wiki. --> artic

cd lib/plugins
wget https://github.com/samuelet/indexmenu/archive/master.zip
unzip master.zip
mv indexmenu-master indexmenu

firefox http://localhost/dokuwiki/doku.php?id=sidebar
{{indexmenu>..#1|js#thread navbar max#3#2 tsort msort}}

Reinstall: Admin --> Extension Manager --> Indexmenu Plugin --> Re-Install

Configure Dokuwiki with Dropbox:

Install Dropbox:

https://www.dropbox.com/en/install?os=lnx

cd Downloads/
su
apt-get install python-gpgme
dpkg -i dropbox_1.6.0_i386.deb
apt-get -f install
http_proxy=http://localhost:5865/ dropbox start -i

Mount Dropbox directory:

sudo mount --bind /opt/Dropbox/sharewiki/data/pages/ /opt/sharewiki/data/pages/
sudo chown -R asdf:asdf /opt/sharewiki
sudo chmod -R 777 /opt/sharewiki
service apache2 restart

Delicious

Estrarre i link delle ricerche da Delicious

wget -qO- -c "http://delicious.com/search?p=sed&context=all&lc=1&page=1" | grep nofollow | sed 's/^.*<a href="//' | sed 's/".*$//' | grep http | sort -u
curl "http://delicious.com/search?p=ubuntu&context=all&lc=1&page=[1-15]]" | grep nofollow | sed 's/^.*<a href="//' | sed 's/".*$//' | grep http | sort -u

Microsoft

Office 2000

mkdir ~/.office2000
cd ~/.office2000
env $PWD='pwd' WINEPREFIX=$PWD winecfg --> WinXP
settare riched20.dll & riched32.dll come native
andare in ~/.office2000/drive_c/windows/system32 e rinominare riched20.dll and riched32.dll to *.bak
env $PWD='pwd' WINEPREFIX=$PWD winetricks --> installare richedit30
wget http://www.pipian.com/anime/images/tahoma.zip 
unzip tahoma.zip 
cp tahoma* ~/.office2000/drive_c/windows/Fonts
cd /media/cdrom0
export WINEPREFIX="/home/asdf/.office2000"
wine setup

Lanciare Word, excel & powerpoint

Emulator

Installare ChRoot per creare ambienti a 32 bit

sudo apt-get install debootstrap schroot
mkdir ~/chroots
sudo debootstrap --arch=i386 natty ~/chroots/natty-32
Aggiungere la seguente sezione nel file di configurazione /etc/schroot/schroot.conf :
sudo vi /etc/schroot/schroot.conf
[natty-32]
type=directory
description=natty 32-bit
directory=/home/asdf/chroots/natty-32
users=asdf,root
groups=asdf,root
root-groups=root,adm
personality=linux32
sudo cp /etc/sudoers ~/chroots/natty-32/etc/sudoers
Entriamo nel nuovo ambiente:
schroot -c natty-32
sudo vi /etc/apt/sources.list
add manually : 
  deb http://archive.ubuntu.com/ubuntu natty universe
  deb http://archive.ubuntu.com/ubuntu natty multiverse
  deb http://archive.ubuntu.com/ubuntu natty multiverse
  deb http://archive.ubuntu.com/ubuntu natty restricted
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install wget alien vim language-pack-en-base
sudo dpkg-reconfigure locales
sudo update-locale LANG=en_US.UTF-8
export DISPLAY=:0.0
exit
Per ricollegarsi di nuovo all'ambiente 32-bit :
schroot -c natty-32
export DISPLAY=:0.0

Installare Wine

Wine stable release:

sudo apt-get install wine

or:

Wine latest release:

  
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.7
sudo apt-get install libp11-kit-gnome-keyring:i386

or:

cp /etc/apt/sources.list /etc/apt/sources.list.ori

echo "deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu quantal main" >>/etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu quantal main" >>/etc/apt/sources.list

gpg --keyserver keyserver.ubuntu.com --recv 5A9A06AEF9CB8DB0
gpg --export --armor 5A9A06AEF9CB8DB0 | apt-key add -

apt-get update
apt-get install wine1.5

Tricks to run Linux command from Wine:

script producer:
  run ls:
  wine cmd /c echo ls >wine2linux.sh
  run gedit:
  wine cmd /c echo gedit >wine2linux.sh

script consumer:
  while true ; do dos2unix ./wine2linux.sh; sh ./wine2linux.sh; sleep 5; rm ./wine2linux.sh; sleep 5; done

Installare Winetricks, script per installare win32 runtime libraries per Wine

wget http://www.kegel.com/wine/winetricks && sudo mv ./winetricks /usr/local/bin && sudo chmod +x /usr/local/bin/winetricks 
winetricks

Install VIRTUALBOX

Tested on Ubuntu 12.10

Install libqt4-opengl,kernel header, etc required by VirtualBox:

sudo apt-get install libqt4-opengl linux-headers-$(uname -r)

Download VirtualBox and install it:

wget http://download.virtualbox.org/virtualbox/4.2.14/virtualbox-4.2_4.2.14-86644~Ubuntu~raring_amd64.deb
sudo dpkg -i virtualbox*Ubuntu~raring_amd64.deb
sudo apt-get -f install

Download VirtualBox Extention Pack and install it:

wget http://download.virtualbox.org/virtualbox/4.2.14/Oracle_VM_VirtualBox_Extension_Pack-4.2.14-86644.vbox-extpack
Start virtualbox and go to  File/Preferences/Extensions/Add Package and select Oracle_VM_VirtualBox_Extension_Pack-4.2.14-86644.vbox-extpack

Add current user to vboxusers:

if ! groups | grep vboxusers; then sudo adduser $USER vboxusers; else echo "You're already in vboxusers.  Must be a different problem."; fi
and then logoff/login to load new configuration

Recompile VirtualBox Kernel Module if necessary:

sudo /etc/init.d/vboxdrv setup
reboot

Move to opt:

mv .VirtualBox /opt
ln -s /opt/.VirtualBox/ .VirtualBox

Change UUID:

cd "\Program Files\Oracle\VirtualBox\"
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands sethduuid "\VirtualBox\ubuntu_i386_oracle_xe\ubuntu_i386_oracle_xe.vdi"
UUID changed to: 61c9600a-292b-4999-8aac-96bff8e4fe97

Installare VMWare Player

sudo apt-get install linux-headers-$(uname -r)
mkdir ~/VMware && cd ~/VMware
wget -c http://goo.gl/aoveM -O VMware-Player-5.0.1-894247.x86_64.bundle.tar
tar -xvf VMware-Player-5.0.1-894247.x86_64.bundle.tar
chmod +x VMware-Player-5.0.1-894247.x86_64.bundle
sudo sh VMware-Player-5.0.1-894247.x86_64.bundle

Installare Mono, Dot Net per Linux

sudo apt-get install mono-complete

Internet

SSH

Installare SSH Client/Server

sudo apt-get install ssh

Installare SSH Gnome Connection Manager

http://kuthulu.com/gcm/?module=download

sudo apt-get install expect libvte-common libvte9 python-glade2 python-vte tcl8.5 tcl8.5-lib
wget http://kuthulu.com/gcm/gnome-connection-manager_1.1.0_all.deb
dpkg -i gnome-connection-manager_1.1.0_all.deb  

FTP Server

Install Pure Ftpd

sudo apt-get install pure-ftpd

Install lightweight, efficient FTP server

sudo apt-get install vsftpd

FTP Client

Installare Filezilla

sudo apt-get install filezilla

Web Downloader Client

Installare JDownloader

wget http://212.117.163.148/jd.sh
chmod +x jd.sh
start jd.sh

Installare il Download Splitter

wget http://www.freebyte.com/download/hjsplit/hjsplit_g.jar
java -jar hjsplit_g.jar

Installare il Fast Downloader Prozilla

wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/releases/8/Everything/x86_64/os/Packages/prozilla-2.0.4-7.fc7.x86_64.rpm
sudo rpm -ihv --nodeps prozilla-2.0.4-7.fc7.x86_64.rpm
proz <url>

Installare il Fast Downloader Aria2

sudo apt-get install aria2
wget http://heanet.dl.sourceforge.net/sourceforge/aria2fe/aria2fe-0.0.5.tar.bz2
tar xvfj aria2fe-0.0.5.tar.bz2
cd aria2fe-0.0.5
cd bin
sudo cp aria2fe  /usr/bin
cd ../..
rm -rf ./aria2fe-0.0.5
gnome-desktop-item-edit --create-new ~/Desktop/aria2fe.desktop 

Installare Offline Explorer con WINE per scarcare file da internet e/o copiare interi siti

wget http://dl.filekicker.com/send/file/167644-P0KM/opsetup.exe
wine opsetup.exe

Utilizzare wget per scarcare file da internet e/o copiare interi siti

 wget <URL>
 Opzioni: 
 -b lavora in background
 -c continua un donwload interrotto precedentemente
 -i <file> Legge le URL da file
 -Q10m Limita il download a 10 MB                                                 
 -r Download ricorsivo
 -H Segue il link cambiando host
 -l5 Livelli di ricorsione di download (0=infinito)
 -np Non sale di directory
 -nc Non riscarica file già scaricati precedentemente
 -k Cambia i link per navigazione offline
 -p Scarica le immagini di ogni pagina html
 -A/R es1,... Accetta/rifiuta file con estensioni es1, . . .
Esempi
wget -bc www.sito.it/dir/file.est
tail -f wget-log
wget -r -l0 -np -nc -k -p www.miosito.it/sito/c/
wget -r -l1 -H -A pdf www.miosito.it/sito/c/
wget --user-agent="mozilla/4.0 (compatible; MSIE 4.0)" -qO- -c "http://www.yahoo.it"
wget --user-agent="mozilla/4.0 (compatible; MSIE 4.0)" -r -l1 -H -t1 -nd -N -np -A zip -erobots=off "URL with zip file"

Mail Client

Installare Outlook Express con Wine

mkdir ~/.oexpress
cd ~/.oexpress
env $PWD='pwd' WINEPREFIX=$PWD winetricks ie6
env $PWD='pwd' WINEPREFIX=$PWD winetricks riched20
cd ~/.oexpress && env $PWD='pwd' WINEPREFIX=$PWD wine "C:\Program Files\Outlook Express\msimn.exe"

Installare Thunderbird

sudo apt-get install thunderbird
Per lanciarlo con il formato data europeo :
vi th_mail.ksh
#!/bin/sh
export LC_TIME=en_GB.utf8
thunderbird %u
chmod +x th_mail.ksh
./th_mail.ksh

IRC Client

Installare XChat

sudo apt-get install xchat
Per configurare il timestamp:
/set stamp_text on
/set stamp_text_format
oppure
/set stamp_text_format [%d %b %y %H:%M:%S]
Per configurare il whois nel canale:
/set irc_whois_front on

Installare Kopete, Instant Messenger

sudo apt-get install kopete

VOIP Client

Installare Skype

 wget http://www.skype.com/go/getskype-linux-ubuntu
 sudo dpkg -i --force-architecture skype*.deb

Remote Desktop Client

Installare VNC

sudo apt-get install xvnc4viewer
xvnc4viewer
F8 for context menu

P2P Client

Installare UTorrent con Wine

mkdir ~/.utorrent 
cd ~/.utorrent
wget http://download.utorrent.com/3.1/utorrent.exe
env $PWD='pwd' WINEPREFIX=$PWD wine utorrent.exe
cd ~/.utorrent && env $PWD='pwd' WINEPREFIX=$PWD wine ~/.utorrent/utorrent.exe /NOINSTALL
Creamo la shell da associare a Firefox:
gksudo gedit /usr/bin/utorrent

Inseriamo i seguenti comandi e salviamo considerando la home dell'utente asdf /home/asdf:
#!/bin/sh
cd /home/asdf/.utorrent
if [ "$1" != "" ]; then
var="`echo $1 | sed 's/\//\\\/g'`"
var="Z:${var}"
cd /home/asdf/.utorrent && env $PWD='pwd' WINEPREFIX=$PWD wine utorrent.exe "$var"
else
cd /home/asdf/.utorrent && env $PWD='pwd' WINEPREFIX=$PWD wine utorrent.exe
fi
sudo chmod a+x /usr/bin/utorrent
Associare /usr/bin/utorrent ai file .torrent in Firefox

Installare UTorrent con Linux

Download: utorrent-server-3.0-xxxxx.tar.gz and unpack
sudo apt-get install libssl0.9.8:i386
go to: utorrent-server-v3_0 directory
run: nohup ./utserver &
go to following link: http://localhost:8080/gui/ user: admin pwd: <blank>

Installare Emule con Wine

mkdir ~/.emule
cd ~/.emule
wget http://prdownloads.sourceforge.net/emule/eMule0.50a-Installer.exe
env $PWD='pwd' WINEPREFIX=$PWD wine eMule*.exe
env $PWD='pwd' WINEPREFIX=$PWD wine "./drive_c/Program Files/eMule/emule.exe"
Apriamo alcune porte utilizzate da Emule:
sudo ufw allow 30842/tcp
sudo ufw allow 56916/udp
sudo ufw enable
sudo ufw status

Installare Phex

wget http://prdownloads.sourceforge.net/phex/phex_3.2.6.106.zip
unzip phex_3.2.6.106.zip 
java -jar phex_3.2.6.106/lib/phex.jar 

Installare Linuxdcpp

sudo apt-get install cvs scons libgtk2.0-dev libglade2-dev libbz2-dev libssl-dev
wget http://launchpad.net/linuxdcpp/1.0/1.0.3/+download/linuxdcpp-1.0.3.tar.bz2
tar xvfj linuxdcpp-1.0.3.tar.bz2
cd linuxdcpp-1.0.3/
scons
./linuxdcpp

VPN Client

Installare CISCO VPN Client

Per sistemi a 64 bit:
== Ubuntu Version 10.10 - 11.04 ==
wget http://projects.tuxx-home.at/ciscovpn/clients/linux/4.8.02/vpnclient-linux-x86_64-4.8.02.0030-k9.tar.gz
tar xvfz  vpnclient-linux-x86_64-4.8.02.0030-k9.tar.gz
cd vpnclient
wget http://www.lamnk.com/download/fixes.patch
cat fixes.patch
patch < ./fixes.patch
sudo ./vpn_install
copiamo il nostro profilo aziendale myprofile.pcf in /etc/CiscoSystemsVPNClient/Profiles
sudo /etc/init.d/vpnclient_init start 
sudo vpnclient connect myprofile ( senza l`estensione .pcf )
== Old Ubuntu Version ==
wget http://projects.tuxx-home.at/ciscovpn/clients/linux/4.8.01/vpnclient-linux-x86_64-4.8.01.0640-k9.tar.gz
tar xvfz vpnclient-linux-x86_64-4.8.01.0640-k9.tar.gz
cd vpnclient
Nel file Makefile dobbiamo cambiare il tag CFLAGS EXTRA_CFLAGS con il seguente comando:
sed 's/^CFLAGS/EXTRA_CFLAGS/' Makefile > Makefile.patch ; cp Makefile.patch Makefile
wget http://projects.tuxx-home.at/ciscovpn/patches/vpnclient-linux-2.6.24-final.diff
patch <vpnclient-linux-2.6.24-final.diff
wget http://projects.tuxx-home.at/ciscovpn/patches/cisco_skbuff_offset.patch
patch <cisco_skbuff_offset.patch
Per il kernel 2.6.31 occorre applicare anche la seguente patch:
wget http://www.scubarda.net/wordpress/wp-content/uploads/2631.patch
patch < ./2631.patch
sudo ./vpn_install
copiamo il nostro profilo aziendale myprofile.pcf in /etc/CiscoSystemsVPNClient/Profiles
sudo /etc/init.d/vpnclient_init start 
sudo vpnclient connect myprofile ( senza l`estensione .pcf )

Installare VPNC Client

sudo apt-get install kvpnc vpnc
/usr/share/vpnc/pcf2vpnc file.pcf 
Importare e configurare la connessione VPN con l'interfaccia grafica KVPNC 
oppure da linea di comando:  
vpnc --gateway <IP del Gateway> --id <IdGroup> --username <Username>
dove IP del Gateway deve essere in formato dotted

DNS Client

Installare pdns-recursor, una cache locale del DNS

sudo apt-get install pdns-recursor
lanciare due volte il comando: dig  @localhost fedora.com mx | grep "Query time"
sudo vi /etc/resolv.conf.ok
Aggiungete in testa al file la riga:
nameserver 127.0.0.1
salvate ed uscite dal file.
Inserite la seguente riga nel crontab per lanciare ogni 5 minuti il seguente comando:
sudo -s
crontab -l
*/5 *   * * *   root    cp /etc/resolv.conf.ok /etc/resolv.conf
Ora tutte le applicazioni utilizzeranno la cache del dns locale.

IPTV Client

Installare IPTV Sopcast

sudo apt-get install curl libasound2-dev libgtk2.0-dev libstdc++5
wget http://download.sopcast.cn/download/sp-auth.tgz
tar xvfz sp-auth.tgz
sudo cp ./sp-auth/sp-sc-auth /usr/bin
sudo ln -sf /usr/bin/sp-sc-auth /usr/bin/sp-sc
wget http://gsopcast.googlecode.com/files/gsopcast-0.4.0.tar.bz2
tar xvfj gsopcast-0.4.0.tar.bz2
cd gsopcast-0.4.0
./configure
make
sudo make install
gsopcast
Integrazione in Firefox:
gksudo gedit /usr/bin/sopiptv
#!/bin/sh
/usr/bin/sp-sc $1 3908 8908 > /dev/null &
(
MAX=110
PROGRESS=0
INC=3
while  [ ${PROGRESS} -lt ${MAX} ]
do
  echo ${PROGRESS}
  sleep 1
  PROGRESS=`expr ${PROGRESS} + ${INC}`
done
echo 100
) | zenity --progress --auto-close --title="SOPCAST" --text="URL: $1 Buffering..."
vlc http://localhost:8908/tv.asf
(
MAX=110
PROGRESS=0
INC=30
while  [ ${PROGRESS} -lt ${MAX} ]
do
  echo ${PROGRESS}
  sleep 1
  PROGRESS=`expr ${PROGRESS} + ${INC}`
done
echo 100
) | zenity --progress --auto-close --title="SOPCAST" --text="Exiting..."
kill -9 $(pidof sp-sc)
sudo chmod +x /usr/bin/sopiptv
Firefox --> about:config --> Tasto destro del mouse --> New --> 
String --> network.protocol-handler.app.sop --> /usr/bin/sopiptv
Boolean --> network.protocol-handler.external.sop --> true

Installare IPTV TVUNETWORKS

mkdir ~/.tvu
cd ~/.tvu
env $PWD='pwd' WINEPREFIX=$PWD winecfg --> WinXP
env $PWD='pwd' WINEPREFIX=$PWD winetricks --> installare gecko
env $PWD='pwd' WINEPREFIX=$PWD winetricks --> installare vcrun6
env $PWD='pwd' WINEPREFIX=$PWD winetricks --> installare wmp10
wget http://dl.tvunetworks.com/TVUPlayer.zip
unzip TVUPlayer.zip
env $PWD='pwd' WINEPREFIX=$PWD wine TVUPlayer*.exe
A fine setup premere i tasti Ctrl+Alt+Backspace e riloggarsi controllando che con ci siano processi wine bloccati
cd ~/.tvu && env $PWD='pwd' WINEPREFIX=$PWD wine "C:\Program Files\TVUPlayer\TVUPlayer.exe"
Scegliere un canale, poi dopo 10-20 sec. quando il segnale e' stabile lanciare vlc http://localhost:8901

Installare IPTV TVANTS

mkdir ~/.tvants
cd ~/.tvants
wget http://download.tvants.com/pub/tvants/tvants1/win32/bin/TvantsSetup.EXE
env $PWD='pwd' WINEPREFIX=$PWD wine ./tvantssetup.exe
env $PWD='pwd' WINEPREFIX=$PWD winetricks --> installare mdac25
cd ~/.tvants ; env $PWD='pwd' WINEPREFIX=$PWD wine "./drive_c/Program Files/TVAnts/Tvants.exe"
vlc mms://localhost:16900/1

Web broswer

Refresh Delicious Bookmarks Addon

Linux:

find . -name ybookmarks.sqlite
./.mozilla/firefox/p4xyg192.default/ybookmarks.sqlite
rm ./.mozilla/firefox/p4xyg192.default/ybookmarks.sqlite

Windows Seven:

c:\Users\asdf\AppData\Roaming\Mozilla\Firefox\Profiles\1jminikx.default\ybookmarks.sqlite

Configure Firefox to use cache in Ram, configure plugins, ecc..

about:config

Settings:

browser.cache.disk.enable;false
browser.cache.memory.enable;true
browser.cache.memory.capacity;1000000

Verify use of memory:

about:cache

Or in RAMDISK:

browser.cache.disk.parent_directory;/run/shm/firefox-cache

or all config in RAMDISK:

vi ./rsync.sh 
chmod 1777 /dev/shm
mkdir /run/shm/.mozilla/
rsync -av /home/asdf/.mozilla/ /run/shm/.mozilla/
mount --bind  /run/shm/.mozilla/ /home/asdf/.mozilla/

sudo ./rsync.sh

Plugins:

https://addons.mozilla.org/it/firefox/addon/delicious-bookmarks/

https://addons.mozilla.org/it/firefox/addon/live-http-headers/

http://getfirebug.com/

https://addons.mozilla.org/it/firefox/addon/gtranslate/

Install Google Chrome

firefox www.google.com/chrome
firefox https://www.google.com/intl/en/chrome/browser/

Web Server

Installare Il Web Server Apache

sudo apt-get install apache2

Per installare le pagine con un alias e virtual directory occorre creare un file con estesione conf nella directory /etc/apache2/conf.d e restartare apache.

Es:

root@ubuntu:/etc/apache2/conf.d# vi dokuwiki.conf

# dokuwiki default Apache configuration

Alias /dokuwiki "/opt/dokuwiki"
<Directory "/opt/dokuwiki/">

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

</Directory>

Nel caso in cui si copiano dei files in /opt, poi occorre cambiare lo user e group affinche` il processo apache abbia pieno accesso ai files:

sudo chown -R www-data:www-data /opt

Dokuwiki in a stick-dropbox:

root@ubuntu:/etc/apache2/conf.d# vi dokuwiki.conf
# dokuwiki default Apache configuration

Alias /dokuwiki "/home/asdf/Dropbox/DokuWikiStick/dokuwiki"
<Directory "/home/asdf/Dropbox/DokuWikiStick/dokuwiki/">

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

</Directory>

  sudo chown -R www-data:www-data ~/Dropbox
  sudo chmod 777 ~/Dropbox
  sudo service apache2 restart

Installare Il Web Server Apache con il supporto PHP5 + SQLITE3

sudo apt-get install apache2 sqlite3 php5 php5-sqlite libapache2-mod-php5
sudo a2enmod php5
sudo /etc/init.d/apache2 force-reload

Installare Il Web Server Apache con il supporto PHP5 + MYSQL + PHPMYADMIN

sudo apt-get install lamp-server^ phpmyadmin

CMS

Install TYPO3 CMS

Download link:
http://sourceforge.net/projects/typo3/files/TYPO3%20Source%20and%20Dummy/

TYPO3 VERSION 4.5.35 LTS:


http://kent.dl.sourceforge.net/project/typo3/TYPO3%20Source%20and%20Dummy/TYPO3%204.5.35/typo3_src-4.5.35.tar.gz
http://kent.dl.sourceforge.net/project/typo3/TYPO3%20Source%20and%20Dummy/TYPO3%204.5.35/dummy-4.5.35.tar.gz

su
vi /etc/php5/apache2/php.ini 
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 240
;xdebug.max_nesting_level=400

mkdir -p /var/www/html/test01
cd /var/www/html/test01
cp /home/asdf/Downloads/dummy-4.5.35.tar.gz /home/asdf/Downloads/typo3_src-4.5.35.tar.gz /var/www/html/test01
tar xvfz typo3_src-4.5.35.tar.gz >/dev/null
tar xvfz dummy-4.5.35.tar.gz     >/dev/null
mv dummy-4.5.35 typo3-4.5.35
touch /var/www/html/test01/typo3-4.5.35/typo3conf/ENABLE_INSTALL_TOOL
rm *.gz
cd ..
chown -R www-data:www-data .

Configure Apache Virtual Directory:
vi /etc/apache2/sites-available/000-default.conf

#TYPO3 4.5.35 Apache configuration
Alias /typo3-4.5.35 "/var/www/html/test01/typo3-4.5.35"
<Directory "/var/www/html/test01/typo3-4.5.35/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

Restart Apache:
service apache2 restart


Installing TYPO3 4.5

http://localhost/typo3-4.5.35

1-2-3 Install
    Driver      MySQL/MySQLi
    Username    root
    Password    xxxxxxxx
    Host        localhost

Create Database:
typo3_4_5_35

   
Login to the Backend:

http://itflow.vodafone.it:5080/eat_it/typo3/index.php
User: admin
Password: password
New Password: xxxxxxxx


Change Install tool password:
Click on Install
New Password: xxxxxxx

Configure Sitename from install tool:
Writing to 'localconf.php'
$TYPO3_CONF_VARS['SYS']['sitename'] = 'TYPO3_Site_4_5_35' 


Install php extention:
-) Download http://woehlken.quadracom.de/typo3forum/T3X_page_php_content-1_0_1-z-200603221950.t3x
-) Admin tools->Extension Manager
  --> Import extension, Upload extension file directly (.t3x), click button browse, select T3X_page_php_content-1_0_1-z-200603221950.t3x, upload extension file
  --> Install/Uninstall Extension: Click on link Install extension
  --> Extension Manager Extension: Page PHP Content (page_php_content) .... click on button Make updates
If ok, it look like: The extension "page_php_content" has been installed.

Create Test Page:

Logical TYPO3 Step:
1) Create Page Object:
2) Create Page Content:
3) Create Template:

1) Create Page Object:
Web->Page
  TYPO3_Site_4_5_35 --> click the right mouse button --> New --> Title Page Title: Login --> save and exit (Page Title)
  --> Click on Login --> click the right mouse button, Enable
2 html) Create Page Content:
  --> Click on Login --> Click on Normal --> New content element: Regular Text Element --> Text: Test 123
  --> save and exit (Page Content)
 
2 php) Create Page Content PHP:
  --> Click on Login --> Click on Normal Icon --> New content element: Regular Text Element --> Type: Php script --> Php Code -->
<?php
phpinfo();
?>
  --> save and exit (Page Content)
 
3) Create Template: 
Web->Template
  --> Click on Login
  --> Info/Modify
  --> Click Button: Create template for a new site  (click button two times)

Setup: delete all content and paste this template

#Assign PAGE Object to page variable
page = PAGE
# This returns content from the "normal" column (colPos = 0).
page.10 < styles.content.get
Save Template: Save and close document

Edit the whole template record:
Includes: Include static (from extensions):  click on CSS Styled Content (css_styled_content)
Save Template: Save and close document
click on eye icon

Install KickStarter Extention:
Extension Manager --> Import extentions --> Look up extensions: kickstarter --> click on button Look up and wait several minutes because it download Extension list
--> click on Title:Extension Kickstarter icon Extension key: kickstarter --> Extension import results: Extension imported --> Install extension --> The extension "kickstarter" has been installed.

** Not to be confused with extension builder

TYPO3 VERSION 6.2.4 LTS:


http://kent.dl.sourceforge.net/project/typo3/TYPO3%20Source%20and%20Dummy/TYPO3%206.2.4/typo3_src-6.2.4.tar.gz

su
vi /etc/php5/apache2/php.ini 
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 240
;xdebug.max_nesting_level=400

mkdir -p /var/www/html/test02
cd /var/www/html/test02
cp /home/asdf/Downloads/typo3_src-6.2.4.tar.gz /var/www/html/test02
tar xvfz typo3_src-6.2.4.tar.gz >/dev/null
mkdir typo3-6.2.4
cd typo3-6.2.4
ln -s ../typo3_src-6.2.4 typo3_src
ln -s typo3_src/index.php index.php
ln -s typo3_src/typo3 typo3
touch ./FIRST_INSTALL
cd ..
rm *.gz
cd ..
chown -R www-data:www-data .

Configure Apache Virtual Directory:
vi /etc/apache2/sites-available/000-default.conf

#TYPO3 6.2.4 Apache configuration
Alias /typo3-6.2.4 "/var/www/html/test02/typo3-6.2.4"
<Directory "/var/www/html/test02/typo3-6.2.4/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

Restart Apache:
service apache2 restart


Installing TYPO3 6.2.4

http://localhost/typo3-6.2.4

1-2-3-4-5 Install

Step 1 OK

Step 2: Database connection

    Username:    root
    Password:    xxxxxxx
    Type:        TCP/IP based connection
    Host:        127.0.0.1
    Port:        3306
   
Step 3: Select database - create a new database
typo3_6_2_4

Step 4: Create user and import base data (backend and install tool user/password)
    Username:    admin
    Password:    xxxxxxxx
    Site name:   TYPO3_Site_6_2_4
   
Step 5: Installation done!
uncheck Yes, download the list of distributions.  

   
Login to the Backend:

http://localhost/typo3-6.2.4/typo3/index.php
User: admin
Password: password
New Password: xxxxxxxx


Download Extension List:
Admin tools --> Extension Manager --> Get Extensions
Retrieving Extension-List from TYPO3 Extension Repository (TER)....

Install php extention:
-) Download http://woehlken.quadracom.de/typo3forum/T3X_page_php_content-1_0_1-z-200603221950.t3x
-) Admin tools --> Extension Manager -->
  --> Manage extension, click on icon Upload Extension .t3x/zip , click button browse, select T3X_page_php_content-1_0_1-z-200603221950.t3x, upload extension file
If ok, it look like:
Extension Upload page_php_content was uploaded!
page_php_content was installed!
But doesnt work because it is not compatible with typo3-6.2.4. To resolve the issue:
Comment core library, because autoload make it in typo3-6.2.4:
vi /var/www/html/test02/typo3-6.2.4/typo3conf/ext/page_php_content/pi1/class.tx_pagephpcontent_pi1.php
//require_once(PATH_tslib."class.tslib_pibase.php");


Create Test Page:

Logical TYPO3 Step:
1) Create Page Object:
2) Create Page Content:
3) Create Template:

1) Create Page Object:
Web->Page
  TYPO3_Site_6.2.4 --> click the right mouse button --> New --> Title Page Title: Login --> save and exit (Page Title)
  --> Click on Login --> click the right mouse button, Enable
2 html) Create Page Content:
  --> Click on Login --> Click on Normal --> New content element: Regular Text Element --> Text: Test 123
  --> save and exit (Page Content)
 
2 php) Create Page Content PHP:
  --> Click on Login --> Click on Normal Icon --> New content element: Regular Text Element --> Type: Php script --> Php Code -->
<?php
phpinfo();
?>
  --> save and exit (Page Content)
 
3) Create Template: 
Web->Template
  --> Click on Login
  --> Info/Modify
  --> Click Button: Create template for a new site  (click button two times)

Setup: delete all content and paste this template

#Assign PAGE Object to page variable
page = PAGE
# This returns content from the "normal" column (colPos = 0).
page.10 < styles.content.get
Save Template: Save and close document

Edit the whole template record:
Includes: Include static (from extensions):  click on CSS Styled Content (css_styled_content)
Save Template: Save and close document
click on eye icon

Install KickStarter Extention:
Extension Manager --> Get Extensions --> Search:  kickstarter --> click on button Go 
--> click on Title:Extension Kickstarter icon Extension key: kickstarter --> Extension import results: Extension imported --> Install extension --> The extension "kickstarter" has been installed.

** Not to be confused with extension builder

PROXY SERVER

Installare SQUID Proxy Server

sudo apt-get install squid squid-common
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.ori
Editare il file di configurazione /etc/squid/squid.conf
sudo vi /etc/squid/squid.conf
visible_hostname localhost.localdomain
uscire dal file di configurazione e digitare:
sudo squid -z
sudo squid

Network File System

NFS Windows

Installare SAMBA, per condividere le cartelle con un computer virtuale windows

Server Samba Ubuntu:

sudo apt-get install samba 
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.ori
sudo vi /etc/samba/smb.conf
[var_www]
   comment = Samba server's var_www read-only
   read only = yes
   locking = no
   path = /var/www
   guest ok = yes

service smbd restart

[var_www]
   comment = Samba server's var_www read-write all
   path = /var/www
   available = yes
   browsable = yes
   public = yes
   writable = yes

[var_www]
   comment = Samba server's var_www read-write IP
   allow hosts = 192.168.2.4
   path = /var/www
   available = yes
   browsable = yes
   public = yes
   writable = yes

Client Samba Ubuntu:

sudo apt-get install cifs-utils
mkdir /home/asdf/var_www
sudo mount -t cifs  //192.168.2.9/var_www /home/asdf/var_www
Password for root@//192.168.2.9/var_www: 

Old:

sudo apt-get install samba smbfs
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.ori
sudo gedit /etc/samba/smb.conf
sezione: Authentication
aggiungere:
security = user
username map = /etc/samba/smbusers
sezione: Share Definitions
Aggiungere nelle sottosezioni:
-1-
[homes]
comment = Home Directories
browseable = yes
-2-
valid users = %S
-3-
writable = yes
salvare il file ed uscire
Creazione dell'utente Samba
sudo smbpasswd -a <username>
sudo gedit /etc/samba/smbusers
<username> = "<username>"
salvare ed uscire dal file 
Ricaricare le configurazioni con il comando:
sudo /etc/init.d/samba reload
Per es. per montare in una virtual machine Virtualbox
la home dell'utente, basta mappare il drive con questo path di rete:
\\10.0.2.2\username
Per montare una share samba su un'altra macchina linux si ha:
mkdir -p /mnt/ntserver
mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver
cd /mnt/ntserver; ls -l
Altre configurazioni:
All User Access:
[opt]
comment = Ubuntu OPT
path = /opt
guest ok = Yes
asdf Access:
[opt]
comment = Ubuntu OPT
path = /opt
valid users = asdf
read only = No
Samba Web End:
sudo apt-get  install  swat
http://ip:901/
SAMBA Monitoring:
sudo /usr/bin/smbstatus.samba3
sudo testparm
service smbd restart
service nmbd restart
Lista le share configurate:
smbclient -L //localhost -U user
Connetti ad una share da linux:
smbclient //localhost/share -U user
Settare la password samba:
smbpasswd -x user ( cancella l`utente samba user )
smbpasswd -a user ( inserire la password di samba della share che e` diversa 
da quella di windows e di linux per lo stesso utente )

NFS Unix

Installare NFS

Server:
sudo apt-get install nfs-kernel-server nfs-common portmap
Inseriamo le directory da esportare via nfs:
sudo vi /etc/exports
/mnt  ip_server_nfs/24(rw,no_root_squash,async,no_subtree_check)
/mnt  192.168.2.3/24(rw,no_root_squash,async,no_subtree_check)
sudo /etc/init.d/nfs-kernel-server restart
sudo exportfs
Client:
sudo apt-get install portmap nfs-common
sudo mkdir /q6600
sudo mount ip_server_nfs:/mnt /q6600
sudo mount 192.168.2.3:/mnt /q6600
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart
sudo ln -s /mnt /home/asdf

Sicurezza

Monitoring

Installare Iotop - Monitor i/o su File System

sudo apt-get install iotop

Installare Iftop - Monitor di consumo di banda sulle interfacce di Rete

sudo apt-get install iftop

Installare NetActView - Monitor delle connessioni tcp/udp

wget -O netactview_0.6-1_amd64.deb http://sourceforge.net/projects/netactview/files/netactview/netactview-0.6/netactview_0.6-1_amd64.deb/download
sudo dpkg -i netactview*.deb
netactview

Firewall

Installare Gufw - Firewall Front-End per ufw

sudo apt-get install gufw
gufw

Sniffer

Netstat Avanzato

netstat --tcp
netstat --tcp --numeric
netstat --tcp --listening --programs
netstat --tcp -all --listening --programs
netstat --route
netstat --statistics --raw

Netactview

wget http://sourceforge.net/projects/netactview/files/netactview/netactview-0.6.1/netactview_0.6.1-1_amd64.deb
apt-get install gksu libgksu2-0
dpkg -i netactview_0.6.1-1_amd64.deb  

Intercettare le url richiamate dai software internet, simile a urlsnarf

sudo apt-get install ngrep
sudo ngrep -d ppp0 -W byline | egrep -o "http:.*"
sudo ngrep -d eth0 -W byline | egrep -o "http:.*"
sudo ngrep -d ppp0 -t '^(GET|POST) '
sudo ngrep -d ppp0 -t '' 'tcp and port 80'
sudo ngrep -d ppp0 -t '' 'tcp and port 21'
ngrep -d wlan0 -t '' 'not port 23'
sudo ngrep -d eth0 -W byline -t '' 'udp port 1900'
sudo ngrep -d eth0 -W byline -t '' 'tcp port 49152'

Installare un tool di network auditing and penetration testing

sudo apt-get install dsniff
sudo urlsnarf -i wlan0

Installare lo Sniffer TCP/IP Wireshark

sudo apt-get install wireshark

Installare NMAP

sudo apt-get install nmap nmapfe

Programmazione

Shell

Installare Zenity - Interfaccia grafica per le shell

sudo apt-get install zenity

Installare Meld - Interfaccia grafica per confrontare file simile a diff

sudo apt-get install meld

Android

Android Tools


First activate adb wireless app on android device

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot

adb connect 192.168.2.5:5555
connected to 192.168.2.5:5555

adb devices
List of devices attached 
192.168.2.5:5555	device

adb shell
root@android:/ # 

Editor

Installare Nedit - Programmer's notepad editor, con funzionalita' simili a Ultraedit

sudo apt-get install nedit
<CTLR-MUOSE> per copiare in modalita' colonna

Installare Notepad++ con Wine

mkdir ~/.notepadpp
cd ~/.notepadpp
wget http://download.tuxfamily.org/notepadplus/6.5.3/npp.6.5.3.Installer.exe
env $PWD='pwd' WINEPREFIX=$PWD wine ./npp*Installer.exe
cd ~/.notepadpp ; env $PWD='pwd' WINEPREFIX=$PWD wine ./drive_c/Notepad++/notepad++.exe  
Modificare il valore del seguente registro nel file system.reg per aumentare la grandezza del font:
Da:  "LogPixels"=dword:00000060
a:   "LogPixels"=dword:00000078
Notepad++ escape:
\n	<LF>
\r	<CR>

Installare Geany, simile a Notepad++

sudo apt-get install geany

Installare GHex - Hex Editor

sudo apt-get install ghex

DBMS

Howto Install Oracle XE

Download and install necessary files:
wget -c http://oss.oracle.com/debian/dists/unstable/main/binary-i386/libaio_0.3.104-1_i386.deb 
http://oss.oracle.com/debian/dists/unstable/non-free/binary-i386/oracle-xe-universal_10.2.0.1-1.1_i386.deb
sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.1_i386.deb
apt-get -f install
Now configure it (port, password...):
sudo /etc/init.d/oracle-xe configure
Add this variable to env:
vi ~/.bashrc
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE
export PATH
Go to: http://127.0.0.1:8080/apex ( work only with 127.0.0.1 IP)
User: sys or sysadm
Pwd: your password
Unlock HR Account and grant Debug Connect Session:
sqlplus system@xe
alter user hr identified by hr account unlock;
GRANT DEBUG CONNECT SESSION TO HR;

Howto Install Oracle 11 Database

Download --> linux.x64_11gR1_database_1013.zip
sudo apt-get install gcc libaio1 lesstif2 lesstif2-dev make rpm libc6 libstdc++5 ksh
Poiche' ubuntu non e' certificato per oracle, creare il seguente file dummy:
sudo vi /etc/redhat-release
Red Hat Enterprise Linux AS release 3 (Taroon)
sudo groupadd oinstall
sudo groupadd dba
sudo groupadd nobody
sudo useradd -m oracle -g oinstall -G dba -s /bin/bash
sudo passwd oracle
sudo mkdir /oracle
sudo mkdir /oracle/11g
sudo chown -R oracle:oinstall /oracle
sudo chmod -R 775 /oracle
sudo cp /etc/sysctl.conf /etc/sysctl.conf.old
sudo vi /etc/sysctl.conf
fs.file-max = 76800
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
sudo /sbin/sysctl -p
sudo cp /etc/security/limits.conf /etc/security/limits.conf.ori
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
sudo cp /etc/pam.d/login /etc/pam.d/login.old
sudo vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
sudo vi /etc/profile
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/11g
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH:.
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
su - oracle
password
mkdir scomp
cd scomp
sudo cp linux.x64_11gR1_database_1013.zip /oracle/scomp
unzip linux.x64_11gR1_database_1013.zip
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
sudo ln -s /usr/bin/basename /bin/basename
Scollegarsi con il proprio utente e loggarsi in modo grafico con utente Oracle.
Poi lanciare da terminale:
/home/oracle/database/runInstaller 

Howto Install Oracle 11 Client (Tested Ubuntu 12.10) + PHP OCI/PDO_OCI

user asdf
Download linux.x64_11gR2_client.zip in /home/asdf/
unzip linux.x64_11gR2_client.zip
cd client
su 
chmod 777 /opt
export http_proxy=http://localhost:5865
apt-get install build-essential libaio1 lesstif2 lesstif2-dev make rpm libc6 libstdc++5 ksh
mkdir /usr/lib64
ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/libpthread_nonshared.a
ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libc_nonshared.a
ln -s /usr/bin/basename /bin/basename
ln -s /usr/bin/awk /bin/awk
exit

with user asdf run: 
export DISPLAY=10.88.129.20:0.0 ; ./runInstaller 

Insert oracle variable in .bashrc: 
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/client_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin:.
export TNS_ADMIN=$ORACLE_HOME/network/admin

Install php oci/pdo extension

apt-get install apache2 php5 php5-cli rpm
export https_proxy=http://localhost:5865
wget https://oss.oracle.com/projects/php/dist/files/EL5/x86_64/php54-oci8-11gR2-5.4.7-1.el5.x86_64.rpm
rpm2cpio php54-oci8-11gR2-5.4.7-1.el5.x86_64.rpm | cpio -i --make-directories
Get PHP Extension 	20100525 --> /usr/lib/php5/20100525/
cp ./usr/lib64/php/modules/oci8.so /usr/lib/php5/20100525/
Scan this dir for additional .ini files -->	/etc/php5/apache2/conf.d
cp ./etc/php.d/oci8.ini /etc/php5/apache2/conf.d

Change the php.ini for debug option:
vi /etc/php5/apache2/php.ini
error_reporting  =  E_ALL 
display_errors = On
html_errors = On

Discovery error loading library with strace and /var/log/apache2/error.log:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0

strace -f -o trace.txt service apache2 restart
mkdir /usr/lib/oracle/
mkdir /usr/lib/oracle/11.2/
mkdir /usr/lib/oracle/11.2/client64/
mkdir /usr/lib/oracle/11.2/client64/lib
ln -s /opt/oracle/product/11.2.0/client_1/lib/* /usr/lib/oracle/11.2/client64/lib
service apache2 restart
Now oci8 section is visible in phpinfo()

wget ftp://ftp.pbone.net/mirror/rpms.famillecollet.com/enterprise/5/remi/x86_64/php-oci8-5.4.12-1.el5.remi.x86_64.rpm
rpm2cpio php-oci8-5.4.12-1.el5.remi.x86_64.rpm  | cpio -i --make-directories
cp ./usr/lib64/php/modules/pdo_oci.so /usr/lib/php5/20100525/
cp ./etc/php.d/pdo_oci.ini /etc/php5/apache2/conf.d
ln -s /opt/oracle/product/11.2.0/client_1/network/admin/tnsnames.ora /etc/tnsnames.ora
service apache2 restart
Now PDO_OCI section is visible in phpinfo()

Install SQLDeveloper

sudo apt-get remove --purge openjdk-* icedtea-* icedtea6-*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
java -version

Download sqldeveloper-3.2.20.09.87-no-jre.zip in /home/asdf
unzip sqldeveloper-3.2.20.09.87-no-jre.zip
cd sqldeveloper/
chmod +x sqldeveloper.sh
echo "/usr/lib/jvm/java-6-oracle" >~/.sqldeveloper/jdk
./sqldeveloper.sh

IDE

Installare Eric - Tool IDE per lo sviluppo in linguaggio Python

sudo apt-get install eric

Installare SPE - Tool IDE per lo sviluppo in linguaggio Python

sudo apt-get install spe

Installare Glade - Tool per lo sviluppo di GUI

sudo apt-get install glade

Version Control

Installare Subversion Http Server ( svn )

sudo apt-get install apache2 subversion libapache2-svn
sudo rm -rf /svn/*
sudo rmdir /svn
sudo svnadmin create /svn
sudo chown -R www-data:www-data /svn
sudo gedit /etc/apache2/mods-enabled/dav_svn.conf
<Location /svn>
DAV svn
SVNPath /svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
</Location>
sudo service apache2 restart
http://localhost/svn/

Installare Subversion Http Server ( svn ) in Dropbox

sudo apt-get install apache2 subversion libapache2-svn
sudo svnadmin create /home/asdf/Dropbox/svn
sudo chown -R www-data:www-data /home/asdf/Dropbox/svn
sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

<Location /Dropbox/svn>
DAV svn
SVNPath /home/asdf/Dropbox/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
</Location>

sudo service apache2 restart

http://localhost/Dropbox/svn/

Installare Subversion ( svn )

sudo apt-get install subversion

Installare RapidSVN - Subversion Gui

sudo apt-get install rapidsvn 

Installare Meld - Tool Grafico per visualizzare differenze di versione

sudo apt-get install meld

PHP

Installare XDEBUG

sudo apt-get install php5-xdebug
Change the php.ini:
sudo gedit /etc/php5/apache2/php.ini
error_reporting  =  E_ALL 
display_errors = On
html_errors = On
And restart apache:
sudo /etc/init.d/apache2 restart
Config: /etc/php5/conf.d/xdebug.ini
        /etc/php5/apache2/conf.d/20-xdebug.ini
#zend_extension=/usr/lib/php5/20090626/xdebug.so
zend_extension=/usr/lib/php5/20121212/xdebug.so
xdebug.auto_trace=On
xdebug.collect_params=4
xdebug.collect_return=On
xdebug.trace_output_name = trace.%c.%R

error_reporting = E_ALL & E_STRICT
display_errors = On
display_startup_errors = On
log_errors = On
html_errors = On

xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

Make sure xdebug.remote_enable On On with phpinfo.php

Test:
php -v
PHP 5.3.3-1ubuntu9.3 with Suhosin-Patch (cli) (built: Jan 12 2011 16:07:38) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
WDTV Config:
/etc/php5/conf.d/xdebug.ini
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.var_display_max_data = 1024
xdebug.var_display_max_children = 1024
xdebug.var_display_max_depth = 1024

PYTHON

Installare Eclipse + PyDev

sudo apt-get remove --purge openjdk-* icedtea-* icedtea6-* oracle-java6-*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
java -version

sudo apt-get install eclipse
Help --> Install New Software --> http://pydev.org/updates 
--> Add --> PyDev --> PyDev --> next --> finish

Window --> Preferences --> PyDev --> Interpreters 
--> Python Interpreter --> Quick Auto-Config --> Apply

Restart Eclipse

Grafica

Installare Autotrace - Tool per convertire immagini da bitmap a vettoriale

sudo apt-get install autotrace

Kernel Trace

Installare strace

sudo apt-get install strace
Per monitorare apache:
service apache2 stop
strace -f -o trace.txt service apache2 start 
Per monitorare i file utilizzati:
strace -f -o trace.txt -e trace=open,stat,chmod,unlink service apache2 start
Per monitorare i socket utilizzati:
strace -f -o trace.txt -e poll,select,connect,recvfrom,sendto service apache2 start

UPNP

Upnp Diagnostic

sudo apt-get install gupnp-tools

Installare Foobar + UPNP Component

http://www.foobar2000.org/?page=Download

http://www.foobar2000.org/components/view/foo_upnp

Library –> Components –> Install –> Restart Foobar

View –> UPNP Browser

Giochi

Cheat

Scanmem

 
sudo apt-get install scanmem gameconqueror

Send Command: pid 3086
Send Command: reset
Send Command: list
Send Command: option scan_data_type bytearray
Send Command: option region_scan_level 2
Send Command: reset
Send Command: 3f c9
Send Command: list

Educational

Installare Minecraft

Installare prima Sun Java7:

 
sudo apt-get remove --purge openjdk-* icedtea-* icedtea6-*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
java -version

Installare Minecraft:

download minecraft.jar
export LD_LIBRARY_PATH="/usr/lib/jvm/java-7-oracle/jre/lib/amd64" 
#java -Xmx1024M -Xms512M -cp /home/asdf/minecraft/minecraft.jar net.minecraft.LauncherFrame
java -Xmx1024M -Xms512M -jar /home/asdf/minecraft/minecraft.jar

Creare la Icona sul Desktop:

gnome-desktop-item-edit ~/Desktop/ --create-new

Installare software educational per bambini GCompris

sudo apt-get install gcompris
sudo apt-get install gcompris-sound-it
sudo apt-get install tuxpaint

Arcade

Installare PCSX2 Emulator (Natty32 chroot)

schroot -c natty-32
export DISPLAY=:0.0
sudo apt-get install libwxbase2.8-0 libwxgtk2.8-0 libportaudio2 libsdl1.2debian-all libglew1.5 nvidia-cg-toolkit joystick libasound2 nvidia-glx-173 libbz2-1.0 libxxf86vm1

Installare il gioco Arkanoid Space Ball

sudo apt-get install libsdl-image1.2:i386 libsdl-mixer1.2:i386 libdirectfb-1.2-9:i386 libaa1:i386 freeglut3:i386 libxmu6:i386 libGLU1-mesa:i386
sudo ln -s /usr/lib/i386-linux-gnu/libdirectfb-1.2.so.9.0.1 /usr/lib/i386-linux-gnu/libdirectfb-0.9.so.25
sudo ln -s /usr/lib/i386-linux-gnu/libfusion-1.2.so.9.0.1 /usr/lib/i386-linux-gnu/libfusion-0.9.so.25
sudo ln -s /usr/lib/i386-linux-gnu/libdirect-1.2.so.9.0.1 /usr/lib/i386-linux-gnu/libdirect-0.9.so.25
wget http://www.wegroup.org/downloads/arkanoidsb-1.1.9.tar.bz2
tar xvfj arkanoidsb-1.1.9.tar.bz2 
cd arkanoidsb/
./arkanoidsb

Installare il gioco Linux BreakOut 2

sudo apt-get install lbreakout2

Installare il gioco Frozen Bubble

sudo apt-get install frozen-bubble

Installare il gioco Action Ball 2

mkdir ~/.action_ball_2
cd ~/.action_ball_2
wget http://files.myplaycity.com/files/actionball2_setup.exe
env $PWD='pwd' WINEPREFIX=$PWD wine ./actionball2_setup.exe 

Installare il gioco Abe

sudo apt-get install abe

Installare il gioco NeverBall

sudo apt-get install neverball

Installare il gioco Linux AstroMenace

 wget http://www.viewizard.com/download/amenace12.tar.bz2
 tar xvfj amenace12.tar.bz2 
 cd astromenace/
 ./game_launcher

Installare il gioco Linux Chromium B.S.U.

sudo apt-get install chromium

Installare il gioco Linux Glaxium

wget http://xhosxe.free.fr/glaxium/glaxium_0.5.tar.gz
tar xvfz glaxium_0.5.tar.gz
cd glaxium_0.5/
./configure
sed 's/TankFire:://' tank.hpp >tank_patch.hpp ; cp tank_patch.hpp tank.hpp
sed 's/Scratcher:://' scratcher.hpp >scratcher_patch.hpp ; cp scratcher_patch.hpp scratcher.hpp  
make
sudo make install
glaxium

Simulator

Installare il gioco Linux FooBillard

sudo apt-get install foobillard

Installare il gioco Linux Frets On Fire - Clone di Guitar Hero

sudo apt-get install fretsonfire fretsonfire-game fretsonfire-songs-sectoid
wget http://kent.dl.sourceforge.net/sourceforge/fretsonfire/FretsOnFire-1.2.512-linux.tar.gz
tar xvfz FretsOnFire-1.2.512-linux.tar.gz
cd FretsOnFire/
./FretsOnFire

Installare il gioco Linux FlightGear

sudo apt-get install flightgear

FPS/Action

Installare il gioco Linux OpenArena

sudo apt-get install openarena

Installare il gioco Linux AlienArena

sudo apt-get install alien-arena

Installare il gioco Linux Tremulous

 sudo apt-get install tremulous

Installare il gioco Linux Nexuiz

 sudo apt-get install nexuiz

Installare il gioco Linux Wolfenstein: Enemy Territory

 wget http://gaming.ngi.it/dl/1205685840heeisphcmocbanumueftjbhtczzhzhyq/et-linux-2.60.x86.run
 wget http://gaming.ngi.it/dl/1205685939eksctxehynhwppvsjvdvyntkjuqcvvzu/et-2.60b.zip
 sudo chmod +x et-linux-2.60.x86.run
 sudo ./et-linux-2.60.x86.run
 unzip et-2.60b.zip
 cd Enemy\ Territory\ 2.60b/linux
 sudo cp * /usr/local/games/enemy-territory/
 lanciamo et ed usciamo subito
 cd ~/.etwolf
 wget http://bani.anime.net/etpro/etpro-3_2_6.zip
 unzip etpro-3_2_6.zip
 rm etpro-3_2_6.zip
 sudo cp -R /usr/local/games/enemy-territory/pb ~/.etwolf
 sudo chown -R nomeutente pb/
 sudo chgrp -R nomeutente pb/
 cd pb/
 chmod +x pbweb.x86
 ./pbweb.x86
 aspettare diversi secondi...
 sudo -s
 echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss
 echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss
 exit
 et

Installare il gioco Linux PRBoom, Clone di Doom

 sudo apt-get install prboom
 prboom

Sport

Installare il gioco TrackMania ver. 2.11.11 Nations Forever con Wine

mkdir ~/.tmania
cd ~/.tmania
Download tmnationsforever_setup.exe dai siti proposti dal link: http://appdb.winehq.org/objectManager.php?sClass=version&iId=11595
env $PWD='pwd' WINEPREFIX=$PWD wine tmnationsforever_setup.exe
Aspettare la fine della installazione
wget http://www.dllbank.com/zip/w/wrap_oal.dll.zip
unzip wrap_oal.dll.zip
cp wrap_oal.dll ./drive_c/Program\ Files/TmNationsForever/
wget -O directx_aug2009_redist.exe http://download.microsoft.com/download/B/7/9/B79FC9D7-47B8-48B7-A75E-101DEBEB5AB4/directx_aug2009_redist.exe
cabextract -L -F *d3dx9*x86* directx_aug2009_redist.exe
cabextract -d ./drive_c/Program\ Files/TmNationsForever/ -L -F d3dx9_36.dll *.cab
env $PWD='pwd' WINEPREFIX=$PWD wine "C:\Program Files\TmNationsForever\TmForeverLauncher.exe" 

Installare il gioco Linux VDrift

wget http://switch.dl.sourceforge.net/sourceforge/vdrift/vdrift-2008-08-05-src.tar.bz2 
tar jxvf vdrift-2008-08-05-src.tar.bz2 
cd vdrift-08-05-08/bullet-2.66/
sudo apt-get install libsdl-gfx1.2-4 libsdl-gfx1.2-dev
sudo apt-get install libglew1.5 libglew1.5-dev 
sudo apt-get install jam scons libglut3-dev libvorbis-dev libsdl-gfx1.2-dev libsdl-net1.2-dev libsdl-image1.2-dev libsdl1.2-dev       
sudo ln -s /usr/lib/libGL.so.173.14.12 /usr/lib/libGL.so
./configure -prefix=/usr
jam bulletcollision bulletmath
cd ..
scons
./build/vdrift

Installare il gioco Linux SuperTux SuperTuxKart e ExtremeTuxRacer

sudo apt-get install supertux
sudo apt-get install supertuxkart
sudo apt-get install extremetuxracer

Installare il gioco Linux Maniadrive

wget http://www.getdeb.net/download/2575/0
wget http://www.getdeb.net/download/2575/1
sudo dpkg -i --force-architecture maniadrive*
sudo ln -s /usr/lib32/libopenal.so.1.3.253 /usr/lib32/libopenal.so.0
getlibs libGLEW.so.1.5
maniadrive

Installare il gioco Linux Torcs

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install libx11-dev libxmu-dev xserver-xorg-dev libxxf86vm-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev plib1.8.4-dev libalut-dev  libpng12-dev
wget http://fastbull.dl.sourceforge.net/sourceforge/torcs/torcs-1.3.1.tar.bz2
tar xvfj torcs-1.3.1.tar.bz2 
cd torcs-1.3.1/
./configure --x-libraries=/usr/lib/
make
sudo make install
sudo make datainstall
sudo mv icon.png /usr/local/lib/torcs
sudo nano /usr/share/applications/torcs.desktop
[Desktop Entry]
Name=TORCS
Comment=TORCS, The Open Racing Car Simulator is a highly portable multi platform car racing simulation.
Exec=torcs
Icon=/usr/local/lib/torcs/icon.png
Terminal=false
Type=Application
Categories=Application;Game;
Applications tab —> Games —> TORCS

Emulation

Installare Emulatore DOS per vecchi Giochi

sudo apt-get install dosbox
sudo apt-get install pmidi
pmidi -l
Port     Client name                       Port name
14:0     Midi Through                      Midi Through Port-0
128:0     TiMidity                          TiMidity port 0
128:1     TiMidity                          TiMidity port 1
128:2     TiMidity                          TiMidity port 2
128:3     TiMidity                          TiMidity port 3
dosbox .
config -writeconf dosbox.conf
exit
vi dosbox.conf
Modificare i tag:
Memoria:
memsize=63
Risoluzione:
windowresolution=1024x768
output=opengl
scaler=none
Suono:
blocksize=4096
prebuffer=20
config=128:0
Cpu:
cycles=15000 oppure cycles=30000 dipende dalla potenza della propria cpu

Installare il Gioco DOS STARDUST

mkdir dosgames
cd dosgames/
mkdir Stardust
cd Stardust/
http://www.abandonia.com/en/downloadgame/23985 --> Get it --> Copy link location
wget <Link Location>
unzip Super\ Stardust.zip
dosbox .
keyb it
imgmount D: STARDUST.ISO -t iso -fs iso
D:
INSTALL.EXE
Seguire le istruzioni di installazione....
ALT+INVIO per vedere il gioco in fullscreen
GO.EXE

Compile from Source

Compile patchelf

wget http://hydra.nixos.org/build/1524660/download/3/patchelf-0.6.tar.gz
tar xvfz patchelf-0.6.tar.gz
cd patchelf-0.6
./configure
make
readelf -d ./src/patchelf

patchelf --set-interpreter /newroot/bin/ld-linux-x86-64.so.2 ./readelf
patchelf --set-rpath /newroot/bin ./readelf

Compile Apache version 2.0.63

./configure --prefix=$HOME/apache --exec-prefix=$HOME/apache --enable-mods-shared=all --enable-so --build=x86_64 --with-expat=builtin
make
make install

Advanced Boot System

Boot Grub4Dos - NTLDR

Tested with Win XP:

Download: http://download.gna.org/grub4dos/grub4dos-0.4.4.zip
Copy only the following file in C:\ from grub4dos-0.4.4.zip:
menu.lst - grldr - grldr.mbr - grub.exe
Download: ubuntu-12.10-desktop-amd64.iso in c:\ubuntu
Using Winrar extract from boot directory : initrd.lz - vmlinuz in c:\ubuntu
rename file to the correct version of Ubuntu: initrd_ubuntu_12_10.lz - vmlinuz_ubuntu_12_10
Add menu to menu.lst:

title Ubuntu 12.10 Iso
root (hd0,0)
kernel (hd0,0)/ubuntu/vmlinuz_ubuntu_12_10 boot=casper iso-scan/filename=/ubuntu/ubuntu-12.10-desktop-amd64.iso
initrd /ubuntu/initrd_ubuntu_12_10.lz
boot


Backup previously boot.ini
Edit boot.ini :

Click Start, click Run, type sysdm.cpl, and then click OK.
On the Advanced tab, click Settings under Startup and Recovery.
Under System Startup, click Edit.
Add the following line:
c:\grldr.mbr="grub"

so the file boot.ini is:
[boot loader]
timeout=15
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
c:\grldr.mbr="grub"

and save it.

Reboot
Select Grub --> Ubuntu 12.10 Iso

Install Ubuntu in real USB File System with VIRTUALBOX

Create Virtual Machine:

Start virtualbox and click on New
Name:		usb_test
Type:		linux
Version:	Ubuntu 64 bit
Memory Size:	1024

Create a virtual hard drive now --> Create --> VDI --> Dynamically Allocated --> 8 Gb --> Create

Click on Settings --> Got to storage, controller IDE and choose a virtual CD/DVD disk file. Select the Ubuntu installation iso

Click on USB, enable USB 2 controller, and add a filter for usb stick

Start the virtual machine and install Ubuntu with this settings:

Select USB for installation:
8 Gb ext4 /
8 Gb fat32 /windows

and follow normal installation process. At the end, test new installation and backup it with dd.

Backup USB Ubuntu Partition:

su
cd
mkdir backup_sdb
cd backup_sdb

Save partition configuration:

sfdisk -d /dev/sdb > ./sdb_partition.txt

Verify partition configuration:

fdisk -l /dev/sdb

Disk /dev/sdb: 16.0 GB, 16008609792 bytes
64 heads, 32 sectors/track, 15267 cylinders, total 31266816 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008dac6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    11919359     5958656   83  Linux
/dev/sdb2        11921406    31264767     9671681    5  Extended
/dev/sdb5        11921408    31264767     9671680    b  W95 FAT32

UMount partition for save backup:

umount /dev/sdb1
umount /dev/sdb5 

Backup Ubuntu Linux Partition:

dd if=/dev/sdb1 of=./sdb1.bin bs=1024

Backup MBR:

dd if=/dev/sdb of=./sdb.boot.mbr bs=512 count=1

FOR RESTORE PARTITION IN THE FUTURE:

cd backup_sdb
dd if=/dev/zero of=/dev/sdb bs=1M count=1
sfdisk /dev/sdb < ./sdb_partition.txt

fdisk -l /dev/sdb

Disk /dev/sdb: 16.0 GB, 16008609792 bytes
64 heads, 32 sectors/track, 15267 cylinders, total 31266816 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008dac6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    11919359     5958656   83  Linux
/dev/sdb2        11921406    31264767     9671681    5  Extended
/dev/sdb5        11921408    31264767     9671680    b  W95 FAT32

dd if=./sdb1.bin of=/dev/sdb1 bs=1024
dd if=./sdb.boot.mbr of=/dev/sdb bs=512 count=1

Optionally Configure /etc/fstab:

mkdir /media/linux
mkdir /media/win_c

Add this lines to /etc/fstab:
/dev/sda6 /media/linux	auto	
/dev/sda2 /media/win_c	auto
/media/linux/home/asdf /home/asdf bind defaults,bind 0 0

Backup Ubuntu in real USB File System with VIRTUALBOX with one partition

Backup contents

su
cd
cd backup_sdb/
#Use DEV vars to avoid miskake:
export DEV="/dev/sdb"
#Verify variable
echo ${DEV}
#UMount eventually partition
umount ${DEV}0 ${DEV}1 ${DEV}2 ${DEV}3 ${DEV}4 ${DEV}5 ${DEV}6
mkdir -p ./backup_ubuntu_13_10
mkdir -p /tmp/ubuntu
mount ${DEV}1 /tmp/ubuntu
#Copy Data with rsync
rsync -av /tmp/ubuntu/* ./backup_ubuntu_13_10
#Save partition table
sfdisk -d /dev/sdb > ./backup_ubuntu_13_10/sdb_partition.txt
#Save first MB of data
parted ${DEV} -s unit b print

Model: SanDisk Cruzer Edge (scsi)
Disk /dev/sdb: 16008609792B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start     End           Size          Type     File system  Flags
 1      1048576B  16007561215B  16006512640B  primary  ext4         boot


dd if=${DEV} of=./backup_ubuntu_13_10/sdb.grub.mbr bs=1048575 count=1

Restore Contents

#Use DEV vars to avoid miskake:
export DEV="/dev/sdb"
#Verify variable
echo ${DEV}
#UMount eventually partition
umount ${DEV}0 ${DEV}1 ${DEV}2 ${DEV}3 ${DEV}4 ${DEV}5 ${DEV}6
#Restore first MB of data
dd if=./backup_ubuntu_13_10/sdb.grub.mbr of=${DEV} bs=1048575 count=1
#Format
mkfs.ext4 /dev/sdb1
#Mount
mkdir -p /tmp/ubuntu
mount ${DEV}1 /tmp/ubuntu
#Copy Data with rsync
rsync -av ./backup_ubuntu_13_10/* /tmp/ubuntu/ 
#Syncronize to usb stick
sync
#Change blkid in fstab and grub.cfg if the stick/partition is changed
ls -l /dev/disk/by-uuid/
cat /tmp/ubuntu/etc/fstab
sed -i "s/b8c43e1d-125d-49a2-9921-af5f0798da58/78128d23-4bf2-4fc1-948a-4c12385f9ad8/g" /tmp/ubuntu/etc/fstab
chmod 777 /tmp/ubuntu/boot/grub/grub.cfg
sed -i "s/b8c43e1d-125d-49a2-9921-af5f0798da58/78128d23-4bf2-4fc1-948a-4c12385f9ad8/g" /tmp/ubuntu/boot/grub/grub.cfg
umount ${DEV}0 ${DEV}1 ${DEV}2 ${DEV}3 ${DEV}4 ${DEV}5 ${DEV}6

Backup Ubuntu Hard Disk

Backup contents

mkdir /tmp/win_c
mount /dev/sda2 /tmp/win_c
mkdir /tmp/linux
mount /dev/sda5 /tmp/linux
mkdir /tmp/win_c/backup_ubuntu
cd /tmp/win_c/backup_ubuntu
dd if=/dev/zero of=./backup_ubuntu_13_04.bin bs=1G count=4
dd if=/dev/sda of=./sda.boot.mbr.hd bs=1M count=1
mkfs.ext2 ./backup_ubuntu_13_04.bin -F
mkdir /tmp/backup
mount ./backup_ubuntu_13_04.bin /tmp/backup
rsync -av /tmp/linux/* /tmp/backup
sync
cd
umount /tmp/backup
umount /tmp/linux
umount /tmp/win_c

Restore contents

mkdir /tmp/win_c
mount /dev/sda2 /tmp/win_c
mkfs.ext4 /dev/sda5
mkdir /tmp/linux
mount /dev/sda5 /tmp/linux
cd /tmp/win_c/backup_ubuntu
mkdir /tmp/backup
mount ./backup_ubuntu_13_04.bin /tmp/backup
rsync -av /tmp/backup/* /tmp/linux
sync
ls -l /dev/disk/by-uuid/
cat /tmp/linux/etc/fstab
sed -i "s/fc1b201f-4082-4811-929d-f29bceef3a96/a3f087cf-3bf3-4f6d-a55e-066a68c69a00/g" /tmp/linux/etc/fstab
chmod 777 /tmp/linux/boot/grub/grub.cfg
sed -i "s/fc1b201f-4082-4811-929d-f29bceef3a96/a3f087cf-3bf3-4f6d-a55e-066a68c69a00/g" /tmp/linux/boot/grub/grub.cfg
cd
umount /tmp/backup
umount /tmp/linux
umount /tmp/win_c

Configure mbr/grub2 on USB Stick

Boot from another usb with iso ubuntu live cd
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair && (boot-repair &)
repair mbr
repair grub2

Android Grub 0.97 menu.lst on USB Stick Boot

Copy /boot on first Android boot partition and add the last configuration. Remember to change root=UUID tag:

default=0
timeout=6
splashimage=/grub/android-x86.xpm.gz
root (hd0,0)

title Android-x86 4.4-RC1
	kernel /android-4.4-RC1/kernel quiet root=/dev/ram0 androidboot.hardware=android_x86 video=-16 SRC=/android-4.4-RC1
	initrd /android-4.4-RC1/initrd.img

title Android-x86 4.4-RC1 (Debug mode)
	kernel /android-4.4-RC1/kernel root=/dev/ram0 androidboot.hardware=android_x86 video=-16 DEBUG=2 SRC=/android-4.4-RC1
	initrd /android-4.4-RC1/initrd.img

title Android-x86 4.4-RC1 (Debug nomodeset)
	kernel /android-4.4-RC1/kernel nomodeset root=/dev/ram0 androidboot.hardware=android_x86 video=-16 DEBUG=2 SRC=/android-4.4-RC1
	initrd /android-4.4-RC1/initrd.img

title Android-x86 4.4-RC1 (Debug video=LVDS-1:d)
	kernel /android-4.4-RC1/kernel video=LVDS-1:d root=/dev/ram0 androidboot.hardware=android_x86 video=-16 DEBUG=2 SRC=/android-4.4-RC1
	initrd /android-4.4-RC1/initrd.img

title Ubuntu 14.10
	kernel	/boot/vmlinuz-3.13.0-24-generic root=UUID=80675304-6f64-4836-9331-8a27a30ff914 ro splash
	initrd	/boot/initrd.img-3.13.0-24-generic

Live Ubuntu form Hard Disk to RAM + ISO Creation

#Create Workdir file
su
cd /media/win_c
dd if=/dev/zero of=./ubuntu_temp.bin bs=1G count=11
cd /media/win_c
mkfs.ext2 ./ubuntu_temp.bin -F
DEST=/tmp/ubuntu_temp
mkdir -p ${DEST}
mount ./ubuntu_temp.bin ${DEST}
ls -l ${DEST}

#Install Dependencies and update initramfs
apt-get update
apt-get upgrade
apt-get install --yes squashfs-tools live-boot live-boot-initramfs-tools linux-image-extra-$(uname -r)
depmod -a
update-initramfs -u

#Copy Root File System
rsync -av --delete / ${DEST} --one-file-system \
--exclude=/proc/* --exclude=/tmp/* --exclude=/dev/* \
--exclude=/sys/* --exclude=/media/* \
--exclude=/home/* --exclude=/etc/mtab \
--exclude=/run/user/*/gvfs --exclude=/mnt/*  \
--exclude=/live --exclude=${DEST}

#Remove old root partition config and leave ntfs mounted on /media/win_c
sed -i '/^UUID=[-0-9a-z]*[ ]*\/[ ]/d' $DEST/etc/fstab
cat $DEST/etc/fstab

#Create Media Directory For Mounting Point File System
mkdir ${DEST}/home/asdf
chown -R asdf:asdf ${DEST}/home/
mkdir ${DEST}/media/home
mkdir ${DEST}/media/win_c
mkdir ${DEST}/media/linux

#Remove Apparmor and Compile VirtualBox Kerner Driver
mkdir -p ${DEST}/proc
mount -t proc none ${DEST}/proc
mkdir -p ${DEST}/dev
mount --bind /dev ${DEST}/dev
mkdir -p ${DEST}/dev/pts
mount --bind /dev/pts ${DEST}/dev/pts
mkdir -p ${DEST}/sys
mount --bind /sys ${DEST}/sys
chroot ${DEST} apt-get remove --yes --purge apparmor 
chroot ${DEST} apt-get install --yes linux-headers-$(uname -r)
chroot ${DEST} /etc/init.d/vboxdrv setup
umount -l ${DEST}/proc
umount -l ${DEST}/dev/pts
umount -l ${DEST}/dev
umount -l ${DEST}/sys

#Remove Temporary Files
[ -n "$DEST" ] && sudo find ${DEST}/var/run ${DEST}/var/mail ${DEST}/var/spool ${DEST}/var/lock ${DEST}/var/backups ${DEST}/var/tmp -type f -exec rm {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iregex '.*\.[0-9].*' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iname '*.gz' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f | while read file; do echo | sudo tee $file; done

[ -n "$DEST" ] && sudo rm -v ${DEST}/var/cache/apt/archives/*.deb

#Create link for read/write configuration
mkdir -p /media/win_c/etc
[ -f "/media/win_c/etc/rc.local" ] || cp /etc/rc.local /media/win_c/etc/rc.local
cd ${DEST}/etc
rm rc.local
ln -s /media/win_c/etc/rc.local rc.local 
ls -l rc.local

#Make Read Only Squashfs
rm -rf /live
mkdir /live
mksquashfs ${DEST} /live/filesystem.squashfs -noappend -always-use-fragments -comp xz
ls -lh /live/filesystem.squashfs 

#Create Grub2 Menu Entry
cat << EOF > ./custom_menu.txt
#!/bin/sh
exec tail -n +3 \$0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

EOF

awk '/BEGIN \/etc\/grub.d\/10_linux/,/END \/etc\/grub.d\/10_linux/' /boot/grub/grub.cfg | awk "/menuentry 'Ubuntu' --class ubuntu/,/submenu/" | grep -v submenu >>./custom_menu.txt

sed -i 's/root=UUID.*/boot=live toram=filesystem.squashfs username=asdf debug/' ./custom_menu.txt

sed -i "s/Ubuntu/RAMDISK Session Ubuntu/" ./custom_menu.txt

cat ./custom_menu.txt

cp ./custom_menu.txt /etc/grub.d/40_custom
update-grub2




################## Advanced Configuration ########################

###Sharing Home Configuration with Hard Disk
vi /media/win_c/etc/rc.local 
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
mount /dev/sda5 /media/linux
mount --bind /media/linux/home /home
mkdir /run/shm/.cache
chmod 777 /run/shm/.cache
mount --bind /home/asdf/.cache /run/shm/.cache
exit 0


###Sharing home file:
cd /media/win_c
dd if=/dev/zero of=./ubuntu_home.bin bs=1G count=2
mkfs.ext2 ./ubuntu_home.bin -F
mkdir /tmp/ubuntu_home
mount ./ubuntu_home.bin /tmp/ubuntu_home
ls -l /tmp/ubuntu_home
rsync -av /home /tmp/ubuntu_home
chown -R asdf:asdf /tmp/ubuntu_home/home
chown root:root /tmp/ubuntu_home/home
sync
umount /tmp/ubuntu_home
vi /media/win_c/etc/rc.local 
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
mkdir /media/home
mount /media/win_c/ubuntu_home.bin /media/home
mount --bind /media/home /home
exit 0


################## Make Live CD ########################
#Create Workdir CDROM file
cd /media/win_c
DEST=/tmp/ubuntu_temp
mkdir -p ${DEST}
mount ./ubuntu_temp.bin ${DEST}
ls -l ${DEST}
CDROM=/home/asdf/cdrom
mkdir -p ${CDROM}
ls -l ${CDROM}

#Install Livecd Dependencies
mkdir ${DEST}/run/resolvconf
cp /etc/resolv.conf ${DEST}/run/resolvconf/resolv.conf
mkdir -p ${DEST}/proc
mount -t proc none ${DEST}/proc
mkdir -p ${DEST}/dev
mount --bind /dev ${DEST}/dev
mkdir -p ${DEST}/dev/pts
mount --bind /dev/pts ${DEST}/dev/pts
mkdir ${DEST}/sys
mount --bind /sys ${DEST}/sys
chroot ${DEST} apt-get install --yes dbus
chroot ${DEST} dbus-uuidgen > /var/lib/dbus/machine-id
chroot ${DEST} dpkg-divert --local --rename --add /sbin/initctl
chroot ${DEST} ln -s /bin/true /sbin/initctl
chroot ${DEST} mkdir -p /boot
chroot ${DEST} apt-get install --yes ubuntu-standard casper lupin-casper discover laptop-detect os-prober linux-generic grub
chroot ${DEST} apt-get install --yes linux-image-extra-$(uname -r) linux-headers-$(uname -r)
chroot ${DEST} /etc/init.d/vboxdrv setup
chroot ${DEST} depmod -a
chroot ${DEST} update-initramfs -u
chroot ${DEST} rm /var/lib/dbus/machine-id
chroot ${DEST} rm /sbin/initctl
chroot ${DEST} dpkg-divert --rename --remove /sbin/initctl
umount ${DEST}/proc
umount ${DEST}/dev/pts
umount ${DEST}/dev
umount ${DEST}/sys
rm ${DEST}/run/resolvconf/resolv.conf

#Remove old win partition because it is mounted by default /isodevice
sed -i '/win_c/d' $DEST/etc/fstab
cat $DEST/etc/fstab
rm $DEST/etc/rc.local
ln -s /isodevice/etc/rc.local $DEST/etc/rc.local 
ls -l $DEST/etc/rc.local

[ -n "$DEST" ] && sudo find ${DEST}/var/run ${DEST}/var/mail ${DEST}/var/spool ${DEST}/var/lock ${DEST}/var/backups ${DEST}/var/tmp -type f -exec rm {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iregex '.*\.[0-9].*' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iname '*.gz' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f | while read file; do echo | sudo tee $file; done

[ -n "$DEST" ] && sudo rm -v ${DEST}/var/cache/apt/archives/*.deb

#create_squashfs
rm ${DEST}/var/lib/apt/lists/*_Packages
rm ${DEST}/var/lib/apt/lists/*_Release
mkdir -p ${CDROM}/casper
rm ${CDROM}/casper/*
ls -ltr ${CDROM}/casper/*
rm ${CDROM}/casper/filesystem.squashfs
mksquashfs ${DEST} ${CDROM}/casper/filesystem.squashfs -noappend -always-use-fragments -comp xz
chmod a+rw ${CDROM}/casper/filesystem.squashfs


#create_manifest
chroot ${DEST} dpkg-query -W --showformat='${Package} ${Version}\n' | tee ${CDROM}/casper/filesystem.manifest
cp -v ${CDROM}/casper/filesystem.manifest ${CDROM}/casper/filesystem.manifest-desktop
REMOVE='ubiquity casper user-setup  os-prober'
for i in $REMOVE
do
sed -i "/${i}/d" ${CDROM}/casper/filesystem.manifest-desktop
done
printf $(du -sx --block-size=1 ${DEST} | cut -f1) > ${CDROM}/casper/filesystem.size
ls -ltr ${CDROM}/casper

#create_iso
mkdir -p /tmp/ubuntu
mount /media/win_c/ubuntu/ubuntu-13.04-desktop-amd64.iso /tmp/ubuntu
ls -ltr /tmp/ubuntu/casper
cp /tmp/ubuntu/casper/vmlinuz.efi ${CDROM}/casper/vmlinuz.efi
cp /tmp/ubuntu/casper/initrd.lz ${CDROM}/casper/initrd.lz
#cp ${DEST}/boot/vmlinuz-$(uname -r) ${CDROM}/casper/vmlinuz
cp /boot/vmlinuz-$(uname -r) ${CDROM}/casper/vmlinuz
cp ${DEST}/boot/initrd.img-$(uname -r) ${CDROM}/casper/initrd.gz
ls -ltr ${CDROM}/casper
mkdir ${CDROM}/boot
mkdir ${CDROM}/boot/grub

cat << EOF >${CDROM}/boot/grub/grub.cfg
set default="0"
set timeout=10

menuentry "Ubuntu GUI" {
linux /casper/vmlinuz boot=casper quiet splash
initrd /casper/initrd.img
}


menuentry "Ubuntu in safe mode" {
linux /casper/vmlinuz boot=casper xforcevesa quiet splash
initrd /casper/initrd.img
}


menuentry "Ubuntu CLI" {
linux /casper/vmlinuz boot=casper textonly quiet splash
initrd /casper/initrd.img
}


menuentry "Ubuntu GUI persistent mode" {
linux /casper/vmlinuz boot=casper persistent quiet splash
initrd /casper/initrd.img
}
EOF

find ${DEST}/boot ${DEST}/usr/lib/grub/ -iname 'stage2_eltorito' -exec cp -v {} ${CDROM}/boot/grub \;
rm /media/win_c/ubuntu/mylivecd-0.2.iso
mkisofs -R -U -V CUSTOM -b boot/grub/stage2_eltorito \
  -no-emul-boot -boot-load-size 4 -boot-info-table \
  -o /media/win_c/ubuntu/mylivecd-0.2.iso ${CDROM}
ls -ltr /media/win_c/ubuntu/mylivecd-0.2.iso


add /etc/grub.d/40_custom
menuentry "Ubuntu 13.04 MY ISO" {

set isofile="/ubuntu/mylivecd-0.2.iso"

loopback loop (hd0,2)$isofile

linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject

initrd (loop)/casper/initrd.lz

}

update-grub2



############### RAM USER PROFILE ###############
First RSync Disk to Memory:
mv Downloads /opt/Downloads
ln -s /opt/Downloads Downloads
rsync -av /home/ /run/shm
mount --bind  /run/shm/asdf /home/asdf

First RSync Memory to Disk:
mkdir /homes
mkdir /homes/asdf
rsync -av /run/shm/asdf/ /homes/asdf
chown asdf:asdf /homes/asdf

RSync in rc.local Disk to Memory at Startup:
vi /etc/rc.local
rsync -av /homes/ /run/shm
mount --bind  /run/shm/asdf /home/asdf
nohup /root/update_disk.sh &

RSync in crontab Memory to Disk every 1 minute:
cd /root
vi update_disk.sh
chmod 1777 /dev/shm
while true 
do
sleep 60 
echo `date "+%Y-%m-%d %H:%M:%S"` >>/run/shm/update_disk.log 2>&1
rsync -av --delete /run/shm/asdf/ /homes/asdf >>/run/shm/update_disk.log 2>&1
done

chmod +x ./update_disk.sh

Live Ubuntu form Hard Disk to ISO

#Create temporary workspace
su
cd /media/win_c
dd if=/dev/zero of=./ubuntu_temp.bin bs=1G count=11
mkfs.ext2 ./ubuntu_temp.bin -F
mkdir /tmp/ubuntu_temp
mount ./ubuntu_temp.bin /tmp/ubuntu_temp
ls -l /tmp/ubuntu_temp

#Install Dependencies 
apt-get update
apt-get upgrade
apt-get install squashfs-tools debootstrap genisoimage mkisofs grub squashfs-tools xorriso

#Make rootfs
DEST=/tmp/ubuntu_temp/rootfs
mkdir -p ${DEST}
ls -l ${DEST}
CDROM=/tmp/ubuntu_temp/cdrom
mkdir -p ${CDROM}
ls -l ${CDROM}
rsync -av --delete / ${DEST} --one-file-system \
--exclude=/proc/* --exclude=/tmp/* --exclude=/dev/* \
--exclude=/live/* \
--exclude=/sys/* --exclude=/boot/* \
--exclude=/home/* --exclude=/etc/mtab \
--exclude=/live --exclude=${DEST}

rsync -av --delete /opt/VBoxGuestAdditions-4.3.8/ ${DEST}/opt/VBoxGuestAdditions-4.3.8/

#Install Livecd Dependencies
mkdir ${DEST}/run/resolvconf
cp /etc/resolv.conf ${DEST}/run/resolvconf/resolv.conf
mkdir -p ${DEST}/proc
mount -t proc none ${DEST}/proc
mkdir -p ${DEST}/dev
mount --bind /dev ${DEST}/dev
mkdir -p ${DEST}/dev/pts
mount --bind /dev/pts ${DEST}/dev/pts
mkdir -p ${DEST}/sys
mount --bind /sys ${DEST}/sys
chroot ${DEST} /bin/bash
apt-get install --yes dbus
dbus-uuidgen > /var/lib/dbus/machine-id
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
mkdir /boot/grub
apt-get install --yes ubuntu-standard casper lupin-casper discover laptop-detect os-prober linux-generic
apt-get install linux-headers-$(uname -r)
/etc/init.d/vboxdrv setup
/etc/init.d/vboxadd setup
depmod -a
update-initramfs -u
rm /var/lib/dbus/machine-id
rm /sbin/initctl
dpkg-divert --rename --remove /sbin/initctl
exit
umount ${DEST}/proc
umount ${DEST}/dev/pts
umount ${DEST}/dev
umount ${DEST}/sys

rm ${DEST}/run/resolvconf/resolv.conf
vi ${DEST}/etc/fstab
delete UUID row

mkdir ${DEST}/home/asdf
chown -R asdf:asdf ${DEST}/home/

[ -n "$DEST" ] && sudo find ${DEST}/var/run ${DEST}/var/mail ${DEST}/var/spool ${DEST}/var/lock ${DEST}/var/backups ${DEST}/var/tmp -type f -exec rm {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iregex '.*\.[0-9].*' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iname '*.gz' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f | while read file; do echo | sudo tee $file; done

[ -n "$DEST" ] && sudo rm -v ${DEST}/var/cache/apt/archives/*.deb

#create_squashfs
rm ${DEST}/var/lib/apt/lists/*_Packages
rm ${DEST}/var/lib/apt/lists/*_Release
mkdir ${CDROM}/casper
mksquashfs ${DEST} ${CDROM}/casper/filesystem.squashfs
chmod a+rw ${CDROM}/casper/filesystem.squashfs

#create_manifest
chroot ${DEST} dpkg-query -W --showformat='${Package} ${Version}\n' | tee ${CDROM}/casper/filesystem.manifest
cp -v ${CDROM}/casper/filesystem.manifest ${CDROM}/casper/filesystem.manifest-desktop
REMOVE='ubiquity casper user-setup  os-prober'
for i in $REMOVE
do
sed -i "/${i}/d" ${CDROM}/casper/filesystem.manifest-desktop
done
printf $(du -sx --block-size=1 ${DEST} | cut -f1) > ${CDROM}/casper/filesystem.size
ls -ltr ${CDROM}/casper

#create_iso
cp ${DEST}/boot/vmlinuz-*-generic ${CDROM}/casper/vmlinuz
cp ${DEST}/boot/initrd.img-*-generic ${CDROM}/casper/initrd.img
mkdir ${CDROM}/boot
mkdir ${CDROM}/boot/grub

cat << EOF >${CDROM}/boot/grub/grub.cfg
set default="0"
set timeout=10

menuentry "Ubuntu GUI" {
linux /casper/vmlinuz boot=casper quiet splash
initrd /casper/initrd.img
}


menuentry "Ubuntu in safe mode" {
linux /casper/vmlinuz boot=casper xforcevesa quiet splash
initrd /casper/initrd.img
}


menuentry "Ubuntu CLI" {
linux /casper/vmlinuz boot=casper textonly quiet splash
initrd /casper/initrd.img
}


menuentry "Ubuntu GUI persistent mode" {
linux /casper/vmlinuz boot=casper persistent quiet splash
initrd /casper/initrd.img
}
EOF

#find /boot /usr/lib/grub/ -iname 'stage2_eltorito' -exec cp -v {} ${CDROM}/boot/grub \;
#mkisofs -R -U -V CUSTOM -b boot/grub/stage2_eltorito \
#  -no-emul-boot -boot-load-size 4 -boot-info-table \
#  -o /media/win_c/ubuntu/mylivecd-0.2.iso ${CDROM}

grub-mkrescue -o mylivecd-0.2.iso ${CDROM}

cp ${DEST}/boot/vmlinuz-*-generic /media/win_c/ubuntu/vmlinuz_ubuntu_my_13_04
cp ${DEST}/boot/initrd.img-*-generic /media/win_c/ubuntu/initrd_ubuntu_my_13_04

Configure LiveCD Persistence in Virtualbox

User	Password
asdf	asdf
root	root

Format Hard Disk for Casper:
su
cfdisk
mkfs.ext3 -b 4096 -L casper-rw /dev/sda1
reboot

Boot from Livecd:
F12
c
Ubuntu Persistent Mode
Select Gnome Classic (No effect)
Run apache on Pc Windows and download/run guest addiction
wget http://10.88.128.21/VBoxGuestAdditions.iso
mkdir /tmp/iso
sudo mount VBoxGuestAdditions.iso  /tmp/iso
sudo /tmp/iso/VBoxLinuxAdditions.run
logout
login
Device --> Shared Clipboard-->Bidirectional
gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
sudo reboot

Ubuntu form NTFS Loop File

#Create Workdir file
su
cd /media/win_c
dd if=/dev/zero of=./ubuntu_temp.bin bs=1G count=11
mkfs.ext2 ./ubuntu_temp.bin -F
mkdir /tmp/ubuntu_temp
mount ./ubuntu_temp.bin /tmp/ubuntu_temp
ls -l /tmp/ubuntu_temp
apt-get update
apt-get upgrade
apt-get install squashfs-tools live-boot live-boot-initramfs-tools linux-image-extra-$(uname -r)
cp /etc/initramfs-tools/modules /modules.`date "+%Y%m%d-%T"`

vi /etc/initramfs-tools/modules
# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
# Syntax:  module_name [args ...]
#
# You must run update-initramfs(8) to effect this change.
#
# Examples:
#
# raid1
# sd_mod
loop
#ntfs
fuse


cat /etc/initramfs-tools/modules

vi /etc/initramfs-tools/scripts/init-top/loopboot
#!/bin/sh 

PREREQ=""
prereqs()
{
    echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
     prereqs
     exit 0
     ;;
esac 

[ -d ${rootmnt}2 ] || mkdir --mode=0700 ${rootmnt}2


cat /etc/initramfs-tools/scripts/init-top/loopboot

vi /etc/initramfs-tools/scripts/local-premount/loopboot
#!/bin/sh 
PREREQ=""
prereqs()
{
    echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
    prereqs
    exit 0
    ;;
esac 

#modprobe -k ntfs
#mount -n -t ntfs -o nodiratime,noatime ${ROOT} ${rootmnt}2 

modprobe -k fuse
ntfs-3g ${ROOT} ${rootmnt}2 

modprobe -k loop
mount -n -t ext2 -o loop,rw ${rootmnt}2${loop} ${rootmnt}


cat /etc/initramfs-tools/scripts/local-premount/loopboot

depmod -a
update-initramfs -u
DEST=/tmp/ubuntu_temp
mkdir -p ${DEST}
ls -l ${DEST}
rsync -av --delete / ${DEST} --one-file-system \
--exclude=/proc/* --exclude=/tmp/* --exclude=/dev/* \
--exclude=/live/* \
--exclude=/sys/* --exclude=/boot/* \
--exclude=/home/* --exclude=/etc/mtab \
--exclude=/live --exclude=${DEST}

vi ${DEST}/etc/fstab
delete UUID row

mkdir ${DEST}/home/asdf
chown -R asdf:asdf ${DEST}/home/

[ -n "$DEST" ] && sudo find ${DEST}/var/run ${DEST}/var/mail ${DEST}/var/spool ${DEST}/var/lock ${DEST}/var/backups ${DEST}/var/tmp -type f -exec rm {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iregex '.*\.[0-9].*' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f -iname '*.gz' -exec rm -v {} \;

[ -n "$DEST" ] && sudo find ${DEST}/var/log -type f | while read file; do echo | sudo tee $file; done

[ -n "$DEST" ] && sudo rm -v ${DEST}/var/cache/apt/archives/*.deb

cp /boot/vmlinuz-3.8.0-19-generic /media/win_c/ubuntu/vmlinuz_ubuntu_13_04_loop
cp /boot/initrd.img-3.8.0-19-generic /media/win_c/ubuntu/initrd_ubuntu_13_04_loop	

title Ubuntu 13.04 Custom Loop FS
root (hd0,0)
kernel (hd0,0)/ubuntu/vmlinuz_ubuntu_13_04_loop root=/dev/sda1 loop=/ubuntu_temp.bin debug
initrd /ubuntu/initrd_ubuntu_13_04_loop
boot

Ubuntu Live CD Customization

#Create temporary workspace
su
cd /media/win_c
dd if=/dev/zero of=./ubuntu_temp.bin bs=1G count=11
mkfs.ext2 ./ubuntu_temp.bin -F
mkdir /tmp/ubuntu_temp
mount ./ubuntu_temp.bin /tmp/ubuntu_temp
ls -l /tmp/ubuntu_temp

#Install Dependencies 
apt-get update
apt-get upgrade
apt-get install squashfs-tools genisoimage


#Copy Old rootfs
DEST=/tmp/ubuntu_temp/rootfs
mkdir -p ${DEST}
ls -l ${DEST}
CDROM=/tmp/ubuntu_temp/cdrom
mkdir -p ${CDROM}
ls -l ${CDROM}
OLDCDROM=/tmp/ubuntu_temp/oldcdrom
mkdir -p ${OLDCDROM}
ls -l ${OLDCDROM}
mount -o loop /media/win_c/ubuntu/ubuntu-13.04-desktop-amd64.iso ${OLDCDROM}
ls -l ${OLDCDROM}
rsync -av --exclude=/casper/filesystem.squashfs ${OLDCDROM}/ ${CDROM}
mkdir ${DEST}/squashfs  ${DEST}/custom
mount -t squashfs -o loop ${OLDCDROM}/casper/filesystem.squashfs ${DEST}/squashfs
ls -ltr ${DEST}/squashfs
rsync -av --delete ${DEST}/squashfs/ ${DEST}/custom

#Install/Configure Livecd Dependencies
mkdir -p ${DEST}/custom/run/resolvconf
cp /etc/resolv.conf ${DEST}/custom/run/resolvconf/resolv.conf
mkdir -p ${DEST}/custom/proc
mount -t proc none ${DEST}/custom/proc
mkdir -p ${DEST}/custom/dev
mount --bind /dev ${DEST}/custom/dev
mkdir -p ${DEST}/custom/dev/pts
mount --bind /dev ${DEST}/custom/dev/pts
mkdir -p ${DEST}/custom/sys
mount --bind /sys ${DEST}/custom/sys
chroot ${DEST}/custom /bin/bash
apt-get install --yes dbus
dbus-uuidgen > /var/lib/dbus/machine-id
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl

#Customize Livecd
add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
apt-get update --yes
apt-get upgrade --yes
apt-get install gnome-panel gnome-session-fallback --yes
apt-get install dconf-tools --yes
apt-get install ubuntu-restricted-extras --yes
apt-get install libxine1-ffmpeg ffmpeg --yes
apt-get install iotop --yes
apt-get install vpnc --yes
apt-get install filezilla --yes
apt-get install ssh --yes
apt-get install gnome-commander libgnomevfs2-extra gksu --yes
apt-get install apache2 php5 --yes

#Finalize
rm /var/lib/dbus/machine-id
rm /sbin/initctl
dpkg-divert --rename --remove /sbin/initctl
exit
umount ${DEST}/custom/proc
umount ${DEST}/custom/dev/pts
umount ${DEST}/custom/dev
umount ${DEST}/custom/sys

#Cleanup
rm ${DEST}/custom/run/resolvconf/resolv.conf
[ -n "$DEST" ] && sudo find ${DEST}/custom/var/run ${DEST}/custom/var/mail ${DEST}/custom/var/spool ${DEST}/custom/var/lock ${DEST}/custom/var/backups ${DEST}/custom/var/tmp -type f -exec rm {} \;
[ -n "$DEST" ] && sudo find ${DEST}/custom/var/log -type f -iregex '.*\.[0-9].*' -exec rm -v {} \;
[ -n "$DEST" ] && sudo find ${DEST}/custom/var/log -type f -iname '*.gz' -exec rm -v {} \;
[ -n "$DEST" ] && sudo find ${DEST}/custom/var/log -type f | while read file; do echo | sudo tee $file; done
[ -n "$DEST" ] && sudo rm -v ${DEST}/custom/var/cache/apt/archives/*.deb

#Create rc.local link for read/write configuration in ntfs
mkdir -p /media/win_c/etc
[ -f "/media/win_c/etc/rc.local" ] || cp ${DEST}/custom/etc/rc.local /media/win_c/etc/rc.local
cd ${DEST}/custom/etc
rm rc.local
ln -s /isodevice/etc/rc.local rc.local 
ls -l rc.local

#Regenerate manifest
chmod +w ${CDROM}/casper/filesystem.manifest
chroot ${DEST}/custom dpkg-query -W --showformat='${Package} ${Version}\n' > ${CDROM}/casper/filesystem.manifest
cp ${CDROM}/casper/filesystem.manifest ${CDROM}/casper/filesystem.manifest-desktop
sed -i '/ubiquity/d' ${CDROM}/casper/filesystem.manifest-desktop
sed -i '/casper/d' ${CDROM}/casper/filesystem.manifest-desktop

#Compress Root Filesystem
rm ${CDROM}/casper/filesystem.squashfs
mksquashfs ${DEST}/custom ${CDROM}/casper/filesystem.squashfs -noappend -always-use-fragments -comp xz
chmod a+rw ${CDROM}/casper/filesystem.squashfs
ls -lh ${CDROM}/casper/filesystem.squashfs
printf $(du -sx --block-size=1 ${DEST}/custom | cut -f1) > ${CDROM}/casper/filesystem.size
cd ${CDROM}
rm md5sum.txt
find -type f -print0 | xargs -0 md5sum | grep -v isolinux/boot.cat | tee md5sum.txt

#Create the ISO image
rm /media/win_c/ubuntu/ubuntu-13.04-custom-desktop-amd64.iso
mkisofs -D -r -V "CUSTOM_CD" \
  -cache-inodes -J -l -b isolinux/isolinux.bin \
  -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
  -o /media/win_c/ubuntu/ubuntu-13.04-custom-desktop-amd64.iso ${CDROM}

Grub2 Menu:

menuentry "Ubuntu 13.04 Desktop ISO AMD64" {
 loopback loop /ubuntu-13.04-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-13.04-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "Ubuntu 13.04 Custom Desktop ISO AMD64" {
 loopback loop /ubuntu-13.04-custom-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-13.04-custom-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

Ubuntu VirtualBox Debootstrap

Run Ubuntu Desktop CD in VirtualBox and open terminal:

sudo su

Create partition:
cfdisk /dev/sda
primary partition bootable 99% disk
another primary partiton 1% disk
write

Check partition: 
fdisk -l

Format partition:
mkfs.ext4 /dev/sda1

Create and activate swap partition:
mkswap /dev/sda2
swapon /dev/sda2

Debootstrap and configure minimal Ubuntu Precise 12.04 LTS:
apt-get install debootstrap
mkdir /mnt/install
mount /dev/sda1 /mnt/install
debootstrap trusty /mnt/install
cp /etc/apt/sources.list /mnt/install/etc/apt/sources.list
mount --bind /dev /mnt/install/dev
mount -t proc /proc /mnt/install/proc
chroot /mnt/install 
apt-get install language-pack-en-base linux-image grub-pc
dpkg-reconfigure tzdata

Install utilities:
apt-get install wget unzip ssh psmisc strace lsof telnet
service ssh stop

Create User:
adduser asdf
gpasswd -a asdf sudo

Configure eth0 interface with dhcp:
Add this lines:
vi /etc/network/interfaces
auto eth0
iface eth0 inet dhcp

Reboot:
exit
shutdown -h now

Remove ubuntu cdrom and start virtual machine

ubuntu/ubuntu_post_installazione.txt · Last modified: 2014/08/15 20:28 by rkpisanu
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0





Mail