...
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
...
Preliminary Requirements
- Add your
...
- `id_rsa.
...
- pub` ssh key to launchpad
...
- Navigate to https://launchpad.net/people/+me/+editsshkeys
- copy and paste your public key into the prompt
to output your public key into the terminal run the following command:
Code Block cat ~/.ssh/id_rsa.pub
Setup Vagrant
- References
Install packages
Code Block sudo apt-get -y install
...
virtualbox vagrant virtualbox-dkms
Install a
...
Vagrant 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
- at https://atlas.hashicorp.com/ubuntu/boxes/trusty64
...
- assume 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.,
Code Block mkdir /var/www/vagrant/ && cd /var/www/vagrant/
download and setup vagrant box:
Code Block vagrant init ubuntu/trusty64; vagrant up --provider virtualbox
...
- Create relevant provisions and vagrant settings
Open the Vagrantfile for your vagrant
Code Block nano /var/www/vagrant/Vagrantfile
Insert the following code into the Vagrant file, at the end - but before the
...
config.ssh.forward_agent = true
...
nano ~/.ssh/config
Host 127.0.0.1
ForwardAgent yes
...
`end` command
- Don't forget to replace the values for `your_launchpad_name`, `your_launchpad_email`, etc...
This process will take a /while/ to run you provision your vagrant, especially the first time.
Code Block config.ssh.forward_agent = true;
Create relevant provisioners
...
nano /var/www/vagrant/Vagrantfile
...
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
...
config.vm.provision "shell" do |s|
...
...
your_launchpad_name = "Launchpad Name";
...
your_launchpad_email = "launchpademail@provider.com";
...
your_launchpad_username = "launchpadusername"; your_gpg_password = "a_gpg_password"; your_
...
git_
...
email = "
...
yourgitemail@provider.com";
...
your_git_username = "gitusername"; s.inline = <<-SHELL
...
echo "##########################"; echo Beginning provisioning of packaging environment setup.;
...
echo "##########################"; echo For launchpad: echo Using #{your_launchpad_name} as your name, echo Using #{your_launchpad_email} as your email,
...
echo Using #{your_launchpad_username} as your username... echo For git: echo Using #{your_launchpad_email} as your email, 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}"\
...
nexport DEBEMAIL="#{your_launchpad_email}"' >> ~/.bashrc;
...
source ~/.bashrc;
...
echo
...
"##########################"; 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
- Note: if you had run
vagrant up
before setting these provisions you will need to runvagrant reload --provision
to see these changes affect your vagrant.
Congradulations
config.ssh.forward_agent = true; config.vm.provision "shell" do |s| your_launchpad_name = "Launchpad Name"; your_launchpad_email = "launchpademail@provider.com"; your_launchpad_username = "launchpadusername"; your_gpg_password = "a_gpg_password"; your_git_email = "yourgitemail@provider.com"; your_git_username = "gitusername"; s.inline = <<-SHELL echo "##########################"; echo Beginning provisioning of packaging environment setup.; echo "##########################"; echo For launchpad: echo Using #{your_launchpad_name} as your name, echo Using #{your_launchpad_email} as your email, echo Using #{your_launchpad_username} as your username... echo For git: echo Using #{your_launchpad_email} as your email, 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}"\nexport DEBEMAIL="#{your_launchpad_email}"' >> ~/.bashrc; source ~/.bashrc;
echo "##########################"; 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
...
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:
sudo apt-get install rng-tools
, per https://stackoverflow.com/a/12716881/3068233- the below
python3
code
## 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);
- select default,
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., if response contained
- e.g.,
gpg --send-keys --keyserver keyserver.ubuntu.com 523053B5
- find it with
- response should be
gpg: sending key <pub_key_id> to hkp server keyserver.ubuntu.com
- you can check that ubuntu received your key with
gpg --keyserver hkp://keyserver.ubuntu.com --search-key 'your@email.com'
- you can check that ubuntu received your key with
- send key with
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
- should have form of
- 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
- e.g.,
- decrypt the file with your key
gpg -d email.gpg
- copy and paste the contents into a new file
- open the link contained in the decrypted email and confirm your key by pressing
continue
Congradulations
...
You're all done.