VirtualBox guest additions

Higher screen resolution in VirtualBox?

  1. Start Virtual box and log into Ubuntu.
  2. Hit the right ctrl key so you can get your mouse pointer outside the virtual machine.

3.Go to top of virtual window, click on devices then select “Install Guest Additions” You will see a window pop up inside Ubuntu showing you that there are some new files mounted in a virtual CDROM drive. One of those files should be VBoxLinuxAdditions.run

You must run the file with some admin permissions so do that this way…

  1. Click inside the Ubuntu screen again then go to Applications – Accessories then Terminal. The terminal window is where you will run the file from, but first we must navigate to the correct directory.
  2. type this… cd /media/cdrom0 (then hit enter, there is a space after cd!)
  3. next type… dir (You should see amongst the files displayed VBoxLinuxAdditions.run)
  4. now type… sudo sh ./VBoxLinuxAdditions.run (yes, that is a full stop before the slash!)

after you hit enter and it has done its stuff, the files are now accessable from Ubuntu.

  1. You now need to reboot the virtual machine or press Ctrl+Alt+backspace.

Ubuntu lamp

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start.


This is to help people setup and install a LAMP (Linux-Apache-MySQL-PHP) server in Ubuntu, including Apache 2, PHP 5 and MySQL 4.1 or 5.0.

To install the default LAMP stack in Ubuntu 10.04 and above

First install tasksel…

 

$ sudo apt-get install tasksel

… and then the LAMP stack:

 

$ sudo tasksel install lamp-server

See Tasksel – be warned, only use tasksel to install tasks, not to remove them – see https://launchpad.net/bugs/574287
DO NOT UNCHECK ANY PACKAGES IN THE MENU WHICH APPEARS
You can leave your system in an unusable state.

Starting over: How to remove the LAMP stack

To remove the LAMP stack remove the following packages:

  • Note: This assumes you have no other programs that require any of these packages. You might wish to simulate this removal first, and only remove the packages that don’t cause removal of something desired.

 

apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 php5-common php5-mysql

To also remove the debconf data, use the purge option when removing. To get rid of any configurations you may have made to apache, manually remove the /etc/apache2 directory once the packages have been removed.

You may also want to purge these packages:

mysql-client-core-5.5 mysql-server-core-5.5

 

Installing Apache 2

To only install the apache2 webserver, use any method to install:

 

apache2

It requires a restart for it to work:

 

$ sudo /etc/init.d/apache2 restart

or

 

$ sudo service apache2 restart

 

Checking Apache 2 installation

With your web browser, go to the URI http://localhost : if you read “It works!”, which is the content of the file /var/www/index.html , this proves Apache works.

 

Troubleshooting Apache

If you get this error:

apache2: Could not determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

then use a text editor such as “sudo nano” at the command line or “gksudo gedit” on the desktop to create a new file,

$ sudo nano /etc/apache2/conf.d/fqdn

or

$ gksu "gedit /etc/apache2/conf.d/fqdn"

then add

ServerName localhost

to the file and save. This can all be done in a single command with the following:

$ echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

 

Virtual Hosts

Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called default this is what you will see when you browse to http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.

As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2.

To create a new site:

  • Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite 
  • Edit the new configuration file in a text editor “sudo nano” on the command line or “gksudo gedit”, for example: gksudo gedit /etc/apache2/sites-available/mysite
  • Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
  • Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>
  • You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
  • Save the file

Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).

 

$ sudo a2dissite default && sudo a2ensite mysite

Finally, we restart Apache2:

 

$ sudo /etc/init.d/apache2 restart

If you have not created /home/user/public_html/, you will receive an warning message

To test the new site, create a file in /home/user/public_html/:

 

$ echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html

Finally, browse to http://localhost/

 

Installing PHP 5

To only install PHP5. use any method to install the package

 

libapache2-mod-php5

Enable this module by doing

$ sudo a2enmod php5

which creates a symbolic link /etc/apache2/mods-enabled/php5 pointing to /etc/apache2/mods-availble/php5 .

