Linux install and setup related

Environment related:

$ printenv 
print all environment variables
$ printenv SHELL
what shell you are using
  • 'set' sets environment variables and few other things.
  • 'env' prints environment variables or runs processes in modified environments.
  • Unlike 'set', 'env' only allows to set variables for the child process it starts - they do no stay in the current shell's environment.
$ env TERM=xterm mc 
run the command 'mc' with TERM set to 'xterm' but the value of $TERM in the current shell will not be affected
$ set TERM=xterm
will change the value of $TERM in the current shell
  • .bashrc gets executed on non-login shells (like after logging in, then opening a console)
  • .bash_profile (or .bash_login) gets executed on login shells (when logging in, with username/password)
  • /etc/bash.bashrc gets executed for all users
To add a folder to the path to be able to exec from anywhere (eg. the /home/user/software/bin folder), add
export PATH=$PATH:~user/software/bin
to the end of .bashrc
$ source ~/.bashrc 
to reload bashrc
shell function example, add the foll. into a shell file, which can then be invoked with the function name
function gitsync() {
    git add --all
    git commit -m "update"
    git push origin
$ gitsync

Users and groups:

$ less /etc/group 
lists all groups in the system
$ less /etc/passwd
shows all the users in the system
$ groupadd groupName
add a new group
$ useradd -G groupName userName
add new user to existing group
$ passwd userName
set passwd for user
$ usermod -a -G groupName userName
add existing user to existing group
$ id userName
show id and groups for user


$ alien file.rpm 
convert rpm to deb
$ alien --scripts file.rpm
conver rpm to deb, including scripts
$ dpkg -i file.deb
install deb file

Java install:

I had openJDK installed by default.
$ java -version
java version "1.7.0_09"
OpenJDK Runtime Environment (IcedTea7 2.3.4) (7u9-2.3.4-0ubuntu1.12.10.1)
OpenJDK Server VM (build 23.2-b09, mixed mode)
Wanted to use the SunJDK, from Oracle now. So downloaded the tar.gz for Java SE Development Kit 7u13 for Linux x86 http://download.oracle.com/otn-pub/java/jdk/7u13-b20/jdk-7u13-linux-i586.tar.gz. Extracted that to jdk1.7.0_13.
$ sudo mv jdk1.7.0_13/ /usr/lib/jvm/jdk1.7.0

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status
* 0            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071      manual mode
  2            /usr/lib/jvm/jdk1.7.0/bin/java                  1         manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/jdk1.7.0/bin/java to provide /usr/bin/java (java) in manual mode
Now check the java version
$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)

Displays related:


$ lspci | grep -i vga 
should show video card info

Seiki SE39UY04 monitor / GeForce GTX 650 video card

Got useful info from this post.
With this combination, Was only going upto 1440x900 by default. Needed to get the driver to acknowledge that this is a 4K monitor and should be able to run at 3840x2160.
Installed the nvidia driver, version 331.38. Then was able to fire up the nvidia x server settings utility. If not available, should be able to install and start up using

$ sudo apt-get intall nvidia-settings
$ gksudo nvidia-settings

Then, created /usr/share/X11/xorg.conf.d/10-monitor.conf, with the following content:

Section "Monitor"
  Identifier "Monitor0"
  Modeline "3840x2160" 165.00 3840 3888 3920 4000 2160 2163 2168 2222 +hsync +vsync
Section "Screen"
  Identifier "Screen0"
  Device "HDMI-0"
  Option "ModeValidation" "AllowNon60hzmodesDFPModes, NoEDIDDFPMaxSizeCheck, NoVertRefreshCheck, NoHorizSyncCheck, NoDFPNativeResolutionCheck, NoMaxSizeCheck, NoMaxPClkCheck, AllowNonEdidModes, NoEdidMaxPClkCheck"
  Monitor "Monitor0"
  DefaultDepth 24
  SubSection "Display"
    Depth 24
    Modes "3840x2160" "1920x1080"
On reboot, Linux (Mint 17 XFCE, actually) then picked up and started running at 3840x2160. Note that this is still 30Hz, and not 60Hz, that might just be a limitation of the firmware on the monitor?

Databases related:

Install sql developer

Downloaded Linux RPM sqldeveloper- from http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

$ sudo alien --scripts sqldeveloper- 
rpm to deb
$ sudo dpkg --install sqldeveloper_4.
install deb
$ cd /opt/sqldeveloper/
to installed here
$ ./sqldeveloper.sh
to run

It needed a newer version of the jdk, so pointed it by setting
SetJavaHome /opt/jdk1.7.0_55
in ~/.sqldeveloper/4.0.0/product.conf

VirtualBox related:

To install a vm from an install ISO image
  • create a new virtual machine.
  • Storage -> IDE Controller -> Live CD/DVD -> Choose a virtual optical disk file -> (browse to the iso)
  • start the vm, and perform the install.
  • shut down, remove the virtual optical disk.
  • to be able to see the new vm from the host and other machines on the network, select "Bridged Adapter" as a network adapter. This should set up the vm to request and get an IP for the local network.
bring up to date
$ sudo apt-get update
$ sudo apt-get upgrade
Use existing vmdk
Copy over the .vmdk file and the .vbox files. Start virtualbox using the .vbox file. run virtualBox from the command line
$ VBoxManage list vms
"Oracle 11gR2" {dbe091d1-2d58-432f-b23a-c4f9a6c47cb5}
$ VBoxManage list runningvms
$ VBoxManage startvm "Oracle 11gR2"
$ VBoxManage showinfo "Oracle 11gR2"

