Ubuntu
Checking Ubuntu Version Number via the Command Line
When creating dev and staging environments based on an existing production environment (I know, right) it is useful to get the version of Linux you are running. In Ububntu, just fire up your terminal and type:
lsb_release -a
This will output something similar to:
Distributor ID: Ubuntu Description: Ubuntu 9.10 Release: 9.10 Codename: karmic
Woot.
Install Oracle 10g Express on Ubuntu
Brief overview:
- Download and Install the .deb
- Run sudo /etc/init.d/oracle-xe configure
- Run /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
- If language errors, edit the /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh file
- Add . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh to your .bashrc
- Start a new terminal session
- sudo chmod 6755 oracle in the $ORACLE_HOME/bin directory
- sqlplus system
Now for the details!
=============
GUI SETUP
=============
First, download the 10g Express version that you require. If you are in a western, English speaking country then I recommend Oracle Database 10g Express Edition (Western European).
http://www.oracle.com/technology/software/products/database/xe/htdocs/102xelinsoft.html
You'll need to sign up for a free account with Oracle to download the software. After getting the package, install it via your favorite method. Double clicking the file works well enough for this application. Once the package is installed you'll see the Oracle software in Applications -> Oracle Database 10g Express Edition.
Unfortunately, the installer doesn't automatically setup the initial components and this is when I ended up combing through search engine results. The setup is really quite simple. Just fire up a terminal session and type:
sudo /etc/init.d/oracle-xe configure
You'll then be prompted for what ports to run the web client and database on as well as whether or not you want the database to run at boot. Most importantly (at least to me) this is where you setup the SYS/SYSTEM password.
Here's what my output looks like:
Oracle Database 10g Express Edition Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database 10g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Pressto accept the defaults. Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration: Confirm the password:
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done Configuring Database...Done Starting Oracle Database 10g Express Edition Instance...Done Installation Completed Successfully. To access the Database Home Page go to "http://127.0.0.1:8080/apex"
Sweet. Now I can connect to Oracle via the Web Client in Applications -> Oracle Database 10g Express Edition -> Go To Database Home Page or just bookmarking http://127.0.0.1:8080/apex
I already had apache installed and I don't know if it's required. If, for some reason, you can view the page, do a:
sudo apt-get install apache2
then (if apache isn't running)
sudo /etc/init.d/apache2 start
You can now login to the browser GUI and do what your need to do. Most of us want the next steps too.
===========
RUNNING VIA COMMAND LINE
===========
I have Oracle setup on one box and ssh into it so I need to run it command line to do it. SQLPLUS is used to access it but I ran into some problems. Here's how to fix it and get it running. First, trying to run sqlplus will generate errors:
sqlplus sys as sysdba sqlplus: command not found
It's already on your system but you need to run the oracle_env.sh script:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found
Bummer. I took out the if statements around line 114 (:set number in vi to view line numbers) and just left the line 'locale=$LANG' by doing:
sudo vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh
That fixed my language error and so I just reran
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
I also added . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh to my .bashrc file.
Now when I try sqlplus sys as sysdba I get:
steven@MDW1003461:/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin$ sqlplus sys as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 3 11:58:58 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password: ERROR: ORA-09925: Unable to create audit trail file
GRRRRRR.
Further digging let me know I had to set the setuid bit on the Oracle executable.
So, close your terminal session then start a new one to load your environment variables. CD to $ORACLE_HOME (mine is /usr/lib/oracle/xe/app/oracle/product/10.2.0/server) then go into the bin directory and do a
sudo chmod 6755 oracle
Let's try to connect again:
sqlplus system
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 3 12:13:12 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL>
VOILA!
So, to recap:
- Download and Install the .deb
- Run sudo /etc/init.d/oracle-xe configure
- Run /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh
- If language errors, edit the /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh file
- Add . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh to your .bashrc
- Start a new terminal session
- sudo chmod 6755 oracle in the $ORACLE_HOME/bin directory
- sqlplus system
YOU'RE IN!
Mono Position Statement
Scott James Remnant wrote on behalf of the Ubuntu Technical Board today defending Ubuntu's inclusion of Mono in it's default shipped package. The entire text can be read here: https://lists.ubuntu.com/archives/ubuntu-devel-announce/2009-June/000584.html
I recognize that they are in full rights to include whatever software they choose to include (as long as any licensing requirements are fulfilled) and Mono is free software. We all, at some level of understanding, realize this. The problems that arise most frequently are the patents concerning the .Net technologies. Scott Remnant addresses these concerns in the position statement.
It is common practice in the software industry to register patents as protection against litigation, rather than as an intent to litigate. Thus mere existence of a patent, without a claim of infringement, is not sufficient reason to warrant exclusion from the Ubuntu Project.
While this may be true on a grand scale, it is widely accepted that there have been problems and dire consequences with using patented technologies on open source platforms. If it were not for this precedence, Mono might be much more accepted.
My stance is that I feel that Mono should not be bundled with GNU/Linux distributions just as a precaution against litigation (again, Mono is free software but the technologies it supports is patented). I do think, however, in the pursuit of freedom, that developers must have the choice to develop software using Mono in order to bring .Net technologies to GNU/Linux. Choice is an essential freedom that mustn't be denied. This may sound contradictory to my statement that distributions should leave Mono and Mono-dependent software out of its default install. I state it this way because I feel its up to the individual to take the risk of using software based on patented technologies (that perhaps may lead to future litigation). It is much more preferable for the individual to choose to waive their rights than for a platform they depend on to choose to do so for their entire user base. This is especially important if the owner of the patented technology does choose to enforce their patent and litigate because many users will have grown accustomed to the patented technology and a void will be left, where, conversely, no void will be left if the technology wasn't initially present. My position is for protection of the users as a whole so that each user of a distribution isn't unknowingly reliant on software based on patented technologies because it came bundled with an operating system.
In short: don't bundle it, but make it available.
Quickie: Install Packages from FireFox Address Bar
If you're surfing around in FireFox and don't have a terminal fired up, why waste the extra keystrokes or mouse movements just to install a package? If you already know the package name, you can install from your browser simply by using:
apt:<package-name>
For example I want to install the super excellent diagramming software dia, I simply type:
apt:dia
And a GUI pops up much like it does when you select a package and hit apply in Synaptic.
Install Initial Ubuntu Items GUI
Because of all the great response from the simple shell script, I've created a GUI using Zenity and Bash so that people new to the CLI or those who wish to select and deselect what packages to install or uninstall may do so. You'll be able to play DVDs, listen to your MP3s, have 5.1 Surround Sound playback enabled and more. This isn't a 'how-to' but rather a 'just-do-it'. If you want to know the how-to, just view the source of the script. It's basically doing some simple apt-gets with a GUI front-end.
Below is a screenshot of the window. Just download the shell script here on my server, -- you'll need to extract it (tar xvf ubuntuTasks.sh.tar.gz) then make sure it's executable (chmod +x ubuntuTasks.sh) and execute it (./ubuntuTasks.sh). You'll be greeted with a user-friendly GUI where you can select and deselect items.
steven@steven-laptop:~/fun$ chmod +x ubuntuTasks.sh steven@steven-laptop:~/fun$ ./ubuntuTasks.sh
Once you hit OK, you'll have to input your sudo password when it returns to the CLI. It shouldn't prompt you for anything else. Please shoot me a message if you need any help or have any suggestions.
Initial Ubuntu Install Items Script
UPDATE: Please go here for the new GUI version of this script that also includes some extra items.
I was actually going to write an entry this morning about packages to purge or install upon a fresh Ubuntu build but Ubuntu Linux Help beat me to the punch. It's a great article and well worth the read. I've modified the list slightly and created a bash script to execute it. The file is here. Just extract it ( tar xvf ubuntuTaks.sh.tar.gz ) make sure it's executable ( chmod +x ubuntuTasks.sh ) and execute it using ./ubuntuTasks.sh
Below is the code inside in case you want to just copy and paste it into your own file:
#!/bin/bash sudo apt-get remove --purge mono-common libmono0 sudo aptitude install sbackup sudo aptitude install ubuntu-restricted-extras && sudo aptitude install w32codecs sudo apt-get install msttcorefonts && sudo fc-cache -fv sudo aptitude install vlc sudo aptitude install k3b sudo perl -pi -w -e 's/\; default-sample-channels \= 2/default-sample-channels \= 6/g;' /etc/pulse/daemon.conf
As always, this code comes with no warranties. I have run it on my system and all is well.
Convert MP3 Files to OGG
For those of us who prefer not to install or not rely on proprietary codecs, we can use Ogg Vorbis to freely listen to our music. It is not illegal to install the ubuntu-restricted-extras to listen to MP3 files (it's illegal for Canonical to pre-install them because they sell distros), and for many people this is a blessing since they don't care so much about 'minor' proprietary issues but just have some greater problem with Windows be it its overbearing market share or instability. For those of us who are trying to wean ourselves away from proprietary software altogether, there is a way to convert your mp3 collection to Ogg. You'll need to install mp32ogg (aptly named). From there its a simple command. I'm currently working on a friendly UI for mp32ogg. Currently OggConvert is a good GUI but is limited -as far as I can tell- to converting one song at a time rather than batch converting a directory. Here are the basic commands for converting your music:
sudo apt-get install mp32ogg mp32ogg --quality=10 --rename=%t *.mp3
This will convert all files in your current directory. You can also use a --delete flag if you are hardcore and want to rid yourself of your mp3s but you may also want to hold onto them if you have a portable device that doesn't support Ogg Vorbis. You can, of course, modify the quality (1-10) and change the rename (from the manual entry: "Instead of simply replacing the .mp3 with .ogg for the output file, produce output filenames in this format, replacing %a, %t and %l with artist, title, and album name for the track").
I'll keep you updated on my GUI progress.
Remove Mono and Its Minions from Ubuntu
Mono is a tool that provides software to create and run client and server .NET applications of various platforms. One of the concerns many Free Software supporters have with Ubuntu is that it decides for us which proprietary software is good and which is bad. As one blog noted: "If Canonical is to be consistent, I should not have to a a hypocrite about some things and not others." -- specifically in regard to Ubuntu requiring you to install proprietary codecs manually (restricted-extras) but pre-loading software that is used to support a proprietary system.
Here's how to remove the offending program, courtesy of theopensourcerer:
sudo apt-get remove --purge mono-common libmono0
As theopensourcerer notes, you should check with your distribution and needs to see if removing Mono is the right decision for you. For most of us, it is.
Quickie: Deleting Old Files
Many people have the need to delete files older than a certain range. For instance, you may want to remove all podcasts that are older than a certain time period or delete other files that you receive regularly. Making use of the find command and mtime, you are able to delete them with ease.
find . -name *.ogg -mtime +7 -exec rm {} \;
The above one-liner removes all my ogg-based media files in my current directory that are more than a week old. It is best to use absolute paths -- ESPECIALLY IF RUNNING BY CRON. So the cron-safe code looks like this:
find /home/steven/music/ -name *.ogg -mtime +7 -exec rm {} \;
You can also use this with other command such as moving the file, batch renaming them (if you want all older files to have a .bak extension or whatnot), as well as many other uses. To move the files, simply:
find /home/steven/feeds/ -name *.csv -mtime +30 -exec mv {} /home/steven/feeds/old \;
With enough MAN pages and will, you can do all kinds of cool stuff.



![[FSF Associate Member] [FSF Associate Member]](http://www.ossolutions.org/lores/img/fsfMember.png)
Subscribe to this Feed