Except if you use deprecated PHP code beginning only by “<?” instead of “<?php” (which is highly inadvisable), open, as root, the file /etc/php5/apache2/php.ini , look for the line “short_open_tag = On”, change it to “short_open_tag = Off” (not including the quotation marks) and add a line of comment (beginning by a semi-colon) giving the reason, the author and the date of this change. This way, if you later want some XML or XHTML file to be served as PHP, the “<?xml” tag will be ignored by PHP instead of being seen as a PHP code mistake.

Relaunch Apache 2 again:

 

$ sudo service apache2 restart

 

Checking PHP 5 installation

In /var/www , create a text file called “test.php”, grant the world (or, at least, Ubuntu user “apache”) permission to read it, write in it the only line: “<?php phpinfo(); ?>” (without the quotation marks) then, with your web browser, go to the URI “http://localhost/test.php“: if you can see a description of PHP5 configuration, it proves PHP 5 works with Apache.

 

Troubleshooting PHP 5

Does your browser ask if you want to download the php file instead of displaying it? If Apache is not actually parsing the php after you restarted it, install libapache2-mod-php5. It is installed when you install the php5 package, but may have been removed inadvertently by packages which need to run a different version of php.

If sudo a2enmod php5 returns “$ This module does not exist!”, you should purge (not just remove) the libapache2-mod-php5 package and reinstall it.

Be sure to clear your browser’s cache before testing your site again. To do this in Firefox 4: Edit → Preferences … Privacy → History: clear your recent history → Details : choose “Everything” in “Time range to clean” and check only “cache”, then click on “Clear now”.

Remember that, for Apache to be called, the URI in your web browser must begin with “http://“. If it begins with “file://“, then the file is read directly by the browser, without Apache, so you get (X)HTML and CSS, but no PHP. If you didn’t configure any host alias or virtual host, then a local URI begins with “http://localhost“, “http://127.0.0.1” or http://” followed by your IP number.

If the problem persists, check your PHP file authorisations (it should be readable at least by Ubuntu user “apache”), and check if the PHP code is correct. For instance, copy your PHP file, replace your whole PHP file content by “<?php phpinfo(); ?>” (without the quotation marks): if you get the PHP test page in your web browser, then the problem is in your PHP code, not in Apache or PHP configuration nor in file permissions. If this doesn’t work, then it is a problem of file authorisation, Apache or PHP configuration, cache not emptied, or Apache not running or not restarted. Use the display of that test file in your web browser to see the list of files influencing PHP behaviour.

 

php.ini development vs. production

After standard installation, php configuration file /etc/php5/apache2/php.ini is set so as “production settings” which means, among others, that no error messages are displayed. So if you e.g. make a syntax error in your php source file, apache server would return HTTP 500 error instead of displaying the php syntax error debug message.

If you want to debug your scripts, it might be better to use the “development” settings. Both development and production settings ini’s are located in /usr/share/php5/

/usr/share/doc/php5-common/examples/php.ini-development 

/usr/share/php5/php.ini-production

so you can compare them and see the exact differences.

To make the “development” settings active, just backup your original php.ini

sudo mv /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.bak

and create a symlink to your desired settings:

sudo cp -s /usr/share/doc/php5-common/examples/php.ini-development /etc/php5/apache2/php.ini

or you may of course also edit the /etc/php5/apache2/php.ini directly on your own, if you wish.

 

PHP in user directories

According to this blog, newer versions of Ubuntu do not have PHP enabled by default for user directories (your public_html folder). See the blog for instructions on how to change this back.

 

Installing MYSQL with PHP 5

Use any method to install

 

mysql-server libapache2-mod-auth-mysql php5-mysql

 

After installing PHP

You may need to increase the memory limit that PHP imposes on a script. Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value.

 

After installing MySQL

 

Set mysql bind address

Before you can access the database from other computers in your network, you have to change its bind address. Note that this can be a security problem, because your database can be accessed by other computers than your own. Skip this step if the applications which require mysql are running on the same machine.

type:

$ sudo nano /etc/mysql/my.cnf

and change the line:

bind-address           = localhost

to your own internal ip address e.g. 192.168.1.20

bind-address           = 192.168.1.20

If your ip address is dynamic you can also comment out the bind-address line and it will default to your current ip.

If you try to connect without changing the bind-address you will recieve a “Can not connect to mysql error 10061”.

 

Set mysql root password

Before accessing the database by console you need to type:

