Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Preliminary Requirements

  1. Add your

...

  1. `id_rsa.

...

  1. pub` ssh key to launchpad

      ...

        1. Navigate to https://launchpad.net/people/+me/+editsshkeys
        2. copy and paste your public key into the prompt
          1. to output your public key into the terminal run the following command:

            Code Block
            cat ~/.ssh/id_rsa.pub

      Setup Vagrant

      1. References
        1. https://www.olindata.com/en/blog/2014/07/installing-vagrant-and-virtual-box-ubuntu-1404-lts
      2. Install packages

        Code Block
        sudo apt-get -y install

      ...

      1.  virtualbox vagrant virtualbox-dkms
      2. Install a

      ...

      1. Vagrant Box

        1. Use hashicorp to find a suitable box to install, like ubuntu/trusty64

      ...

        1. at https://atlas.hashicorp.com/ubuntu/boxes/trusty64
          1. note, rest of development we will

      ...

          1. assume that we are using the ubuntu/trusty64 box from hashicorp
        1. navigate to a directory where you wish to store your vagrant configurations for this setup
          1. e.g., 

            Code Block
            mkdir /var/www/vagrant/ && cd /var/www/vagrant/
        2. download and setup vagrant box: 

          Code Block
          vagrant init ubuntu/trusty64; vagrant up --provider virtualbox

      ...

      1. Create relevant provisions and vagrant settings  
        1. Open the Vagrantfile for your vagrant

          Code Block
          nano /var/www/vagrant/Vagrantfile
        2. Insert the following code into the Vagrant file, at the end - but before the

      ...

        1. `end` command

          1. Don't forget to replace the values for `your_launchpad_name`, `your_launchpad_email`, etc... 
          2.  If the formatting on the code block below breaks, visit https://gist.github.com/uladkasach/81cfe5d3b879882152178f0b5c8a6ec0

            Code Block
              config.ssh.forward_agent = true

      ...

      • nano ~/.ssh/config

      ...

          1. ;
              config.vm.provision "shell" do |s|
                your_launchpad_name = "Launchpad Name";
                your_launchpad_email = "launchpademail@provider.com";
                your_launchpad_username 

      ...

          1. = "launchpadusername";
               

      ...

          1.  your_gpg_password = "a_gpg_password";
                your_git_email = "yourgitemail@provider.com";
               

      ...

          1.  

      ...

      Create relevant provisioners

      ...

      • nano /var/www/vagrant/Vagrantfile

      ...

          1. your_git_username = "gitusername";
                s.inline = <<-SHELL
              

      ...

          1.  

      ...

          1.  

      ...

          1.  

      ...

          1.  

      ...

          1.  

      ...

          1.  

      ...

          1. echo "##########################";
                    echo 

      ...

          1. Beginning 

      ...

          1. provisioning 

      ...

          1. of 

      ...

          1. packaging 

      ...

          1. environment 

      ...

          1. setup.;
              

      ...

          1.     

      ...

          1.   

      ...

          1. echo "

      ...

          1. ##########################";
                    echo For launchpad:
                    echo Using #{your_launchpad_name} as 

      ...

          1.  

      ...

          1. your name,
                    echo Using #{your_launchpad_email} as 

      ...

          1. your email,
                    echo Using #{your_launchpad_username} as 

      ...

          1. your username...
                 

      ...

          1.    echo For git:
                    echo Using #{your_launchpad_

      ...

          1. email} as your 

      ...

          1. email,

      ...

          1. 
                    echo Using #{your_launchpad_username} as your username...
                    echo "##########################";
                    echo Updating and Upgrading
                    echo "##########################";
                    sudo apt-get update && sudo apt-get -y upgrade;
                    echo "##########################";
                    echo Installing package building packages...;
                    echo "##########################";
                    sudo apt-get -y 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;
                    echo "##########################";
                    echo Configuring Bazaar...;
                    echo "##########################";
                    bzr whoami "#{your_launchpad_name} <#{your_launchpad_email}>";
                    bzr launchpad-login #{your_launchpad_username};
                    echo "##########################";
                    echo Configuring Git...;
                    echo "##########################";
                    git config --global user.email "#{your_git_email}"
                    git config --global user.name "#{your_git_username}"
                    git config --global push.default simple
                    echo "##########################";
                    echo Assigning your DEBFULLNAME and DEBEMAIL;
                    echo "##########################";
                    echo $'export DEBFULLNAME="#{your_launchpad_name}"\

      ...

          1. nexport DEBEMAIL="#{your_launchpad_email}"' >> ~/.bashrc;
                    source ~/.bashrc;
                    echo 

      ...

      Create and Add a GPG key to Launchpad for your vagrant

      ...

      References

      ...

      Enter your vagrant box

      • vagrant up; vagrant ssh;

      ...

      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);
            

      Send the key to Ubuntu registry

      ...

          1. "##########################";
                    echo Creating your vagrants GPG key;
                    echo "##########################";
                    sudo apt-get install rng-tools;
                    cat > .temp_settings_file <<-SETTINGS
                      %echo Generating a basic OpenPGP key...
                      Key-Type: RSA
                      Key-Length: 2048
                      Subkey-Type: RSA
                      Subkey-Length: 2048
                      Name-Real: #{your_launchpad_name}
                      Name-Email: #{your_launchpad_email}
                      Expire-Date: 0
                      Passphrase: #{your_gpg_password}
                      %commit
                      %echo OpenPGP key created successfully.
            SETTINGS
                    gpg --batch --gen-key .temp_settings_file;
                    rm .temp_settings_file;
                    echo "##########################";
                    echo Packaging environment successfuly provisioned [Success].
                SHELL
              end
        1. Note: if you had run vagrant up before setting these provisions you will need to run vagrant reload --provision to see these changes affect your vagrant.

      Add a your vagrant's GPG key to Ubuntu and Launchpad

      ...

      1. References
        1. https://help.launchpad.net/YourAccount/ImportingYourPGPKey
      2. Enter your vagrant box
        1. Note, this can take a while if this is the first time this vagrant is run or if your triggering its provisioning manually. 

          Code Block
          vagrant up; vagrant ssh;
      3. Send the vagrant's gpg key to Ubuntu registry

        1. Find all your vagrant's keys with 

          Code Block
          gpg --list- keys 
        2. Find the pub id

          1. if you see an entry that looks like `

          1. pub 2048R/523053B5 2017-06-

      ...

          1. 01`,

      ...

          1. `523053B5` is the pub id

        1. Send the keys

          1. run the following command, replacing the `<pub

      ...

          1. _key_

      ...

          1. id>` with the actual value

            Code Block
            gpg --send-keys --keyserver keyserver.ubuntu.com <pub_key_id> 
          2. For example

            Code Block
            gpg 

      ...

          1. --send-keys --keyserver keyserver.ubuntu.com 523053B5
        1. Verify successful transmission

          1. The response

      ...

          1. key sending input should look like the following

            Code Block
            gpg: sending key <pub_key_id> to hkp server keyserver.ubuntu.com

      ...

          1. You can double check that

      ...

          1. the transaction went through successfuly with the following command

            Code Block
            gpg 

      ...

          1. --keyserver hkp://keyserver.ubuntu.com --search-key 'your@email.com'
            1. https://askubuntu.com/questions/29889/how-do-i-check-if-my-openpgp-key-is-in-the-ubuntu-keyserver

      1. Import key into launchpad

        1. navigate to your OpenPGP keys page

        2. get fingerprint of your

      ...

        1. key gpg 

          Code Block
          gpg --fingerprint

      ...

        1. copy paste the key into the launchpad input box, press import key
        2. open email that launchpad sent you
        3. decrypt the email

          1. copy and paste the contents into a new file

            Code Block

      ...

          1. nano email.gpg
          2. decrypt the file with your key

            Code Block
            gpg -d email.gpg
        1. open the link contained in the decrypted email and confirm your key by

      ...

        1. pressing continue

      ...

      Congratulations

      You're all done. You've successfully set up your packaging environment.