Ubuntu Development Beginnings
Regardless whether you are a beginning software developer for Ubuntu or just beginning software development for the first time on any platform, and no matter which programming language you choose, this guide will provide you with a start by giving additional resources, overview the necessary steps for setting up your development platform and links to more detailed instructions.
Ubuntu Beginning Developer Resources
- Tutorials, documentation, languages pages and other useful links:
Beginning Ubuntu Gnu/Linux Development: Code Camp session videos and presentations
Quest for Python: Excellent collection of learning Python resources.
- Books (CC)
- links to Creative Commons books, and other FLOSS resources
Getting Started with Ubuntu Development
This section was built upon Daniel Holbach's Ubuntu Developer's Week class Getting Started with Ubuntu Development and enhanced with additional experience from beginning, intermediate and advanced Ubuntu developers.
Daniel recommends bookmarking MOTU/Getting Started because it has many of the important links you'll need for Ubuntu development.
Note: if all you wish to do is browse source code on Launchpad, no special preparation is required. Simply go to a launchpad project page (for example https://launchpad.net/wifix), click on the Code tab at the top of the page and follow the links provided.
Tools Installation Quick Start
with rough minimal time estimates for the first time
Create a Launchpad account
LP is the hub for most Ubuntu development.
Preparing your Ubuntu Development Platform
The following steps are specific to a particular computer you want to use as a Development platform. So if you want to move to a different computer you would need to repeat these steps. To keep it simple to explain we'll assume your development computer is running some form of Ubuntu though many other possibilities are quite workable.
Create an SSH Key and Register it with Launchpad
(or import an already created one)
Log onto LP onto your LP account's 'Overview' page and where it says SSH Keys there is a little green round button with a plus icon on it, if you have no SSH keys imported, or a little yellow round button with a pencil icon on it otherwise. Click on that icon. That will bring up another screen 'Change your SSH settings'. On that screen there is a help link called Importing your SSH key which will take you to: Creating an SSH Key Pair
SSH (Secure Shell) uses public-key cryptography for LP to authenticate your computer, associate your computer with your LP account and therefore allow you to branch or check out LP project code to that particular authenticated computer.
Installing Development Tools
Minimal Shortcut: Verify Bazaar (bzr) is installed
NOTE: If you want the full tools installation please skip down to Thorough Install: Development Environment now Bazaar is the distributed version control system that Launchpad uses.
Bazaar Explorer (bzr-explorer)
Bazaar Explorer is a gui wrapper for the CLI bzr is recommended for beginners as an excellent way to get started immediately with bzr, and learn bzr functions. Optionally the program can be set to display a terminal while running its functions which can be very educational and actually help to learn the CLI operations. Additionally it can function as sort of a simple project management program -- almost like an IDE (though without debugging). it shows you each of the files in the project and you can easily click on the file icon and bzr-explorer will open the editor of your choice. Also it gives easy access to functions like showing file diffs and displaying project revisions and the change log. Overall it helps to give an overview of what is going on in all the projects you are working on and provides a conceptual overview of how Bazaar works for beginner to advanced user alike.
10 minutes installation
Bazaar itself is a remarkably simple to use CLI (Command Line Interface) tool, so with just a little practice it is realistic to expect being able to make basic productive Use of it.
10 minutes installation
NOTE: At this point your computer will at least be able to branch code that is on Launch Pad and thereby be ready to start examining project code on your computer. However to push code back up to the server you'll minimally need to create a GPG Key pair.
Bazaar Branch and Pull Source Code
1 hour plus
Thorough Install and Configure: Ubuntu Development Tools
The following will accomplish the installation of Bazaar as well as most of the tools you would need for Ubuntu development, minus the above recommended Bazaar Explorer and other specialized tools.
sudo apt-get install --no-install-recommends bzr-builddeb ubuntu-dev-tools fakeroot build-essential gnupg pbuilder debhelper
* bzr-builddeb pulls in bzr.
* ubuntu-dev-tools pulls in devscripts which both are incredibly helpful at making repetitive packaging tasks easy.
* fakeroot is needed by debuild (in devscripts) to mimic root privileges when installing files into a package.
* build-essential pulls in lots of useful very basic build tools like gcc, make, etc.
* gnupg is used to sign files in our case (uploads in the future).
* pbuilder is a build tool that builds source in a sane, clean and minimal environment it sets up itself.
* debhelper contains scripts that automate lots of the build process in a package.
20 minutes plus
Create GPG Key Pair and Register it with Launchpad
Note: if you have a GPG key already, skip this step.
Gnu Privacy Guard (GPG) Keys are used to sign files to upload (aka 'push') to LP, but more generally it is used to sign and encrypt mails, files or text. Developers use it to indicate that we were the last to touch a file and not somebody else. That ensures that only people who we know about get to upload packages.
run: gpg --gen-key Note: A GPG Key is not machine-specific. Once it has been generated you can just copy it to another machine.
Sticking to the defaults is totally fine, for example don't you need a comment if you need more info on gpg keys, go to GPG HowTo which talks about everything in more detail. Enter your name, email address and just stick to the default values for now. It could be that gpg is still sitting there and waiting for more random data to generate your key - that's expected and fine. Just open another terminal while we carry on, it'll finish on its own
20 minutes plus
Set up pbuilder
Open an editor and edit the file ~/.pbuilderrc (create if you don't have it yet) Add the following content to the file
COMPONENTS="main universe multiverse restricted"
and save it
once you're done, run
sudo pbuilder create
This will also take some time.
pbuilder builds packages in a clean and minimal environment It keeps your system "clean" (so you don't install huge numbers of build dependencies on your own system). It makes sure the package builds in a minimal, unmodified environment so you ensure that the package does not just build because you made lots of changes on your system, but the build is reproducible. You can update package lists (later on) with: sudo pbuilder update and to build packages you run: sudo pbuilder build package_version.dsc
pbuilder first gets the minimal packages for a base system, stores them in a tarball, and whenever you build a package it'll untar the base tarball, then install whatever your current build requires, then build it, then tear it all down again. It caches the packages for efficiency's sake.
Configure other tools
While gpg and pbuilder are doing completing their operations we can tell some other tools who we are. If you use the bash shell, which is the default, please edit ~/.bashrc and at the end of it, please add values match those we put into GPG.
DEBEMAIL="<Your email address>"
and save it. Once you're done editing ~/.bashrc, please run
source ~/.bashrc (it's only needed once)