...
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
...
Optimized setup: - use this after performing a complete example somewhere else
Basic system update and upgrade:
Code Block | ||
---|---|---|
| ||
ubuntu:~#sudo apt-get update
ubuntu:~#sudo apt-get upgrade |
For having pbuilder that creates a clean simple ubuntu environment for builds:
...
language | bash |
---|
...
This does the packaging but is not used regularly
...
language | bash |
---|
...
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 runvagrant reload --provision
to see changes
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.
Generate the gpg key:
Code Block | ||
---|---|---|
| ||
gpg --gen-key |
Send the keys to launchpad:
Code Block | ||
---|---|---|
| ||
gpg --send-keys --keyserver keyserver.ubuntu.com keythatgotgenerated |
Copy paste the secure email from launchpad to read its content:
Code Block | ||
---|---|---|
| ||
vim mail.gpg |
Extract the message for the launchpad stuff:
Code Block | ||
---|---|---|
| ||
gpg -d mail.gpg |
Creating the clean pbuilder environment:
Code Block | ||
---|---|---|
| ||
pbuilder-dist trusty create |
Should match with the gpg key:
Code Block | ||
---|---|---|
| ||
bzr whoami "YourName <youremailid>" |
Launchpad key:
Code Block | ||
---|---|---|
| ||
bzr launchpad-login yourlaunchpadid |
These commands should be included in the bashrc file:
Code Block | ||
---|---|---|
| ||
vim ~/.bashrc |
and add:
Code Block | ||
---|---|---|
| ||
export DEBFULLNAME="YourFullName"
export DEBEMAIL="youremailid" |
Source the script:
Code Block | ||
---|---|---|
| ||
source ~/.bashrc |
basic git config necessary:
Code Block | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
ssh-keygen |
Copy your private rsa key so that you can directly access github:
Code Block | ||
---|---|---|
| ||
cp id_rsa ~/.ssh/
cd .ssh
cd .. |
Remove the created public file that is not required created by ssh-keygen file:
...
language | bash |
---|
...
Preliminary Requirements
id_rsa.pub
ssh key to launchpadcat ~/.ssh/id_rsa.pub
Setup Vagrant
References
Install packages
sudo apt-get install virtualbox
sudo apt-get install vagrant
sudo apt-get install virtualbox-dkms
Install a Vargrant Box
mkdir /var/www/vagrant/ && cd /var/www/vagrant/
vagrant init ubuntu/trusty64; vagrant up --provider virtualbox
Enable forwarding of SSH keys to vagrant
nano /var/www/vagrant/Vagrantfile
end
command~/.ssh/config
file to enable agent forwarding to localhostnano ~/.ssh/config
ssh -T git@github.com
Create relevant provisioners
nano /var/www/vagrant/Vagrantfile
end
command