Tag Archives: ubuntu

How To: Delete ALL older kernels

If you are using Ubuntu, there is a good chance you get kernel upgrades once in a while. There is no reason, after you’ve booted the new kernel and verified that everything is working properly, why you should not delete all older kernels. This will free up a bit of that root partition. If you are like me and mount / on a small SSD partition, every MB counts. For me the modules for each kernel version are around 160MB.

Here is a CLI one-liner to delete all order kernels, leaving only the latest on the system:

sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')

Fix VMware Workstation Module compile error on Ubuntu/Debian Linux

# Become root
sudo -i

# Do a couple of pre-requisites
apt-get install build-essential
ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

# Extract each of the VMware module packages

cd /usr/lib/vmware/modules/source
for file in *
do
tar xvf $file
done

# Fetch and apply patches required for this release...
wget http://communities.vmware.com/servlet/JiveServlet/download/2234875-108182/vmci.linux-3-8.patch
patch -p0 < vmci.linux-3-8.patch

# Put the VMware module source packages back together again
for file in *-only
do
tar cvf `basename $file -only`.tar $file
done
rm -rf *-only

# Tell VMware to rebuild the modules - can also just run the command "vmware" as root
vmware-modconfig --console --install-all

Heroku on Ubuntu

As everything that comes from ruby world, getting heroku running on Ubuntu is not as easy as we’re used to (ie: apt-get install heroku) so there are a few steps that need to be followed. I’ve written this down so i can come back to it later and so that others don’t lose hours trying to figure this out. The data on this article has been scraped from http://www.web2linux.com/05/installing-rails-3-on-ubuntu-10-04-lucid-lynx/ and http://devcenter.heroku.com/articles/quickstart

Installing dependencies

sudo apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev

Install rvm

#for latest, check https://rvm.beginrescueend.com/
bash < 

Install ruby-1.9.2

rvm install 1.9.2 && rvm use 1.9.2 --default

Then add this line as the last line in your .bashrc:

if [[ -s "$HOME/.rvm/scripts/rvm" ]];
        then source "$HOME/.rvm/scripts/rvm";
fi

Install Heroku

Sign-up for a Heroku account if you haven’t already and then install the herokugem.

gem install heroku

You will be asked to enter your Heroku credentials the first time you run a command; after the first time, your email address and an API token will be saved to ~/.heroku/credentials for future use.

It’s generally a good idea to add your public key immediately after installing the heroku gem so that you can use git to push or clone Heroku app repositories:

heroku keys:add
Enter your Heroku credentials.
Email: [email protected]
Password:
Uploading ssh public key /Users/joe/.ssh/id_rsa.pub

Track your application with Git

If you’re already using Git with your application, skip to the next step. If you’re not yet using Git to track your application, run this:

cd PATH/TO/MY_APP
git init
# Initialized empty Git repository in .git/
git add .
git commit -m "new app"
Created initial commit 5df2d09: new app
44 files changed, 8393 insertions(+), 0 deletions(-)

Create your Heroku application

At the command line, run heroku create. The first time you do this, you’ll be asked to enter your Heroku credentials. Once you do, your email address and an API token will be saved to ~/.heroku/credentials, so you won’t have to provide them again.

This first use will also upload your public SSH key so you’ll be able to push and pull code.

heroku create
Enter your Heroku credentials.
Email: [email protected]
Password:
Uploading ssh public key /Users/joe/.ssh/id_rsa.pub
Created http://high-sunrise-58.heroku.com/ | [email protected]:high-sunrise-58.git
Git remote heroku added

The last line shows the name of your new Heroku app; in this case, it’s “high-sunrise-58”, and is available at http://high-sunrise-58.heroku.com. If you were to visit that URL before pushing your application code (either by typing it in or running heroku open), you’d see a standard Heroku welcome page.

