[Home](/index.html)

# Ubuntu

Clean Install Setup

## USB Thumbdrive install

source
    [https://help.ubuntu.com/community/Installation/FromUSBStick](https://help.ubuntu.com/community/Installation/FromUSBStick)

From an ubuntu machine do:

    $ sudo apt-get install usb-creator
    $ usb-creator-gtk

Select the ubuntu iso you downloaded

You can delete usb contents first if u want

Select discard saved files

CREATE your bootable usb disk!

Boot other computer from this usb disk drive...follow install
instructions.

### Packages

First setup your proxy if required for apt-get

    $ cat /etc/apt/apt.conf
    Acquire::http::proxy "http://www-proxy.us.oracle.com:80/";

Applications > Ubuntu Software Center > Edit > Software Sources... >
Other Software > select the other two partner repositories

Now update your system too:

    sudo apt-get update

#### Export/Import Package list


Do: [List all installed packages][]

Email to self.

Set firefox to auto-detect proxy settings.

#### Compiz

On old computer open CompizConfig Settings Manager, from terminal type:

    ccsm

Preferences > Profile > Export

Start `ccsm` from the terminal on the new machine.

#### Keyboard Shortcuts

* System > Preferences > Keyboard Shortcuts >
Desktop > Lock screen (disable (BACKSPACE))
Window Management > Activate the window Menu (disable (BACKSPACE))

#### Gnome-Do

Launch `gnome-do` from the terminal.  Top right triangle > preferences > keyboard > Summon GNOME Do > Alt-space

#### Chrome

Download, install, latest version of Google chrome.

Setup google chrome preferences > personal stuff ( to sync everything )

#### Git Projects

email id_rsa.pub to computer that can add you to gitosis-admin

    mkdir projects
    cd projects/
    git clone git@linux1.hk.oracle.com:myConfig.git

Also clone project(s): `documentation`.  Setup your info:

    ~$ git config --global user.name "Fenton Travers"
    ~$ git config --global user.email fenton.travers@gmail.com

#### Emacs

    cd ~/projects/myConfig/
    cp -rp emacs.d/* ~/.emacs.d/
    cp -rp emacs ~

Check the http proxy in `~/.emacs.d/init.el`, if required put it in:

    (setq url-proxy-services '(("no_proxy" . "work\\.com")
                               ("http" . "www-proxy.us.oracle.com")))

#### Eclipse

Download, install eclipse to `~/bin/eclipse`.  Create the file `~/bin/Eclipse.desktop` with
the following contents:

    $ cat Eclipse.desktop 
    [Desktop Entry]
    Name=Eclipse Helios
    Comment=Eclipse Helios IDE
    Exec=/home/oracle/bin/eclipse/eclipse
    Icon=/home/oracle/bin/eclipse/icon.xpm
    Type=Application
    Categories=Development;IDE;

Install with:

    desktop-file-validate Eclipse.desktop
    sudo desktop-file-install Eclipse.desktop

Add: `pydev` from the eclipse marketplace


#### Maven

Copy `settings.xml` file into `~/.m2/` folder

    cp ~/projects/myConfig/settings.xml ~/.m2/

#### Thunderbird

On old machine:

    cd ~/.thunderbird
    tar cvfz mail.tgz *

Extract on new machine:

    cd ~/.thunderbird
    tar xvfz mail.tgz *
  

    ~/projects$ git clone ft_git3@spicevan.com:crmod-ws-wrapper.git
    ~/projects$ git clone ft_git3@spicevan.com:rtbDispute.git
    ~/projects$ git clone ft_git3@spicevan.com:lisp.git
    ~/projects$ git clone ft_git3@spicevan.com:myConfig.git
    ~/projects$ git clone ft_git3@spicevan.com:SesReader.git
    ~/projects$ git clone ft_git3@spicevan.com:gitosis-admin.git
    ~/projects$ git clone ft_git3@spicevan.com:CRMOD_WS_Writer.git
    ~/projects$ git clone ft_git3@spicevan.com:ngsp-doco.git
    ~/projects$ git clone ft_git3@spicevan.com:elisp.git
    ~/projects$ git clone ft_git3@spicevan.com:pdit.git
    ~/projects$ cd myConfig/
    ~/projects/myConfig$ sudo ./setConfigRsync.sh 

-   ~$ mkdir ~/.emacs.d/cache

-   Import Compiz profile


-   Web Downloads

Eclipse, SQLDeveloper, Skype, Adobe Acrobat Reader

## Evolution setup

-   backup and import all data from old computer
-   Edit -> Preferences -> Composer Preferences -> Forward/Reply Style
    -> Inline

## Google Desktop

Download and install from internet.

Add folders: 

* /home/oracle/projects/documentation
* /home/oracle/projects/work-doco

Which other folders hmm...

## Google Talk

http://www.google.com/talk/

## Terminal Settings

Open terminal: 
Edit > Profile Preferences > General (tab) > Monospace 9
Edit > Profile Preferences > Scrolling > Unlimited (checked)

## Pidgin

-   Tools > Preferences > Show system tray icon: Always

-   Oracle Account

-   -   Basic

protocol: xmpp
username: fenton.travers
domain: oracle.com

-   -   Advanced

require ssl/tsl = checked
force old (port 5223) ssl = checked
connect port = 5223
connect server = stbeehive.oracle.com

### Notifications

Tools > Plugins > Libnotify Popups > Configure Plugin > Uncheck: Buddy signs on
## Set Open DSN Servers

set /etc/resolv.conf

    nameserver 208.67.222.222 
    nameserver 208.67.220.220

## Printers

-   PDF’s can be found in ~/PDF, can view with `xdg-open <pdf_name>`
-   Add a printer from `http://localhost:631`, local username password.
    -   CUPS for Administrators > Adding Printers and Classes >
        Printers > Find New Printers > Add This Printer: 

-   -   HP LaserJet P2015 Series Postscript (recommended) (en, da, de,
        es, fi, fr, it, ja, ko, nl, nb, pt, sv, zh_CN, zh_TW)
    -   Connection:
        

dnssd://HP%20LaserJet%20P2015%20Series%20(0D9452)._pdl-datastream._tcp.local/

hostnames for printers:

-   p2015.hk.oracle.com – 10.179.252.21

connection string

-   Connection: socket://p2015.hk.oracle.com:9100

## Environment, Aliases

Run: `~/myConfig/setConfigRsync.sh`

## Get Things Gnome tasks

    cd ~/projects/myConfig; sudo cp gtg_data.tgz /; cd /; tar xvfz gtg_data.tgz

## SQLDeveloper & Eclipse

See [here](#ubuntuInstall) for specific details.

    cd projects/myConfig/
    desktop-file-validate Eclipse.desktop
    desktop-file-validate SQLDeveloper.desktop 
    sudo desktop-file-install Eclipse.desktop
    sudo desktop-file-install SQLDeveloper.desktop

Run SQLDeveloper once by hand to set the JDK path.

/bin/sh /home/oracle/bin/sqldeveloper/sqldeveloper.sh

set your jvm home to: /usr/lib/jvm/java-6-sun

Now you should find the icons to launch the apps under: Applications >
Programming.

## Startup Programs

System > Preferences > Startup Applications ... add

-   Name: Pidgin, Command: /usr/bin/pidgin

## VPN

-   `https://myaccess.oraclevpn.com`
-   Oracle VPN username (with the 8 character_cc)
-   Click AnyConnect, download & run shell script.
-   Server to connect to: `rmdc-twvpn-2.oraclevpn.com`

## Config

-   [Generate your ssh key pair](/secure.html#keypair)

-   Add plugin downthemall to firefox.

## Netbeans

    ~/Downloads$ chmod 755 netbeans-6.9.1-ml-java-linux.sh 
    ~/Downloads$ ./netbeans-6.9.1-ml-java-linux.sh 

## Documentation

I have documentation that I publish to a local webserver.

### Multimarkdown

    cd ~/bin/; 
    wget --user=spiceman --password=<PASSWORD> http://software.spicevan.com/linux/fletcher-MultiMarkdown-ef1038d.tar.gz
    tar xvfz fletcher-MultiMarkdown-ef1038d.tar.gz
    ln -s fletcher-MultiMarkdown-ef1038d/ mmd

    wget --user=spiceman --password=<PASSWORD> http://software.spicevan.com/linux/mylynWikitext.tgz
    tar xvfz mylynWikitext.tgz

Add following to end of: /etc/apache2/apache2.conf

    <VirtualHost *:80>
      ServerName docs
      DocumentRoot /home/f/bin/website
    </VirtualHost>

Then you can run command: `lochtml`

## Clojure

see: [Clojure Install](clojure.html)

## Package Management – Debian Systems

### Package Details

[Good reference site](http://newbiedoc.sourceforge.net/tutorials/apt-get-intro/info.html.en)

#### List all available packages in repos

Sample below searches for Java 5.

    cd /var/lib/apt/lists
    grep Package * | grep java | grep 5

#### List all installed packages

    dpkg --get-selections > installed-software

#### Re-install based on above list

    sudo apt-get install dselect;
    sudo dpkg --set-selections < installed-software; sudo dselect

Choose option [3] Install.

#### Package info

To determine info about a given package do:

    dpkg -p <package_name>
    dpkg -p clisp

#### List files installed to your system from package.

    dpkg -L package-Name

#### List contents of a deb package.

    dpkg -c filename

#### re-install

apt-get --reinstall install

#### purge

apt-get --purge remove

can also do: `dpkg --purge <package>` then try re-install

## Package Management – Redhat

list package files:

    rpm -ql

## Setting up Lisp

### Install clisp

    sudo apt-get install clisp

### slime

[Slime Documentation](http://common-lisp.net/project/slime/doc/html/)

installation just requires a few lines in your .emacs:

    (setq inferior-lisp-program "/usr/bin/clisp") ; your Lisp system
    (add-to-list 'load-path "~/bin/slime-2010-11-09/")  ; your SLIME directory
    (require 'slime)
    (slime-setup)

Run it in emacs with: `Alt-x slime`

## Restart Network

Debian systems:

    sudo /etc/init.d/networking restart

## Startup, Shutdown, Scripts

To make it usable, and make possible it’s automatic startup on server
boot change its permissions and update-rc.d

    sudo chmod +x /etc/init.d/git-daemon
    sudo update-rc.d git-daemon defaults

The daemon can be started or stoped by accesing:

    sudo /etc/init.d/git-daemon start
    sudo /etc/init.d/git-daemon stop

To remove the file, just replace the word default with remove:

    update-rc.d git-daemon remove

## Java JDK

Set the JAVA_HOME variable in /etc/environment. Sample:

    sudo vi /etc/environment 
    JAVA_HOME="/opt/java/java-6-oracle;"

## Screen Capture

Shutter

## Web Server

    sudo /etc/init.d/apache2 restart
    /etc/apache2/apache2.conf

### SSL Web Server

    sudo a2enmod ssl
    sudo nano /etc/apache2/sites-available/default-ssl # set DocumentRoot etc
    sudo a2ensite default-ssl
    sudo service apache2 restart

## SQLDeveloper, Eclipse, IntelliJ

See [here](#ubuntuInstall) for specific details.

    cd projects/myConfig/
    desktop-file-validate Eclipse.desktop
    desktop-file-validate SQLDeveloper.desktop 
    sudo desktop-file-install Eclipse.desktop
    sudo desktop-file-install SQLDeveloper.desktop

Run SQLDeveloper once by hand to set the JDK path.

/bin/sh /home/oracle/bin/sqldeveloper/sqldeveloper.sh

set your jvm home to: /usr/lib/jvm/java-6-sun

Now you should find the icons to launch the apps under: Applications >
Programming.

## Installing Programs

you can create a *.desktop file like:

    [Desktop Entry]
    Name=Eclipse - Helios
    Comment=Eclipse - Helios, IDE
    Exec=/home/ftravers/bin/eclipse_helios/eclipse/eclipse
    Icon=/home/ftravers/bin/eclipse_helios/eclipse/icon.xpm
    Type=Application
    Categories=Development;IDE;
    Path=/home/ftravers/bin/eclipse_helios/eclipse/

format description can be found here:

    http://www.freedesktop.org/wiki/Howto_desktop_files

valid categories can be found here:

    http://standards.freedesktop.org/menu-spec/latest/apa.html

You may want to pass $ `desktop-file-validate foo.desktop` to check out
that your file is OK.

Then, you can install it: `sudo desktop-file-install foo.desktop`

In the above example we’ll now find the Eclipse icon in the folder:
Applications > Programming.

You can add it to the menu bar by right-clicking and choosing add to
panel.

### Uninstall

If you mess up, delete the *.desktop file from
`/usr/share/applications`

# General Unix Commands

## find

Find all files accessed in the last minute

    find . -mmin 1

## grep

Find all files (recurse into subdirectories ®) that have the word
‘fenton’ in them (ignore case (i)). Only search files ending in
“*.java” (--include).

    grep -iR fenton --include="*.java" .

## Tiff2Pdf

## xmllint

The following will take an xml file and format it so it’s all properly 
indented.

    xmllint --format fenton.xml > cleanFenton.xml

## rsync

### Copy source to destination.

    rsync -avP --stats [source] [destination]

both `[source]` and `[destination]` can be like the following formats:

    [user_name]@[host_name]:[host_folder]

The following example copies a local folder `c:fenton_dir` to a remote
server `spicevan.com`, logging in as the `root` user. The files get
copied to the directory: `/home/ftravers/backupdir`

    rsync -avP --stats c:\fenton_dir root@spicevan.com:/home/ftravers/backupdir

The beauties of rsync are:

-   it will pick up where it left off. Good for big files and slow
    network links.
-   if you change a large file and re-run rsync it will not transfer the
    whole file only the sections of the file that have changed
-   you can use it on a whole directory structure and it will only send
    the files that have changed.
-   ... and a whole lot of other more technical details that I won’t
    bother getting into here...

## Environment Variables

Edit the file:

debian linux: `~/.bashrc` 
red hat: `~/.bash_profile`

set an environment variable like the following:

    export [variable_name]=[variable_value]

The example below sets two environment variables: `PATH` and
`JAVA_HOME`. Notice with the `PATH` example I reuse the existing value
of the `PATH` variable to extend it. This way I’m *adding* to the path
not *replacing* it.

    export PATH=$PATH:/home/ft/bin/apache-maven-2.2.1/bin:/home/ft/bin/jdk1.6.0_18/bin
    export JAVA_HOME=/home/ft/bin/jdk1.6.0_18

-   Global Environment Variables

On debian linux: `/etc/bash.bashrc`

On redhat linux: `/etc/profile`

Also there is the file: `/etc/environment`, which may have some values...

### Unset

    unset <variable>
    unset http_proxy

## Aliasing

Put in:

    ~/.bashrc

or

    ~/.bash_aliases

Alias format:

    alias [new_short_name]='[long_painful_to_type_command]'

example:

    alias vms='ssh root@vms.lab.com'

## Misc Commands

### Grep

Remove found files with either the png or the jpg string in them...the
trick is the | part.

    find . | grep -v "png|jpg"

Search recursively in current directory on down for files ending in
*.java for string Wiki

    grep -R Wiki --include "*.java" .

### Linking

Create a soft link:

    ln -s <existing_file> <new_link_name>

### Date / Time

    hwclock --set --date='08/18/07 14:40:40' --localtime

### CPU info, Distro info

#### Distro Info

rpm variants:

    cat /etc/*release

ubunut

    cat /etc/debian_version
    cat /etc/lsb-release

other

    cat /etc/*version

#### CPU Info

    cat /proc/cpuinfo

ref:
[http://www.brunolinux.com/05-Configuring_Your_System/CPU_Info.html](http://www.brunolinux.com/05-Configuring_Your_System/CPU_Info.html)

## NFS

### Server

On exporting server, `/etc/exports`, the format of the entry is:

    <share_folder> <authorized_hosts_list> <share_settings>

example:

    /OVS/sharedDisk * (rw,sync,all_squash,anonuid=500,anongid=500)

    [root@vl-vmsrv2 jeos]# service nfs restart

The following is how to mount another machines NFS exports:

### Client

:

    [root@vl-vmsrv2 ~]# cat /etc/fstab
    jpbox:/u01/Shared   /mount/jpbox        nfs defaults    0 0
    [root@vl-vmsrv2 ~]# mount -a

## Compiz Settings

Add the following:

-   -   (Add) Effects > Wobbly Windows

-   -   (Remove) Desktop > Viewport Switcher

-   -   (Edit) Desktop > Expo
        -   Bindings
            -   Expo Button = Ctrl – Button5
            -   Drag&Drop = Ctrl – Button1
            -   Exit Expo = Ctrl – Button4

        -   Appearance

Viewport Distance = .15
Hide panels/docs in expo = checked
Mipmaps = checked
Brightness = 71
Saturation = 62

-   -   (Edit) Desktop > Desktop Wall
        -   Viewport Switch Preview

Preview Scale = 100
Background Gradient = All Black
Others = All white

-   -   -   Bindings

Move Up/Down/Next/Prev = Ctrl - [direction arrow]

-   -   (Edit) Window Management > Grid

Remove Alt from all key bindings

-   -   (Remove) Static Application Switcher

-   -   (Add) Application Switcher
        -   Next Window = Ctrl-Super-KPRight
        -   Prev Window = Ctrl-Super-KPLeft

-   -   (Add) Shift Switcher (resolve conflict by setting dont set
        terminiate)
        -   Bindings
            -   Next Window = Alt-Tab
            -   Prev Window = Alt-Shift-Tab

-   -   (Edit) Scale
        -   Bindings
            -   Initiate Window Picker = Super-KP5(begin)
            -   Initiate Window Picker for all Windows =
                Ctrl-Super-KP5(begin)

    oracle@oracle-laptop:~/projects/myConfig$ cat SQLDeveloper.desktop 
    [Desktop Entry]
    Name=SQL Developer
    Comment=SQL Developer Program
    Exec=/bin/sh /home/oracle/bin/sqldeveloper/sqldeveloper.sh
    Icon=/home/oracle/bin/sqldeveloper/icon.png
    Type=Application
    Categories=Development;Database;
    Path=/home/oracle/bin/sqldeveloper/

    [Desktop Entry]
    Name=Eclipse - Helios
    Comment=Eclipse - Helios, IDE
    Exec=/home/ftravers/bin/eclipse_3.6.1/eclipse
    Icon=/home/ftravers/bin/eclipse_3.6.1/icon.xpm
    Type=Application
    Categories=Development;IDE;
    Path=/home/ftravers/bin/eclipse_3.6.1/

## screen

To keep a shell session on a remote server in its state, there is a
little utility that can do that for you.
It can be useful to let a long script running like an rsync backup over
the network.
A session of screen can also be “detached” and used by another user,
making it easy to collaborate on a project.

To install screen (as root):

    yum -y install screen

Then you can just start a screen session:

    screen -S MyTitle

To exit this session and go back to the regular shell press *ctrl+a*
then *d*
*ctrl+a* then *k* will kill the session.

To list the active screen sessions:

    screen -ls

to reattach a screen, use `screen -r` if there is only one session open.
If there are more, use `screen -r NNNN.SessionTitle`

# Redhat derivatives

## rpm

For installing a software package, you use the rpm command with -i
option (which stands for “install”). For example, to install an RPM
package called software-2.3.4.rpm:

    # rpm -i software-2.3.4.rpm

## accelerated web downloads

There is a nice utility `aget` that you can install on Redhat
distributions. Add the following to: `/etc/yum.repos.d/dries.repo`:

    # cat /etc/yum.repos.d/dries.repo 
    [dries]
    name=dries
    enabled=1
    gpgcheck=1
    gpgkey=http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt
    baseurl=http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el5/en/i386/dries/RPMS

you *may* need to also do:

    wget http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt
    rpm --import RPM-GPG-KEY.dries.txt

if you need a proxy for your wget use something like:

    export http_proxy=http://your.proxy.server:port && wget -c http://whatever

but I think the dries.repo entries should take care of that.

Then just do:

    yum install aget

Run aget to see how it is used:

    # aget
    usage: aget [options] url
        options:
            -p port number
            -l local file name
            -n suggested number of threads
            -f force using suggested number of threads
            -h this screen
            -v version info
    http//www.enderunix.org/aget/

# less

| Key Stroke | Effect                           |
| ---------- | -------------------------------- |
G            | go to end of file
f            | scroll forward one screen
b            | scroll backwards one screen


# nmap

<a name="portScan">check to see if a port is open on a machine</a>

<pre><div class="sample_code">nmap -PN -p <span class="parameter">PORT SERVER</span></div></pre>

# nohup

send nohup output to a filename of your choice:

    nohup execute receiptLoaderStart > nohup_sumarylogfile 2>&1 &

# cadaver

command line put/get (like ftp) access for webdav servers (i.e. over http)

# keytool

A keystore is a password-protected file which stores the keys and
certificates. The keytool application can import, export and list the
contents of a keystore. The keytool can also be used to generate
self-signed certificates for test purposes.

The keytool use as default a keystore file `.keystore` which is
located in your home directory or profile directory. To use another
keystore file use the `-keystore` flag. To list the content of a
keystore, type: `keytool -list`

When referring to a particular entity in the keystore use the `-alias`
flag.

Certificates generated by the system will be valid for just under one
year by default. To change the length of validity for a certificate to
n days, add the flag `-validity`


These commands allow you to generate a new Java Keytool keystore file,
create a CSR, and import certificates. Any root or intermediate
certificates will need to be imported before importing the primary
certificate for your domain.

## Notes on flags

    -alias

This is just a nickname for the key, can be anything (I think?)

## Creating and Importing

Generate a Java keystore and key pair

    keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048

Generate a certificate signing request (CSR) for an existing Java
keystore

    keytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr

Import a root or intermediate CA certificate to an existing Java
keystore
    
    keytool -import -trustcacerts -alias root -file Thawte.crt -keystore keystore.jks

Import a signed primary certificate to an existing Java keystore

    keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks

Generate a keystore and self-signed certificate (see [How to Create a
Self Signed Certificate using Java
Keytool](http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html)
for more info)

    keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048


## Checking

If you need to check the information within a certificate, or Java
keystore, use these commands.

Check a stand-alone certificate

    keytool -printcert -v -file mydomain.crt

Check which certificates are in a Java keystore

    keytool -list -v -keystore keystore.jks

Check a particular keystore entry using an alias

    keytool -list -v -keystore keystore.jks -alias mydomain


## Other

Delete a certificate from a Java Keytool keystore

    keytool -delete -alias mydomain -keystore keystore.jks

Change a Java keystore password

    keytool -storepasswd -new new_storepass -keystore keystore.jks

Export a certificate from a keystore

    keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks

List Trusted CA Certs

    keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts

Import New CA into Trusted Certs

    keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts

If you need to move a certificate from Java Keytool to Apache or
another type of system, check out these instructions for [converting a
Java Keytool keystore using
OpenSSL](http://www.sslshopper.com/article-move-your-java-keytool-ssl-certificate-to-openssl.html). For
more information, check out the [Java Keytool
documentation](http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/keytool.html)
or check out our [Tomcat SSL Installation Instructions which use Java
Keytool](http://www.sslshopper.com/tomcat-ssl-installation-instructions.html).