$ mysql -u root

At the mysql console type:

$ mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

A successful mysql command will show:

Query OK, 0 rows affected (0.00 sec)

Mysql commands can span several lines. Do not forget to end your mysql command with a semicolon.

Note: If you have already set a password for the mysql root, you will need to use:

$ mysql -u root -p

(Did you forget the mysql-root password? See MysqlPasswordReset.)

 

Create a mysql database

 

$ mysql> CREATE DATABASE database1;

 

Create a mysql user

For creating a new user with all privileges (use only for troubleshooting), at mysql prompt type:

$ mysql> GRANT ALL PRIVILEGES ON *.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

For creating a new user with fewer privileges (should work for most web applications) which can only use the database named “database1”, at mysql prompt type:

$ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database1.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword';

yourusername and yourpassword can be anything you like. database1 is the name of the database the user gets access to. localhost is the location which gets access to your database. You can change it to ‘%’ (or to hostnames or ip addresses) to allow connections from every location (or only from specific locations) to the database. Note, that this can be a security problem and should only be used for testing purposes!

To exit the mysql prompt type:

$ mysql> q

Since the mysql root password is now set, if you need to use mysql again (as the mysql root), you will need to use:

$ mysql -u root -p

and then enter the password at the prompt.

 

Backup-Settings

Please, let’s say something in which directories mysql stores the database information and how to configure a backup

 

Alternatively

There is more than just one way to set the mysql root password and create a database. For example mysqladmin can be used:

 

$ mysqladmin -u root -p password yourpassword

and

 

$ mysqladmin -u root -p create database1

mysqladmin is a command-line tool provided by the default LAMP install.

 

Phpmyadmin and mysql-workbench

All mysql tasks including setting the root password and creating databases can be done via a graphical interface using phpmyadmin or mysql-workbench.

To install one or both of them, first enable the universe repository

Use any method to install

 

phpmyadmin

 

Troubleshooting Phpmyadmin & mysql-workbench

If you get blowfish_secret error: Choose and set a phrase for cryptography in the file /etc/phpmyadmin/blowfish_secret.inc.php and copy the line (not the php tags) into the file /etc/phpmyadmin/config.inc.php or you will receive an error.

If you get a 404 error upon visiting http://localhost/phpmyadmin: You will need to configure apache2.conf to work with Phpmyadmin.

 

$ gksudo gedit /etc/apache2/apache2.conf

Include the following line at the bottom of the file, save and quit.

 

$ Include /etc/phpmyadmin/apache.conf

 

Alternative: install phpMyAdmin from source

See the phpMyAdmin page for instructions on how to install phpmyadmin from source:

 

Mysql-workbench

Mysql-workbench runs locally, on the desktop. Use any method to install

 

mysql-workbench

 

For more information

2.9.3. Securing the Initial MySQL Accounts from the MySQL Reference Manual is worth reading.

 

Edit Apache Configuration

You may want your current user to be the PHP pages administrator. To do so, edit the Apache configuration file :

$ gksudo "gedit /etc/apache2/envvars"

Search both the strings starting by “APACHE_RUN_USER” and “APACHE_RUN_GROUP”, and change the names to the current username and groupname you are using. Then you’ll need to restart Apache. (look at the next chapter concerning apache commands)

Configuration options relating specifically to user websites (accessed through localhost/~username) are in /etc/apache2/mods-enabled/userdir.conf.

 

Installing suPHP

suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.

Note: suPHP enforces, security and helps avoid file permission problems under development environments with several users editing the site files, but it also demands more memory and CPU usage, which can degrade your server performance under certain circumstances.

To only install suPHP. use any method to install the package

 

libapache2-mod-suphp

Enable this module by doing

 

sudo a2enmod suphp

then use a text editor such as “sudo nano” at the command line or “gksudo gedit” on the desktop to edit this file

 

sudo nano /etc/apache2/mods-available/php5.conf

or

 

gksu "gedit /etc/apache2/mods-available/php5.conf"

make a new empty line at the top of the content, then add

 

<Directory /usr/share>

make a new empty line at the bottom of the content, then add

 

</Directory>

save changes

