Minimal install of XBMC on Ubuntu Karmic Koala (9.10)

Ok, so I have been building a media centre for about a week now, and I have had a lot of trouble getting it setup and working right, but now XBMC has released version 9.11 alpha 1 version of its popular media centre software which is now compatible with Ubuntu 9.10.

After all the trouble I had, I thought I would share with you how I installed it, and got XBMC to boot on load. I am using an ASUS AT3N7A-I with a 1.6 dual core atom processor and NVidia ION chipset, 2GB of ram and a 1TB hard drive. So I will only be showing you how to use the NVidia drivers for linux, but to be honest NVidia driver support for linux is better than ATI support.

First, download the minimal install of Ubuntu Karmic Koala (12.1mb x86 12.2mb x64)

Download either the x86 or x64 version dependent on your hardware.

Once the disk image has downloaded either burn it to CD or use UNetbootin to boot from a USB pen drive.

Reboot the computer you wish to install xbmc on, and boot from the CD or USB pen drive, you may need to change some settings in your bios to boot from CD or USB.

Start the installation, and follow the onscreen instructions to set your language and keyboard layout. Enter a username and password for your main account, for this I entered xbmc.

The installer will ask you what packages to install, scroll down to OpenSSH Server and press SPACE, then press ENTER to continue.

After the installation has completed, your computer will reboot.

When you get to the login screen, login with the username and password you entered.

Once you have logged in we need to add the PPA for XBMC.

sudo nano /etc/apt/sources.list

And these lines to the end.

deb karmic main
deb-src karmic main
deb karmic main
deb-src karmic main

We will need to add the a key to aptitude to stop it complaining.

sudo apt-key adv --keyserver --recv-keys 64234534 40618B66 CEC06767 318C7509 91E7EE5E

Sometimes the key server will return this error:
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error

A trick I found was to ping the key server address, after it responded try and run the previous command again:


Now we need to update aptitude.

sudo apt-get update

Now we will install the NVidia drivers:

sudo apt-get install nvidia-glx-190

You will need to enter your password again.

Next, we want sound for our media, so we will install some sound drivers.

sudo apt-get install linux-sound-base alsa-base alsa-utils

Your user needs to be added to the sound group.

sudo usermod -a -G audio xbmc

Change xbmc to the username that you entered.

The sound level will be set to zero, to change the volumes we need to enter the sound mixer.

sudo alsamixer

Use you up and down keys and set the volumes to the maximum they will go. Press the right key until you get to IEC958, EC958 D, EC958 1 and press M on each of them to un-mute them.

Press ESC to quit out of the mixer.

To make alsa save the volumes run.

sudo alsactl store 0

Now we can install XBMC.

sudo apt-get install xbmc xbmc-skin-* xbmc-eventclients-* xbmc-scripts-*

This will install xbmc, all the skins and eventclients.

Now X will need to know about your monitor, so run:

sudo nvidia-xconfig

XBMC will need to control power settings of the computer:

sudo apt-get install pm-utils policykit

And give your user access to these power features:

sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.suspend
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.hibernate
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot-multiple-sessions
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions

Again you will have have to change –user xbmc to the username that you entered in the installation.

Now the last thing to do is make XBMC launch at startup.

sudo nano /etc/init/tty1.conf

Change the line

exec /sbin/getty 38400 tty1


exec /bin/login -f xbmc < /dev/tty1 > /dev/tty1 2>&1

Next we need to get Ubuntu to clear the screen and start X:

nano ~/.bash_profile

And add these lines to the file:

case "`tty`" in
/dev/tty1) clear && startx &>/dev/null;;

Now we need to tell X to start XBMC:

nano ~/.xsessionrc

Add the lines:

exec xbmc --standalone

This next step is OPTIONAL, to hide all the information about what is being loaded, we shall install a usplash boot screen.

sudo apt-get install usplash libusplash-dev usplash-theme-xbmc-*

Once the splash screen installation has completed we need to select a splash screen:

sudo update-alternatives --config

Enter the number of the splash screen you wish to use, find examples below:

Pulsating Logo
Spinner Black
Spinner Blue

All the previews where created by DU-Duke

Next set the screen resolution of your tv in the usplash settings:

sudo nano /etc/usplash.conf

And add these lines:


My TV is 1080p, so the settings above will suite yours if it is full HD, for 720p enter:


To make the new splash screen active run:

sudo update-initramfs -u

Now reboot your computer:

sudo reboot

When the computer restarts, you should see the splash screen you selected, and XBMC should boot up.

Now, go into XBMC’s Videos settings and select VDPAU for the render mode (if your graphics card supports it) and edit the Sound settings:

Audio Output: Digital
AC3: Off
DTS: Off
Audio Capable Device: plughw:hdmi
Passthrough Output Device: hdmi
Downmix: On

And that’s it, you should have a fully functional media centre running the latest version of Ubuntu and XBMC.

As this is an alpha version, you will need to perform some updates now and again until the final release is out.

To so this, ssh into your computer and update it:

ssh xbmc@your media centre IP
sudo apt-get upgrade

Now I can’t take all the credit for this, I have collected some information from other sources and put them together from here:

Thanks to jonassw from XBMC forums, who suggested using the latest version of the NVidia drivers.

How to Linux Keylogger in Ubuntu

Here are the simple steps for keylogger in ubuntu

What is Keylogger?

Keystroke logger is the practice of noting (or logging) the keys struck on a keyboard, typically in a covert manner so that the person using the keyboard is unaware that their actions are being monitored. There are numerous keylogging methods, ranging from hardware- and software-based to electromagnetic and acoustic analysis.

keylogger in Linux

We have an opensource software available for Linux called lkl (Linux Key Logger).

LKL is a userspace keylogger that runs under linux–x86/arch. LKL sniffs and logs everything passes trought the hardware keyboard port (0×60).

Download key logger here

How to Install?

Step 1

Unzip or untar the file you have downloaded

Step 2

Change in to directory by typing cd lkl

Step 3

Give the below command


This will check all the required resurces it needs

Step 4

Type `make‘ to compile the package.

Step 5

Optionally, type `make check’ to run any self-tests that come with the package.

Step 6