On the next to last line, there’s another important piece of information: [email protected]:high-sunrise-58.git. This is the Git repository address for your new Heroku app, and if you check the output of git remote show heroku you can see that the heroku gem added it as a remote for you automatically.

Push your application to Heroku

git push heroku master
Counting objects: 65, done.
Compressing objects: 100% (58/58), done.
Writing objects: 100% (65/65), 80.54 KiB, done.
Total 65 (delta 14), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
       Compiled slug size is 0.1MB
-----> Launching....... done
       App deployed to Heroku

To [email protected]:high-sunrise-58.git
 * [new branch]      master -> master

Bootstrap your database

Your app is now running on Heroku with an empty database. Depending on your framework, run the appropriate command to set up your DB. For Ruby on Rails, run:

heroku rake db:migrate
(in /mnt/home/slugs/41913_b81cc1e5813c58c443e4120aff984d006f36ef20/mnt)
== 20081118092504 CreateWidgets: migrating ====================================
-- create_table(:widgets)
   -> 0.0519s
== 20081118092504 CreateWidgets: migrated (0.0520s) ===========================

That’s it, your app is now running on Heroku! You can take a look at it in your default web browser by running heroku open.

Next Steps

Now that your application is running, it’s easy to push updates:

Develop and test changes locally.
Commit code to git.
Push your changes to Heroku with git push heroku.

Install native 64bit Flash Player 11 on Linux

Update 3 [30 10 2011]: The script was updated to install of Flash Player 11.2 Beta
Update 2 [7 09 2011]: The script was updated to install rc1 of Flash Player 11
Update 1 [13 08 2011]: The script was updated to install b2 of Flash Player 11

Abobe released yesterday the first beta of Flash Player 11 for Linux 64 bit.

I’ve put together a small script that takes care of installing it on Ubuntu:

#!/bin/bash
# Script  created by
# Romeo-Adrian Cioaba [email protected]

echo "Stopping any Firefox that might be running"
sudo killall -9 firefox

echo "Removing any other flash plugin previously installed:"
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo rm -rfd /usr/lib/nspluginwrapper


echo "Installing Flash Player 11"
cd ~
wget 'http://download.macromedia.com/pub/labs/flashplatformruntimes/flashplayer11-2/flashplayer11-2_p1_install_lin_64_102611.tar.gz'
tar zxvf flashplayer11-2_p1_install_lin_64_102611.tar.gz
sudo cp libflashplayer.so /usr/lib/mozilla/plugins/ 
sudo cp -r usr/ /usr

echo "Linking the libraries so Firefox and apps depending on XULRunner (vuze, liferea, rsswol) can find it."
sudo ln -sf /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox-addons/plugins/
sudo ln -sf /usr/lib/mozilla/plugins/libflashplayer.so  /usr/lib/xulrunner-addons/plugins/

# now doing some cleaning up:
sudo rm -rf libflashplayer.so 
sudo rm -rf usr/
sudo rm -rf flashplayer11-2_p1_install_lin_64_102611.tar.gz

A very interesting application that comes bundled in this release is the “flash-player-properties” app which allows us to finally be able to set permissions to mic/camera on websites.

Fullscreen any window in Gnome

If you are running any distro that has a recent Gnome, chances are that your window manager is either Metacity or Compiz. I’ve found that while working, having my IDE fullscreen helps as that way i can keep away the “noise” and really concentrate on the work i’m doing.

Here’s how to fullscreen any window in Gnome:

1. Metacity
– Run gconf-editor.
– Go to /apps/metacity/window_keybindings.
– Change toggle_fullscreen from disabled to F11.

2. Compiz
– apt-get install compizconfig-settings-manager compiz-fusion-plugins-extra
Then open System -> Preferences -> CompizConfig Settings Mangager. The “Extra WM Actions” plugin should now be available under “Window Management”. Check it and click “Close”.

Restart your X-server by logging out and back in again. The “Toggle fullscreen” keyboard shortcut should now work with whatever you set in the main Gnome keyboard shortcuts settings.