For security reasons we need to specify to suPHP what are the document paths allowed to execute scripts, use a text editor such as “sudo nano” at the command line or “gksudo gedit” on the desktop to edit this file

 

sudo nano /etc/suphp/suphp.conf

or

 

gksu "gedit /etc/suphp/suphp.conf

find the value “docroot” and specify the document path of your site files, for example:

 

docroot=/var/www/

that value restrict script execution only to files inside “/var/www/”

 

docroot=/var/www/:${HOME}/public_html

that value restrict script execution only to files inside a custom home folder for each configured user inside “/var/www/:${HOME}/public_html”

for this tutorial we are going to use this value

 

docroot=/home/user/public_html/

which is the same Apache directory directive set before in this document

save changes

to restart Apache, type in your terminal

 

sudo /etc/init.d/apache2 restart

Now lets create a test script to see if suPHP is working correctly, in your terminal type

 

echo "<?php echo 'whoim = '.exec('/usr/bin/whoami');?>" | tee /home/user/public_html/whomi.php

that command creates a quick php test file to display the current user executing the script

open your browser and navigate to “localhost/whomi.php”, most likely the browser will show you a “500” server error, this is because suPHP does not allow too permissive file and folder permissions and also does not allow mixed file and folder ownership, to correct this type in your terminal

 

sudo find /home/user/public_html/ -type f -exec chmod 644 {} ;
sudo find /home/user/public_html/ -type d -exec chmod 755 {} ;
sudo chown user:group -R /home/user/public_html/

those commands enforce a secure and correct file and folder permission and also set a correct user and group ownership for all of them

Now open your browser and navigate to “localhost/whomi.php”, if everything went fine you should see the name of the file owner executing the script and not “www-data” unless you specified so

 

Run, Stop, Test, And Restart Apache

Use the following command to run Apache :

$ sudo /usr/sbin/apache2ctl start

To stop it, use :

$ sudo /usr/sbin/apache2ctl stop

To test configuration changes, use :

$ sudo /usr/sbin/apache2ctl configtest

Finally, to restart it, run :

$ sudo /usr/sbin/apache2ctl restart

Alternatively, you can use a graphical interface by installing Rapache or the simpler localhost-indicator.

Using Apache

You can access apache by typing 127.0.0.1 or http://localhost (by default it will be listening on port 80) in your browser address bar. By default the directory for apache server pages is /var/www . It needs root access in order to put files in. A way to do it is just starting the file browser as root in a terminal:

$ gksudo nautilus

or

if you want to make /var/www your own. (Use only for non-production web servers – this is not the most secure way to do things.)

$ sudo chown -R $USER:$USER /var/www

 

Status

To check the status of your PHP installation:

 $ gksudo "gedit /var/www/testphp.php"

and insert the following line

 <?php phpinfo(); ?>

View this page on a web browser at http://yourserveripaddress/testphp.php or http://localhost/testphp.php

 

Securing Apache

If you just want to run your Apache install as a development server and want to prevent it from listening for incoming connection attempts, this is easy to do.

$ gksudo "gedit /etc/apache2/ports.conf"
$ password:

Change ports.conf so that it contains:

Listen 127.0.0.1:80

Save this file, and restart Apache (see above). Now Apache will serve only to your home domain, http://127.0.0.1 or http://localhost.

 

Password-Protect a Directory

There are 2 ways to password-protect a specific directory. The recommended way involves editing  /etc/apache2/apache2.conf . (To do this, you need root access). The other way involves editing a .htaccess file in the directory to be protected. (To do this, you need access to that directory).

 

Password-Protect a Directory With .htaccess

See EnablingUseOfApacheHtaccessFiles

Warning: On at least some versions of Ubuntu, .htaccess files will not work by default. See EnablingUseOfApacheHtaccessFiles for help on enabling them.

 

thumbnails

If you direct your web browser to a directory (rather than a specific file), and there is no “index.html” file in that directory, Apache will generate an index file on-the-fly listing all the files and folders in that directory. Each folder has a little icon of a folder next to it.

To put a thumbnail of that specific image (rather than the generic “image icon”) next to each image file (.jpg, .png, etc.):

… todo: add instructions on how to do thumbnails here, perhaps using Apache::AutoIndex 0.08 or Apache::Album 0.95

 

Known problems

 

