Sharing Printer in Ubuntu

Sharing printer in a LAN (to Windows machine or virtualbox) from a Ubuntu host machine.
1. Setup Samba:
sudo apt-get install system-config-samba.
Launch “Samba” from the launcher
Open “Preferences” > “Server Settings” and enter the work group name used in Windows.

2. Share printer:
Go to http://localhost:631/admin/ and check the box “Share printers connected to this system”.
Go to http://localhost:631/printers/ and check that the expected printer is listed.
Click the printer and check that it is listed as “Idle, Accepting Jobs, Shared, Server Default”.

3. Connect the printer:
Either:
On the Windows computer or (e.g VirtualBox), open Windows Explorer and go to the “Network” item. There’s an icon for the Ubuntu computer; open it. There’s an icon for the printer shared from Ubuntu. Right-click that one and select “Connect…”.

Or:
On the Windows computer, select “Add new printer” then “Connect to a printer on the Internet or network” and specify the full path of “http://{computername}:631/printers/{printername}”