In order to download the source code of an existing package, first install the prerequisites:

sudo apt-get install build-essential debhelper

To get the source code of a package, run the following command:

apt-get source {name_of_package_interested_in}

Make changes to the source using an editor like geany or via terminal through nano. Edit the changelog file and add a record of your changes to build a new revision number. After you have made the changes, run the following commands to build the package which should include your changes.

dpkg-source --commit
dpkg-buildpackage -b

The updated package has been built. To install the package, simply use the below commands:

Automating the installation of software via bash scripting on Linux can be difficult. However, in debian and its related distributions such as Ubuntu, you can simplify the installation of packages by using a few tools. One of these tools is called debconf-utils. If installation packages such as MySQL or PHPMyAdmin ask configuration questions, you can provide a default set of answers without being prompted. This is excellent for testing scripts or automating installation for users who may not know how to appropriately answer these questions.

Basically, with debconf-utils you can pre-answer these questions so that no prompts show up!

To install, run this command:

sudo apt-get install debconf-utils

To get a list of questions an installer might ask, first install the package on a test machine where you're writing the script normally. For example, let's install phpmyadmin:

sudo apt-get install phpmyadmin

Now, to retrieve a set of questions phpmyadmin may ask, you can run this command:

sudo debconf-get-selections | grep phpmyadmin

In your bash script, you can now pre-answer certain questions by including your preconfigured answer commands before installing the package. For example, when phpmyadmin installs, it asks for the MySQL root user password. You can skip this prompt and define what the MySQL root password should be by using this command in your script:

password defines the type and 1234 sets the password to 1234.
You can also suppress questions entirely by using the following command in front of your install command:

DEBIAN_FRONTEND=noninteractive sudo apt-get install phpmyadmin

Default configuration will be used during the installation of the phpmyadmin package, which means it may not work after being installed because some configuration options should be answered. So, use both combinations for various packages to fit your needs!

Sometimes, you get stuck having to manually compile and install software, as no package is available for your Ubuntu distribution or one of the package sources has become broken. However, you should check the link below and search for the software you're looking for, as there MAY already be a pre-existing package for your version of Ubuntu. Typically, you download a software package, read the ReadMe, and are left asking, why doesn't this prerequisite package exist for installation? I've got the names right here! Unfortunately, each version of Linux can name their packages differently. As a result, there's a lot of confusion. However, say the ReadMe prompts you to install nfnetlink development packages. Great, so you try:

sudo apt-get install nfnetlink-dev

Only… the package doesn't exist. What do you do now? Rather than searching the internet, search ubuntu's packages by clicking on the below link:

Once you're on that page, scroll down to the "Search" section. Type in the name of the package you were given. In our example, it was nfnetlink and click on "Search". The first package listed is libnfnetlink-dev. This is exactly what we were looking for! So install it doing this:

sudo apt-get install libnfnetlink-dev

Repeat the process to locate the remaining missing packages.

Once all of your prerequisites have been installed, you should be able to successfully compile and install whatever software package you're trying to install.