Skype incompatibility

Skype uses port 80 for incoming calls, and thus, may block Apache. The solution is to change the port in one of the applications. Usually, port 81 is free and works fine. To change the port number in Skype go to menu Tools > Options, then click on the Advanced tab, then in the box of the port for incoming calls write your preference.

 

Other Apache Options

 

Further Information

USB drive Ubuntu install using VirtualBox

There are many ways to create a live USB drive carrying an operating system like Ubuntu, but the method I will describe further is mainly based on using SUN’s VirtualBox.

While the method described on the Ubuntu documentations implies installing a Live CD image on a USB flash drive, which would then need to extract and load the operating system in the RAM, the method described on this page implies installing a fresh operating system on a bootable flash drive that will work the same way as from a real HDD (except the speed, of course). Thus, you should have a good bootable USB 2.0, with decent I/O data processing speeds, with at least 4GB (considering that the operating system itself weighs ~2GB, Karmic Koala).

(assuming you’ve already installed guest additions)

Click on Settings for your virtual machine, go to USB tab. Check the two boxes, since you do want USB 2.0 support. In theory, this is all, but there’s one step we will need to do afterwards to get this really working. True for Windows, Linux needs a bit more sweat.

You also need to set USB filters so that the USB devices get sent to the guest OS. USB filter is a nice feature that allows you to automatically connect USB devices to your virtual machine. Any device listed in the filter box will be plugged in when you power the guest operating system. Other devices will require that you manually connect them.

From the main Virtualbox window open the Settings dialog, then the USB section, then click the little “add filter” button on the right side of the screen. You should be able to create a filter from any currently connected USB devices.

Much like VMware Tools for VMware products, the Guest Additions expose additional functionality in the virtual machine, boost performance, enhance sharing, and more. We’ve had a long tutorial, which explains how to achieve this in both Windows and Linux virtual machines. You will need to add your user to the VirtualBox group to be able to share USB resources. You can do this from the command line or try the GUI menus.

All right, so we’re running Ubuntu with Gnome desktop. Therefore, go to System > Administration > Users and Groups. In the menu that opens, click on Manage Groups. Scroll and look for the vboxusers group. Click on the Properties button. Make sure your user is listed and checked in the Group Members field. You will need to logout and login back into the session for the effects to take change. Now, power on the virtual machine once more and see what happens.

I had the same problem and fixed it by clicking in the VirtualBox group of my user. You can access it installing gnome-system-tools (it does not come with Ubuntu 12.04 Precise Pangolin), either via the Ubuntu Software Center, Synaptic or by typing in the terminal:

sudo apt-get install gnome-system-tools

Then you head to your Dash home and type users. You will see two applications. The good one is Users and Groups.

You then have to click on Advanced settings for your user and enter your password.

Now you will be shown a window with three tabs. Click on User Privileges. Find the line that says Use Virtualbox virtualization solution and then OK.

After you’ve done this (maybe restart to be sure the host OS isn’t capturing any of the USB devices for itself–Ubuntu will try to automount the flash drive so you might also want to check and make sure that it is unmounted too) then boot into the guest OS and you should see your USB devices.

Good luck.

Edit: note on USB filters

It’s my understanding that a device being used by a guest OS with a USB filter will not be accessible by the host OS while the guest OS is running. Therefore, one should choose carefully what usb devices to create filters for.

You should create USB filters for things that you plan on only using with the guest OS (often peripherals that don’t work with the host OS and will only work with the guest OS) and when you won’t require being able to access the device from the host OS while the guest OS is running. For example I have a USB banking dongle from my bank, ICBC, that is not compatible with Linux so I use a virtualized installation of Windows XP for banking and use a USB filter to grab the USB dongle.

Examples of good devices to create filters for:

  • USB banking dongles that only work with guest OS
  • e-readers (Kindle,Nook,etc.) that you plan on using only (or primarily) with the guest OS.
  • external soundcards that only work with the guest OS or require the guest OS for full functionality

Examples of bad devices to create filters for:

  • USB input devices (mouses or keyboards) that you would like to use with the host and guest OSes. Virtualbox will allow the guest OS access to these devices by default so there is no need for the guest OS to directly control them (well, I could think of some specialized reasons but I will digress…).
  • USB storage devices that you want the guest and the host OSes to both be able to access at the same time. Instead, mount the drive on the host OS and use shared folders to share the drive to the guest OS.

