| 1 | [[PageOutline]] |
| 2 | |
| 3 | = How to write install scripts = |
| 4 | In this tutorial you are going to learn how to automate the customization of your node with install scripts. |
| 5 | In this example you can learn how to automate: |
| 6 | a. the installation of a webserver |
| 7 | b. the installation of the click router software |
| 8 | |
| 9 | Pick one and stick to it throughout this exercise |
| 10 | |
| 11 | == Step1. Reserve a minimum topology == |
| 12 | In the first step you reserve the minimum topology you need in order to manually install and test your software. |
| 13 | In our case this is just a single VM for both (a) and (b). |
| 14 | |
| 15 | Reserve a VM in your EG rack. |
| 16 | |
| 17 | == Step2. Manually install your software == |
| 18 | Once your VM is up, login and manually install your software. |
| 19 | |
| 20 | Find out your operating system: |
| 21 | {{{ |
| 22 | lbs_release -a |
| 23 | }}} |
| 24 | To figure out the kernel version run: |
| 25 | {{{ |
| 26 | uname -r |
| 27 | }}} |
| 28 | |
| 29 | === Step2a. Manually install a webserver == |
| 30 | You can read more about installing a webserver here: |
| 31 | https://help.ubuntu.com/lts/serverguide/httpd.html |
| 32 | |
| 33 | Essentially to install do: |
| 34 | {{{ |
| 35 | sudo apt-get install apache2 |
| 36 | }}} |
| 37 | |
| 38 | Try and visit your web server. |
| 39 | |
| 40 | Customize the server anyway you want. |
| 41 | |
| 42 | Where would you put the welcome page of your server? |
| 43 | |
| 44 | === Step2b. Manually install the click router === |
| 45 | Follow instructions here: |
| 46 | http://www.read.cs.ucla.edu/click/download |
| 47 | |
| 48 | == Step3. Write your script == |
| 49 | Once you are happy with the configuration of your node, write a script that will automate this process. |
| 50 | Look here for instructions: http://groups.geni.net/geni/wiki/HowTo/WriteInstallScript |
| 51 | |
| 52 | To see a history of what you have done in your node do: |
| 53 | {{{ |
| 54 | history |
| 55 | }}} |
| 56 | |
| 57 | Once you are happy with your script, make sure you have tested it, make a tar file of it: |
| 58 | {{{ |
| 59 | tar xvfz <tar name> <script name> |
| 60 | }}} |
| 61 | |
| 62 | == Step4. Upload your script to a web server == |
| 63 | If you have a dropbox account you can just upload the compressed (tar.gz) script to Dropbox and get the public URL. |
| 64 | |
| 65 | If not ask us for help. |
| 66 | |
| 67 | == Step5. Debug == |
| 68 | Now that you have the script is a public place you can modify your rspec to download and install it in a new node. |
| 69 | |
| 70 | Reserve a node and check that it worked. It probably haven't:-) |
| 71 | |
| 72 | On IG look here for where to find logs: |
| 73 | http://www.protogeni.net/wiki/ServicesFaq |
| 74 | |
| 75 | On EG check the neuca logs at: |
| 76 | /var/log/neuca/neuca-agent.log |
| 77 | |
| 78 | See why it failed, fix it, upload it and try again |
| 79 | |
| 80 | If it worked, congrats! You wrote you first install script! |
| 81 | |