Type `sudo make install‘ to install the


Now you are done with the installation

How to use?

You can send argument with the command lkl
-h help
-l start to log the 0×60 port (keyboard)
-b debug mode
-k <km_file> set a keymap file
-o <o_file> set an output file
-m <email> send logs to <email>
-t <host> hostname for sendmail. Default is localhost

Example: lkl -l -k us_km -o log.file // use USA kb and put logs in ‘log.file’

Please comment on the same if it doesn’t works for you

Ubuntu cccam server,24/7 – CardSharing Card Sharing Forum Servers

Don’t ask for a line or don’t send a line if you don’t have minimul 2-3 cards in hop1,please! I am connected to my server like you will be so what I see…you will see. I have in hop 1: orf full,hello basic+hbo hd+filmplus hd,focus,dolce,digi,akta. Full sky(ger-it-uk) in hop 2….
Only european servers please!!!

Google translation in french:
Ne demandez pas une ligne ou de ne pas envoyer un message si vous n’avez pas de cartes de 2-3 minimul dans hop1, s’il vous plaît! Je suis connecté à mon serveur comme vous voudrez bien ce que je vois … vous allez voir. J’ai en Hop 1: ORF complet, bonjour de base + HBO HD Filmplus + HD, focus, Numéro dolce,, akta. PLEIN CIEL (GER-IT-UK) dans les 2 …. hop
Seuls les serveurs européens s’il vous plaît!

Google trenslation in german:
Nicht für eine Linie zu stellen oder senden Sie eine Zeile, wenn Sie nicht über minimul 2-3 Karten in hop1, bitte! Ich bin auf meinen Server möchten Sie wird so, was ich sehe … Sie werden verbunden. Ich habe in hop 1: orf voll, hallo basic + HBO HD + filmplus hd, Fokus, dolce, digi, akta. Voll Himmel (ger-it-uk) in hop 2 ….
Nur europäischen Servern bitte!

Google translation in italien:
Non chiedere per una linea o di non inviare una linea, se non avete minimul 2-3 carte in hop1, please! Io sono collegato al mio server come te sarà così quello che vedo … si vedrà. Ho in hop 1: ORF pieno, ciao di base + HBO HD + HD filmplus, messa a fuoco, digi dolce,, Akta. Cielo pieno (ger-it-uk) in hop 2 ….
Solo i server europei per favore!

Google translation in dutch:
Vraag niet om een lijn of stuur niet een regel als je geen minimul 2-3 kaarten in hop1, please! Ik ben aangesloten op mijn server zoals u zult zo zijn wat ik zie … je zult zien. Ik heb in hop 1: ORF vol, hallo Basic + hbo HD + filmplus hd, focus, dolce, digi, akta. Full Sky (ger-het-uk) in hop 2 ….
Alleen Europese servers please!


Mount CD Image In Ubuntu 9.10 with Furius ISO Mount

If you have various fomat of virtual cd/dvd images scattered in your hard disk e.g .iso, .img, .bin, .mdf, .nrg that you want to mount in Ubuntu, then you’ll need this little app called Furius ISO Mount. I used to use gmountiso before, but it couldn’t handle mdf/mds. So here comes Furius taking its place.

It is far more superior compared to gmountiso which is very simple, Furius comes with these features :

  • works with ISO, IMG, BIN, MDF and NRG image files.
  • History of the last 10 images mounted.
  • Mounts multiple images.
  • Burn ISO and IMG Files to optical disk.
  • generate Md5 and SHA1 checksums.
  • generates a log file of all commands needed to mount and unmount images manually.

mount iso mdf img nrg | furius

And it’s just a few clicks away. Find it in Ubuntu Software Center.

Installing a Samsung SCX-4521F in Linux – Ubuntu

Using a USB interface Here is the check list.

  1. Get the Samsung Unified Driver version 3
  2. Install it via tar xvzf SamsungXXX.tar.gz && cd cdroot/Linux && sudo ./ I did it without using X at all, I gather there’s a little GUI that doesn’t ask anything text install doesn’t.
  3. Curse Samsung for putting the freaking icon on your desktop and the root of your applications menu without asking
  4. Clean up the crap you just cursed about.UPDATE forgot to mention the specifics – /bin/Desktop /bin/.gnome-desktop /usr/sbin/Desktop /usr/sbin/.gnome-desktop Yes, that install script has some bugs in it!
  5. Try a test page. Samsung ‘helpfully’ decided to make the new printer the default, so lpr favourite.pdf should work fine.
  6. Try scanimage -L and see if you can see the printer. If not (bet you can’t) try sudo scanimage -L. If that works, it’s a permissions problem.
  7. Add all the appropriate users to the lp group. e.g. sudo addgroup joeUser lp. The installer says it’s doing something like this, but whatever it does doesn’t work. Ubuntu has the handy scanner group as well, but the lp group ends up owning /dev/usb/0. Rather than muck about with updated udev rules, I just added the users to both the scanner and lp groups and it works fine.
  8. Log out of that terminal session and start a new one. A terminal doesn’t pick up updated group membership until it logs in the next time. Dunno whether that applies to the ‘GUI’ users and group tool or not. Let me know….
  9. Use scanimage -L to see if sane can see the scanner.

Install Ubuntu 9.10 on Microsoft Virtual PC 2007 | WebGuru's Blog

I have never tried installing Ubuntu on the Microsoft Virtual PC before, I did successfully on VM ware though. If you don’t know what Ubuntu is, please Google it, basically it is a Linux operating system with pretty desktop features. In the Thanksgiving holiday, I used my DELL Dimension 4600i (Windows XP sp3) to explore this option which turned out a good experiment, even Microsoft officially says its Virtual PC does not support Ubuntu.

The following is what I used to install Ubuntu.

Virtual PC 2007, (get it here).
Ubuntu iso image, (get it here).

In the New Virtual Machine Wizard of Virtual PC 2007, you would not see the Ubuntu from the supported Operation Systems list. Just select Other and click Next.

In the next screen, adjust the RAM to make at least 256MB for the memory and 4Gb disk space (I tried 2GB hard disk, but failed). Then you can create a new virtual hard disk file with dynamic assigned size, which means even you set 4GB as hard disk size but the physical size of your virtual hard disk file on your host OS will start from 1kb and grow dynamically when you put more stuffs.

Start the virtual machine and go to CD->Capture ISO image…, then click Action – Reset to reboot the virtual machine. And it should pickup your ‘CD/ISO image’, you then choose your language and do the install.


But for whatever reason if you see a strange screen says “Miss NCLR…” like I did the first couple times, hit DEL key at the boot screen to change the boot sequence in the CMOS setup. In my case, I put the CD ROM before the floppy disk then everything is fine.

For me, after that the Ubuntu installed went through without any issues. Except the installation time was a little long, and the virtual machine screen went into black a couple time. At the end, I could see the successful Ubuntu login screen, and the keyboard and mouse worked fine in the xWindow console. But the screen solution is only 800 x 600 and could not be changed.

Internet Tip: If you have any problems with the installation, can try this: When you see the Install Ubuntu menu, (make sure that it is highlighted) . Press F6 and then press esc again to close the menu, you will see a new line at the bottom that will say ‘Boot Options‘ at move your cursor, (with the arrows), to the end of the line. It should say something like “… quiet –“, delete that and replace it with “ noreplace-paravirt vga=791” and press enter to start the install. Then you install Ubuntu without problems.

And do not expect you can install Virtual Machine Additions from Virtual PC 2007. The VM additions comes with Virtual PC 2007 does not support Ubuntu, you can install it in Ubuntu even it mount it as CD-ROM after you click Install Virtual Machine Additions from Action option menu.

I did not try, but if you want you can download the Virtual Machine Additions for Linux from Microsoft download web site  ( Not sure how much benefits you can gain, but it might resolve some virtual drivers issues, (like the video card one I mentioned earlier or the sound card issue – since I could not hear anything from my Ubuntu Virtual machine at this point).

That’s it, enjoy Ubuntu 9.10.

How to connect VPN via PPTP with Ubuntu

First, I had to install PPTP for NetworkManager

sudo apt-get install network-manager-pptp

Now, we can do setting PPTP VPN.

Just enter gateway, username and password your PPTP VPN will be now ready to work.

But for me, I want to go out to normal internet with my internet router not to go through my office network. I have to do something a bit.

In editing vpn, click on tab IPv4 setting -> Routes.

Enter ip(s) that want to use vpn and netmark.

You can leave another 2 columns, gateway and metric blank.

Thick in box “Use this connection only for resources on its network”


Credit : VPN – Ubuntu Wiki, Howto configure PPTP VPN in Ubuntu Intrepid and Jaunty

Dual Panel Nautilus For Ubuntu Karmic Koala

The dual panel Nautilus which previously was only available for Ubuntu Jaunty is now available for Ubuntu Karmic Koala. Thanks to the author’s comment, I kept checking to see when Karmic packages were finally available and it didn’t took long until he finally build them.
dual panel nautilus ubuntu karmic
Download dual panel Nautilus for Karmic:

libnautilus-extension1_2.28.1-0ubuntu3~hb1~karmic1_i386.deb (59.3 KiB)
nautilus-data_2.28.1-0ubuntu3~hb1~karmic1_all.deb (4.4 MiB)
nautilus_2.28.1-0ubuntu3~hb1~karmic1_i386.deb (1.1 MiB)

libnautilus-extension1_2.28.1-0ubuntu3~hb1~karmic1_amd64.deb (60.4 KiB)
nautilus-data_2.28.1-0ubuntu3~hb1~karmic1_all.deb (4.4 MiB)
nautilus_2.28.1-0ubuntu3~hb1~karmic1_amd64.deb (1.2 MiB)

You can add the PPA instead of just downloading the files, if you wish. You will also find Jaunty packages in the PPA.

Once you install it, restart Nautilus:

killall nautilus && nautilus &

Then press F3 to open the second panel in Nautilus or via the menu.

If you want to start Nautilus by default in dual-panel mode, press Alt + F2, type:


then navigate to apps/nautilus/preferences and enable the option called start_with_extra_pane.

Setting your desktop background as xsplash / gdm in Ubuntu

On a single user system to have the same background for bootsplash, login screen and desktop. As the new xsplash and gdm in ubuntu karmic (9.10) makes this easy to access.

Please Note:- Before running this script take a  backup of the default background file located  at /usr/share/images/xsplash.

Depends on

– xsplash (default on ubuntu karmic)
– imagemagick

Download the script from here

1. Unpack, store it anywhere you like (e.g. ~/.scripts) and make it executable (chmod +x

2. Run ./ --install

3. Add to the startup programs (gnome-session-properties).

4. restart

Testing (without restarting)

Just start change your desktop wallpaper as you normally do (e.g. through gnome-appearance-properties).
Type sudo xsplash in a terminal to see the splash screen (exit with ESC) or log out to see the login screen.

Uninstall/Restore Default Xsplash

1. Remove from the startup programs (gnome-session-properties).

2. Extract your backup file. If you used the install routine this file is called backup.TIMESTAMP (where TIMESTAMP is dynamically generated number) and located at /usr/share/images/xsplash. To get the extraction path right use the following command (you may use the TAB key to complete backup. with the right timestamp number):

tar -C / -xf /usr/share/images/xsplash/backup.TIMESTAMP

3. Version 1.0 only:

sudo -u gdm gconftool-2 -t string -s /desktop/gnome/background/picture_filename /usr/share/images/xsplash/bg_2560×1600.jpg

4. restart (dont change your desktop wallpaper before restarting!)

Customize GDM

You want to use your gtk and icon theme for the login screen? Run ./ --gdm (Note that this only works for system wide installed themes)

If you want to use a different theme than the one you are using on your desktop just use the following commands and replace $my_…_theme with the name of the theme you want to use:

sudo -u gdm gconftool-2 --set --type string /desktop/gnome/interface/gtk_theme $my_gtk_theme

sudo -u gdm gconftool-2 --set --type string /desktop/gnome/interface/icon_theme $my_icon_theme

To restore the default gdm themes run ./ --restore-gdm

That’s it Now it time to put your favorite Wallpapers 🙂




Install Ruby on Rails on Ubuntu Karmic Koala 9.10

If you’re running Ubuntu 9.10 and want to install Ruby on Rails I’ve put together a quick tutorial for you. Not tremendously much has changed since the last tutorial for Jaunty Jackalope. Unicorn is out and while I think it’s nifty, I’m going to wait a little while before playing with it. For now my money is still on Phusion Passenger as being the right tool for the job. If all that seems fine, let’s get to the details.

Step 1: As usual, the first thing we’ll want to do is make sure your version of Ubuntu is up to date.:

sudo apt-get update
sudo apt-get dist-upgrade

If you see this warning it means we have a little more work to do.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Let’s go ahead and set your locale now. (I’m using en-US in this example.. feel free to substitute for your region)

sudo locale-gen en_US.UTF-8
sudo /usr/sbin/update-locale LANG=en_US.UTF-8

Step 2: We’ll be installing some software that needs to be built so we’ll need to get packages required for compiling. With Ubuntu, you can type this single command and get everything you need:

sudo apt-get install build-essential

Step 3: Once you’ve got the tools, it’s time to install MySQL and Ruby. If you’re using SQLite you may not need all this stuff. Otherwise, just copy and paste this command into your terminal if you’re in a hurry. As of Karmic Koala, we’re using MySQL 5.1:

sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.1 mysql-common mysql-server-5.1 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 libhtml-template-perl mysql-server-core-5.1 libmysqlclient16 libreadline5 psmisc

If you hadn’t previously installed MySQL you’ll be asked to set a root password. You don’t have to, of course (it will bug you no fewer than 3 times if you opt not to) but I strongly recommend it. You’ll need this password when you populate your rails config/database.yml file so be sure not to forget it.

Step 4: Grab the latest ruby gems and install them. As always be sure to check to make sure you’re grabbing the latest one. As of this writing it’s 1.3.5 but it never hurts to confirm.

tar xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb

Once it’s done you can remove the .tgz file and erase the rubygems-1.3.5 directory too.

Step 5: On the command line, type gem -v. if you get this message we need to make some symlinks:

The program 'gem' can be found in the following packages:
 * rubygems1.8
 * rubygems1.9
Try: sudo apt-get install
-bash: gem: command not found

Let’s create those symlinks now:

sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb

Step 6: Install Ruby on Rails! You can leave off the –no-rdoc and –no-ri switches if you’re on a machine with plenty of ram. But just in case you’ve got a more modest setup (say 256MB or less) I’d just use the following:

sudo gem install rails --no-rdoc --no-ri

If you’re just doing local development then you are basically done. You may want to install additional gems. If you want to deploy Ruby on Rails onto a server then it’s time to setup Nginx and Phusion.

Step 7: As I mentioned earlier, Unicorn may be the new hotness but I’m going to wait a while before I put my customers on that stack. The folks responsible for Phusion Passenger(Hongli Lai & Ninh Bui) are incredibly smart and I think they’ll look at Unicorn and make some improvements to Phusion to eek out even more performance. The short of it is that I’m still a big believer in Phusion so I’m going to install it for production and recommend that you do too:

sudo apt-get install libc6 libpcre3 libpcre3-dev libpcrecpp0 libssl0.9.8 libssl-dev zlib1g zlib1g-dev lsb-base

Step 8: We’re going to create a directory for your application. In anticipation of Capistrano, let’s put it in /var/www/myapp/current. Swap out the myapp with anything you like.

sudo mkdir -p /var/www/myapp/current

If you’ve got an existing Rails application, it doesn’t hurt to populate that directory now. Just make sure that the root to the public directory is /var/www/myapp/current/public. Don’t forget to chown it for www-data:

sudo chown -R www-data:www-data /var/www/myapp/current/

Step 9: Now it’s time to install Phusion Passenger and let it do it’s magic.

sudo gem install passenger
sudo passenger-install-nginx-module

At this point you’ll be greeted with two options. The first will allow Passenger to do all the work while the second, for advanced users, allows you to point Phusion to your pre-installed Nginx. We’re going to make life easy on ourselves and choose option 1. I’d also recommend keeping the default path (/opt/nginx).

The Nginx configuration file (nginx.conf) file is in /opt/nginx/conf/ They’ve done you the favor of adding the lines you need to get going. Defining the configuration file is beyond the scope of this tutorial, but I’ve included a sample file which you can download. This file assumes your application is in /var/www/myapp/current.

Sample nginx.conf file for Ruby on Rails, Nginx, Phusion Passenger.

Step 10: Time to make some Nginx tweaks for Ubuntu/Debian. If you’re used to running nginx as installed by Debian or Ubuntu then you might notice that you’ve lost the familiar way to start and stop nginx. Gone is /etc/init.d/nginx stop and /etc/init.d/nginx/start. To get it back, copy (or download) this into a file called nginx in /etc/init.d/ (as root)

#! /bin/sh

# Provides:          nginx
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon


test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
        . /etc/default/nginx

set -e

case "$1" in
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$ \
                --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$ \
                --exec $DAEMON
        echo "$NAME."
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile \
                /opt/nginx/logs/$ --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                /opt/nginx/logs/$ --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
          echo -n "Reloading $DESC configuration: "
          start-stop-daemon --stop --signal HUP --quiet --pidfile     /opt/nginx/logs/$ \
              --exec $DAEMON
          echo "$NAME."
            echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
            exit 1

    exit 0

Next, let’s set the permissions and make nginx load on a reboot:

sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults

Now you should be able to start and stop nginx using the command you’re used to:

sudo /etc/init.d/nginx start

Bonus steps In case it’s not already installed, let’s grab the perquisites and then install the mysql gem. This will improve performance on your webserver:

sudo apt-get install libmysqlclient-dev
sudo gem install mysql --no-rdoc --no-ri

You should also look into using a helper for deployment. I still use Capistrano but there are alternatives such as Vlad the Deployer, Puppet and others. I will also recommend that if you go with Capistrano that you check out the capistrano-ext gem which allows you to do multi-stage deployments.

Troubleshooting If things didn’t go smoothly, here are some things to check:

1. There’s an error log for nginx in /opt/nginx/logs/ Try looking to see if you get any hints there.

2. If you see a 403 forbidden error, make sure you have permissions set correctly. I’m running Nginx as www-data and I’ve set the group/user owners of my rails app to match using the chown -R www-data:www-data command. It doesn’t hurt to confirm it.

3. Try running your rails app in development mode using the standard script/server. If it doesn’t work there then it obviously won’t work in production mode either

For help, you should check out the great railsforum or Mailing list front-end.