Remember that to paste in the terminal you have to use CTRL+SHIFT+V, as opposed to CTRL+V

You will probably have to enter your password to allow the installation and add a Y (as in yes) to finish installing the packages.
Press alt-f2 and type ccsm (do you have compiz settings manager installed?) Scroll to the bottom and find the “move windows” icon and click on it. There is an option “constrain Y”; uncheck this and you can pull the windows where you want. If you are useing “advanced desktop settings” and dont have compiz-config-settings installed open a terminal and digit;

sudo apt-get install compizconfig-settings-manager

More reading

For a whole library full of tutorials, guides, howtos, tips and tricks on virtualization, feel free to click on any of the links below, preferably all.

VirtualBox 3 overview

Compiz Fusion in VirtualBox 3

DirectX in VirtualBox 3

Seamless mode in VirtualBox

VirtualBox desktop shortcuts

Portable VirtualBox

How to add new hard disks in VirtualBox – Tutorial

How to clone disks in VirtualBox – Tutorial

How to shrink/expand disks in VirtualBox – Tutorial

How to install VirtualBox Guest Additions – Tutorial

Network & sharing in VirtualBox – Tutorial

How to boot from CD-ROM in newer versions of VirtualBox – Tutorial

Ubuntu Unity .desktop

In order to add your launcher to the Unity Launcher on the left, you have to place your .desktop file at /usr/share/applications/ or at ~/.local/share/applications/. After moving your file there, search for it in the Dash (Windows key -> type the name of the application) and drag and drop it to the Unity Launcher. Now your launcher (.desktop file) is locked on the Unity Launcher! If your desktop file cannot be found by doing a search from the Dash, you may need to read on…

To be more certain that your .desktop file will work properly, use the desktop file validator, which will notify you of any errors or omissions. If there are no errors, desktop-file-validator will exit silently.

Once the file validates correctly, install it to the default location (probably /usr/share/applications) using the desktop-file-install program. This step may require superuser privileges. The desktop-file-install program may add some lines of its own to your .desktop file. There is no need to have the .desktop file be executable by anyone.

Please note that desktop-file-validate tends to be oversensitive at times, which means that it can output error messages on perfectly working .desktop files. Those error messages should be better seen as warnings rather than anything else. For more information on desktop entry specification please refer to http://standards.freedesktop.org/desktop-entry-spec/latest/

To create a simple custom .desktop you will need to add these entries to a .desktop file of your choice in ~/.local/share/applications/

nano ~/.local/share/applications/your_application_name.desktop
[Desktop Entry]
Name=the name you want shown
Comment=
Exec=command to run
Icon=icon name
Terminal=false
Type=Application
StartupNotify=true

For extra options for your .desktop file you can visit this site. All the options available are very well described there.

You can also copy a existing application’s .desktop file from /usr/share/applications/to your ~/.local/share/applications/ and edit it to fit your needs.

ie: this will copy gedit .desktop file to the folder where the .desktop files should be saved for a user

cd ~/.local/share/applications
sudo cp /usr/share/applications/gedit.desktop .

After that open that location using nautilus ~/.local/share/applications/ and drag n drop the file you have just created to the Unity launcher.

Has an option instead of drag n dropping the file you can open dconf-editor (install it with sudo apt-get install dconf-tools or look for it in the USC) and navigate to desktop.unity.launcher and edit the key favorites by double clicking on the entries to the right of the key.

To add your custom launcher add it at the position you want with this format ‘/home//.local/share/applications/.desktop’. Don’t forget to respect the , and the spaces in that line and make sure that the line starts and ends with [ and ]respectively.

With this method you will need to log off and back in for the change in favorites to take effect. This will make it appear in the dash

Ubuntu Repositories

On systems like Ubuntu, most software is packaged in nice .deb (or .rpm, like in Red Hat) files which contain the programs and libraries you need. These files can be downloaded or come in CDs (Ubuntu’s CD is full of them). Repositories are servers which contain sets of packages. You generally access them with tools like Synaptic.