XFCE tricks and settings

$ amixer set Master 5%- 
command line volume control decrease
$ amixer set Master 5%+
command line volume control increase
$ xfce4-session-settings
fire up session settings applet
Alt F8
start window resize (otherwise target only 1px wide in some themes)

Remote Access

On the server:
$ sudo apt-get install xrdp
$ sudo service xrdp start
On the client:
$ sudo apt-get install rdesktop
$ rdesktop ip.of.server.running.xrdp 
using module sesman-Xvnc seems to work ok

Wordpress on LAMP server:

See here for a nice walkthrough.

installed ubuntu 14.04 server 32bit on a VirtualBox
chose LAMP server, and openSSH in software options
to test LAMP install: 
should show contents of /var/www/html/index.html
after the LAMP server install, set the required write permissions to the /var/www directory.
$ sudo usermod -a -G www-data  
Add your user to the www-data group
$ sudo chgrp -R www-data /var/www
add the /var/www folder to the www-data group
$ sudo chmod -R g+w /var/www
give write permissions to the www-data group
to test php, create /var/www/html/t1.php
should show php config info
to configure a database for WordPress to use:
mysql -u root -p 
(enter passwd used during lamp install of mysql)
CREATE DATABASE wordpress; GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
create user 'wordpress' with passwd 'wordpress' for database 'wordpress'
to install wordpress
$ sudo apt-get intall subversion
$ cd /var/www/html
$ svn co http://core.svn.wordpress.org/tags/3.9/ blog 
test the download, and walk through config screen to create config file, click "install"
admin login page

Linux Mint (Ubuntu) install related:

to change the lock screen wallpaper that is shipped with Linux Mint replace:


to install vpn client:

Open Connect client
$ sudo apt-get install openconnect $ sudo apt-get install network-manager-openconnect
Cisco VPN client
$ sudo apt-get install vpnc $ sudo apt-get install network-manager-vpnc $ sudo apt-get install network-manager-vpnc-gnome
(the network-manager integration makes the vpn clients show up as connection options in the networkManager tray applet)

to add another drive:

$ sudo lshw -class disk 
(got info on the disks, to make sure not messing up the primary already installed disk)
ran gparted to delete partitions and format the new disk. formatted to ext4
$ sudo blkid showed the uuid of the disks
created a mount point at /mnt/data1, and added the following entry to /etc/fstab
UUID=34c67677-ecd6-4bed-8f2a-a4a6ee54d425 /mnt/data1 ext4 defaults,errors=remount-ro 0 1 $ sudo mount -a
to test. should now auto mount on startup had to chown the mount point from root to user, so user could use the new disk

to change browser for Thunderbird email links:
Edit -> Preferences -> Advanced -> Config Editor
Set to "true" the foll:

  • network.protocol-handler.warn-external.http
  • network.protocol-handler.warn-external.https
Now Thunderbird should ask for (and remember) the application to be used to launch http and https links. (eg.

Google Sketchup install

(see UbuntuHandbook blog)
(see this for tweaks to not disable the ruby api)
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update
$ sudo apt-get install wine1.7
$ winecfg 
Application:WindowsVersion:Windows7, Libraries:Override:"riched20"
Downloaded Sketchup Make 2014, installed the exe through Wine Progrm Loader. If hangs on starting up, might be because of ruby, so add " /DisableRubyAPI" to end of shortcut.

Raid disk setup example:

wanted to do raid 0 install, (raid 0 just spreads across multiple disks, extra performance, no redundancy):
had 2 identical 300G hard drives (sda, sdb)

plan is to do the foll:
       sda partitions                            sdb partitions
       ---------------                           --------------
2G, primary, beginnning, boot              2G, primary, beginnning, unmounted
2G, primary, end, swap<-------raid 0------>2G, primary, end, swap
150G, primary, end, root<-----raid 0------>150G, primary, end, root
remaining, primary, home<-----raid 0------>remaining, primary, home

creating boot drive:need to make boot drive, this cannot be raid (grub can't use raid?)
  sda -> free space -> create new partition -> Primary (try to keep at location beginning)
  use as -> ext4 journalling file system
  mount point -> boot -> done setting up partition
creating matching non-raid partition on sdb (may not be necessary to do this, just doing it for symmetry)
  sda -> free space -> create new partition -> Primary -> location beginning
  use as -> ext4 journalling file system
  mount point -> do not mount -> done setting up partition

creating swap raid:
  sda -> free space -> create new partition -> Primary -> location end
  use as ->  physical volume for raid -> done setting up the partition
  [repeat for sdb]
  configure software raid -> write changes
  multi disk configuration -> create md device -> raid type raid 0
  active devices -> (choose the 2 partitions created)
  multidisk configuration actions -> finish  
  should now show RAID0 device. choose the #1 just under that, (and will be making that the swap partition)
  use as -> swap area
  done setting up partition

creating root raid:
  same as swap raid, except, at the end,
  use as -> ext4 journalling file system
  mount point -> root file system -> done setting up partition

creating home raid:
  same as root raid, except, at the end,
  use as -> ext4 journalling file system
  mount point -> home -> done setting up partition

finish partitioning and write changes to disk
write changes to disk

(install process should now start)

after installing, in ubuntu, System -> Administration -> System Monitor -> File System
should show root and boot raid devices (swap won't be visible)