Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Large update of documentation

...

Is to help systems administrators support and maintain the script for installing the OHIE stack: "How to install DATIM4U OHIE Stack"

...

General References:

http://packaging.ubuntu.com/html/packaging-new-software.html

...

https://askubuntu.com/questions/33413/how-to-create-a-meta-package-that-automatically-installs-other-packages

 

Optimized setup: - use this after performing a complete example somewhere else

Basic system update and upgrade:

Code Block
languagebash
ubuntu:~#sudo apt-get update
ubuntu:~#sudo apt-get upgrade

 

For having pbuilder that creates a clean simple ubuntu environment for builds:

...

languagebash



Preliminary Requirements

  1. Add your id_rsa.pub ssh key to launchpad

Setup Vagrant

  1. References

  2. Install packages

    • sudo apt-get install virtualbox
    • sudo apt-get install vagrant
    • sudo apt-get install virtualbox-dkms
  3. Install a Vargrant Box

    • Use hashicorp to find a suitable box to install, like ubuntu/trusty64 at https://atlas.hashicorp.com/ubuntu/boxes/trusty64
      • note, rest of development we will sume that we are using the ubuntu/trusty64 box from hashicorp
    • navigate to a directory where you wish to store your vagrant configurations for this setup
      • e.g., mkdir /var/www/vagrant/ && cd /var/www/vagrant/
    • download and setup vagrant box: vagrant init ubuntu/trusty64; vagrant up --provider virtualbox
  4. Enable forwarding of SSH keys to vagrant

    • Open the Vagrantfile for your vagrant
      • nano /var/www/vagrant/Vagrantfile
    • Insert the following code into the Vagrant file, at the end - but before the end command
        config.ssh.forward_agent = true
      
    • Insert the following code into your local ~/.ssh/config file to enable agent forwarding to localhost
      • nano ~/.ssh/config
        Host                    127.0.0.1
          ForwardAgent          yes 
      
    • Note: if you find that SSH is not working you can test your keys in your vagrant with ssh -T git@github.com
  5. Create relevant provisioners

    • Open the Vagrantfile for your vagrant
      • nano /var/www/vagrant/Vagrantfile
    • Insert the following code into the Vagrant file, at the end - but before the end command
      • For provisioner that will update and upgrade your box
          config.vm.provision "shell" do |s|
            s.inline = <<-SHELL
         sudo apt-get update && sudo apt-get -y upgrade;
         echo Update and upgrade successfully provisioned [Success].
         SHELL
          end
      • For provisioner that setup packaging environment automatically
          config.vm.provision "shell" do |s|
            your_launchpad_name = "Launchpad Name";
            your_launchpad_email = "launchpademail@provider.com";
            your_launchpad_username = "launchpadusername";
            s.inline = <<-SHELL
         echo Beginning provisioning of packaging environment setup.;
         echo Using #{your_launchpad_name} as your name, #{your_launchpad_email} as your email, and #{your_launchpad_username} as your username....;
         sudo apt-get -y 

...

This does the packaging but is not used regularly

...

languagebash

...

      • install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file

...

      • ; 
         sudo apt-get -y install packaging-dev

...

      • ; # Install packaging package
         echo This next part may take a little while...;
         pbuilder-dist trusty create;
         bzr whoami "#{your_launchpad_name} <#{your_launchpad_email}>";
         bzr launchpad-login #{your_launchpad_username};
         echo $'export DEBFULLNAME="#{your_launchpad_name}"\nexport DEBEMAIL="#{your_launchpad_email}"' >> ~/.bashrc;
         source ~/.bashrc;
         echo Packaging environment successfuly provisioned [Success].
         SHELL
          end
    • Note: if you had run vagrant up before setting these provisions you will need to run vagrant reload --provision to see changes

Create and Add a GPG key to Launchpad for your vagrant

  1. References

  2. Enter your vagrant box

    • vagrant up; vagrant ssh;
  3. Create a gpg key

    • gpg --gen-key
      • select default, 1
      • select default, 2048
      • select default, 0
      • create user id
        • enter name
        • enter email (ensure that this is the same email as you signed up to launchpad with or this will not work)
        • enter 'comment'
      • confirm user id
      • press okay
      • help with entropy
        • this may or may not take a long time
        • if it is taking a long time, try the following:
          ## note press ctrl-c to stop when needed, exit python by typing `exit()` after stopping
          import time;
          import random;
          while True: 
              print("Increasing entropy... hopefully...\n");
              print(", ".join([str(random.randint(0,100)) for i in range(random.randint(0,100))])); ## print randint randint elements
              print("\n", "and sleep...");
              time.sleep(0.01);
          
  4. Send the key to Ubuntu registry

    • send key with gpg --send-keys --keyserver keyserver.ubuntu.com <pub_key_id>
      • find it with gpg --list- keys (you are looking for the 8 digit pub id)
        • e.g., if response contained pub 2048R/523053B5 2017-06-01, 523053B5 is the <pub_key_id>
      • e.g., gpg --send-keys --keyserver keyserver.ubuntu.com 523053B5
    • response should be gpg: sending key <pub_key_id> to hkp server keyserver.ubuntu.com
  5. Import key into launchpad

    • navigate to your OpenPGP keys page
    • get fingerprint of your key gpg --fingerprint
      • should have form of XXXX XXXX XXXX XXXX XXXX XXXX XXX XXXX XXXX XXXX
    • copy paste the key into the launchpad input box, press import key
    • open email that launchpad sent you
    • decrypt the email
      • copy and paste the contents into a new file
        • e.g., nano email.gpg
      • decrypt the file with your key
        • gpg -d email.gpg
    • open the link contained in the decrypted email and confirm your key by pressing continue

Congradulations

You're all done.

Generate the gpg key:

Code Block
languagebash
gpg --gen-key

 

 

Send the keys to launchpad:

Code Block
languagebash
gpg --send-keys --keyserver keyserver.ubuntu.com keythatgotgenerated

 

 

Copy paste the secure email from launchpad to read its content:

Code Block
languagebash
vim mail.gpg

Extract the message for the launchpad stuff:

Code Block
languagebash
gpg -d mail.gpg

 

Creating the clean pbuilder environment:

Code Block
languagebash
pbuilder-dist trusty create

Should match with the gpg key:

Code Block
languagebash
bzr whoami "YourName <youremailid>"

Launchpad key:

Code Block
languagebash
bzr launchpad-login yourlaunchpadid

These commands should be included in the bashrc file:

 

Code Block
languagebash
vim ~/.bashrc

 

and add:

Code Block
languagebash
export DEBFULLNAME="YourFullName"
export DEBEMAIL="youremailid"

 

Source the script:

 

Code Block
languagebash
source ~/.bashrc

basic git config necessary:

 

Code Block
languagebash
git config --global user.email "youremailid"
git config --global user.name "youreusername"
git config --global core.editor "vim"
git config --global push.default simple
git --version

 

This allows us to access the actual file system - vagrant is useful this way that by placing //files/folders in this folder will allow them to be accessible to vagrant shell:

 

Code Block
languagebash
cd /vagrant
mkdir code
cd packages/
mkdir -p adxadapter2
cd adxadapter2/
sudo apt-get install openjdk-7-jdk --no-install-recommends

This will create the .ssh folder in the exact location:

 

Code Block
languagebash
ssh-keygen

Copy your private rsa key so that you can directly access github:

Code Block
languagebash
cp id_rsa ~/.ssh/
cd .ssh
cd ..

 

Remove the created public file that is not required created by ssh-keygen file:

 

...

languagebash

...