These tools can list all the packages you have installed (from your kernel to your favorite application with all the libraries in between) and the packages that are available in the repositories that you have configured the tool to have access to. They also let you search for simple things like “image editor”.

These tools provide a simple, centralized method of software installation and give the distributors (who set up the repositories) a centralized way to send you updates(1) to your software.

In Ubuntu you generally want to have at least Ubuntu’s repositories (which may include the install CD) but it is not uncommon to have other repositories (from other packagers) set up.

It’s important to know that most of the tools you’ll want to use in Ubuntu are already in Ubuntu’s repositories. You can go search the internet for packages, or even source code, for others, but these will be more difficult to install and won’t, most of the time, integrate as well with your system.

So now you know: no more endless searching looking for spyware-infested shareware and freeware. The vast majority of useful software available for Linux is pre-packaged for you.

 

Components

Software in Ubuntu’s repository is divided into four categories or components – main, restricted, universe and multiverse.

Most people will use the Ubuntu Software Centre to install the software they want. But if you’re interested in learning more about the different categories of software we include, read on! Software is grouped according to our ability to maintain it and by how well it meets the goals of our free software philosophy. The standard Ubuntu installation is a collection of software from the main and restricted components. You can install additional software from the Ubuntu Software Centre.

 

Main

The main component contains applications that are free software, can be freely redistributed and are fully supported by the Ubuntu team. This includes the most popular and most reliable open-source applications available, many of which are included by default when you install Ubuntu. Software in main includes a hand-selected list of applications that the Ubuntu developers, community and users feel are most important, and that the Ubuntu security and distribution team are willing to support. When you install software from the main component, you are assured that the software will come with security updates and that commercial technical support is available from Canonical.

 

Restricted

Our commitment is to only promote free software – or software available under a free licence. However, we make exceptions for a small set of tools and drivers that make it possible to install Ubuntu and its free applications on everyday hardware. These proprietary drivers are kept in the restricted component. Please note that it may not be possible to provide complete support for this software because we are unable to fix the software ourselves – we can only forward problem reports to the actual authors. Some software from restricted will be installed on Ubuntu CDs but is clearly separated to ensure that it is easy to remove. We will only use non-open-source software when there is no other way to install Ubuntu. The Ubuntu team works with vendors to accelerate the open-sourcing of their software to ensure that as much software as possible is available under a free licence.

 

Universe

The universe component is a snapshot of the free, open-source, and Linux world. It houses almost every piece of open-source software, all built from a range of public sources. Canonical does not provide a guarantee of regular security updates for software in the universe component, but will provide these where they are made available by the community. Users should understand the risk inherent in using these packages. Popular or well supported pieces of software will move from universe into main if they are backed by maintainers willing to meet the standards set by the Ubuntu team.

 

Multiverse

The multiverse component contains software that is not free, which means the licensing requirements of this software do not meet the Ubuntu main component licence policy. The onus is on you to verify your rights to use this software and comply with the licensing terms of the copyright holder. This software is not supported and usually cannot be fixed or updated. Use it at your own risk.

 

A Quick, Tongue-in-cheek Description of the Ubuntu Repositories

  • $release: Don’t touch it, I like consistency, even with my bugs.
  • $release-security: I’ll accept patches to existing versions (and very rare version upgrades if absolutely necessary) in the process of keeping my system secure.
  • $release-updates: Okay, some bugs are worth fixing, and I trust you this much (holds up two fingers like Maxwell Smart).
  • $release-backports: I have something akin to technology ADHD, needing the latest of everything I can possibly get, but I can’t handle running the development branch.
  • $devel: I can take it. Seriously. If you break my X, I shall become more powerful than you could possibly imagine. I’ll file and maybe even fix the bugs and I’ll do it even if power management is not so much ‘managed’ as vomited all over the wall. Come get some.
  • Debian: We do the work so you don’t have to.

Source: Jeff Waugh, “Understanding the Ubuntu Package Repositories” (modestly edited, as recommended by Waugh)

 

Managing Repositories

 

Further Reading

Lubuntu is a fast and lightweight operating system developed by a community of Free and Open Source enthusiasts. The core of the system is based on Linux and Ubuntu . Lubuntu uses the minimal desktop LXDE, and a selection of light applications. We focus on speed and energy-efficiency. Because of this, Lubuntu has very low hardware requirements. Please join us and contribute to an exciting International Free and Open Source Software project. Install Lubuntu on your computer and start getting involved. Quick links for direct Downloads of the latest version:

[Download lubuntu (Intel x86) desktop CD]   [Download Torrent]

[Download lubuntu 64-bit (AMD64) desktop CD]   [Download Torrent]

[Download 64-bit Mac (AMD64) desktop image]   [Download Torrent]

PCs with the Windows 8 logo or UEFI firmware, choose the 64-bit download. Visit the help pages for more info about which download is best for you. The section discusses both the standard installs and those required for computers with low memory (RAM), old chipsets (i586) and low disk-space (netbooks).

Lua and SciTE

SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations.

SciTE is currently available for Intel Windows (XP or later) and Linux compatible operating systems with GTK+. It has been run on Windows 7 and on Fedora 12 and Ubuntu 10.10 with GTK+ 2.20. Here is a screenshot of SciTE.

You can download Scintilla and SciTE.

There are some extra configuration files that can enhance SciTE for various languages and APIs.

Questions and comments about SciTE should be directed to the scite-interest mailing list, which is for discussion of SciTE and related projects, their bugs and future features. This is a low traffic list, averaging less than 50 messages per week. To avoid spam, only list members can write to the list. New versions of SciTE are announced on scite-interest and may also be received by SourceForge members by clicking on the Monitor column icon for “scite” on the downloads page.

There is a Scintilla project page hosted on Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads

Lua’s name is not an acronym. It is properly spelled as “Lua” or occasionally “lua”, but never “LUA”. See lua.org/about.html for the whole story.

First of all work your way through the Programming in Lua, it should take you a day or two to get the gist of Lua. The book is free online. Besides it is the best tutorial out there on Lua,

Also: If you’re purpose is Lua for World of Warcraft (probably not but just in case) you can check out this tutorial

And: Here is a tips and tricks thread on StackOverflow, might help give you some ideas of what to expect from Lua

Suggested Programs/Exercises:

Since you’re initially looking at Lua for web development try to understand and improve the Data Description example in PIL. It’ll give you a few good ideas and a nice feel for the power or Lua.

Then you might want to try out playing with the Data Structures chapter, although Lua has a single complex data-type, the Table, that chapter will show you Lua-like ways to make a table do anything you need.

Finally once you begin to grok metatables you should design a class system (yes with Lua you decide how your class system works). I’m sure everyone that knows Lua has made a dozen class systems, a good chapter to get you started on a class system is Object-Oriented Programming

And if you got time and know C or something like that (C# and Java included) try extending an application with Lua, but that’ll take a week or two to do

 

extended traceback printer

The standard Python traceback module provides very useful functions to produce useful information about where and why an error occurred. Traceback objects actually contain a great deal more information than the traceback module displays, however. That information can greatly assist in detecting the cause of your error.

There is a Python recipe that, while not an interactive debugger, makes it easier to debug Python scripts within SciTE.

Here’s an example of an extended traceback printer you might use, followed by a usage example.

import sys,traceback
defprint_exc_plus():
    “””
    Print the usual traceback information, followed by a listing of all the
    local variables in each frame.
    “””
    tb=sys.exc_info()[2]
    stack=[]
    
    whiletb:
        stack.append(tb.tb_frame)
        tb=tb.tb_next
    traceback.print_exc()
    print“Locals by frame, innermost last”
    forframeinstack:
        print
        print“Frame %s in %s at line %s”%(frame.f_code.co_name,
                                             frame.f_code.co_filename,
                                             frame.f_lineno)
        forkey,valueinframe.f_locals.items():
            print“t%20s = “%key,
            #We have to be careful not to cause a new error in our error
            #printer! Calling str() on an unknown object could cause an
            #error we don’t want.
            try:                   
                printvalue
            except:
                print“<ERROR WHILE PRINTING VALUE>”
        
try:
        iflen(sys.argv)>1:
                length=len(sys.argv)
                foriinrange(1,length):       
                        sys.argv[i1]=sys.argv[i]
                delsys.argv[length1]
                execfile(sys.argv[0])
except:
        print_exc_plus()