Exercise: Linux as a Virtual Environment - install + nginx
These exercises were given to the participants of the DevOps Workshop on using Linux as a Virtual OS on Windows (or Mac or another Linux).
A few exercises that you could do to practice what we have learned during the workshop. Some will go way beyond it and make you learn a lot more about using Linux on the command line.
- Set up another Virtual Box and Install Ubuntu. This time use a different IP address.
- Make sure you can ping the machine from your host machine (Your Windows or OSX machine)
- Install the ssh server and check that you can connect to the guest machine using Putty or some other ssh client.
- Install Nginx on this new machine
- Check if you can visit the page using your browser on your host machine
- Edit the default html file to show your name instead, or in addition to the default text
- Check out what kind of options does the "ls" command have, experiment with it.
- Is "ls" already an "alias" in your computer?
- Read the manual of ls by typing in "man ls" You can use space to advanced in the manual. You can use "q" to quit.
- Once you find a flag combination that you like create an alias so whenever you type a single "l" it will execute "ls" with your favorite flags.
- Make the above alias permanent in your shell. (Try by logging in in another putty session and check if the new l alias is available there too!)
- Create a file called workshop.txt add some notes to it.
So far is basically the same as we had during the workshop. Use the slides as your guide.
- Create a new file called a.txt with "hello" in it.
- Create a new file called b.txt with "world" in it.
- Rename a.txt to be b.txt (using mv) observe that Linux does not ask for confirmation when you overwrite a file.
- Find out how to convince mv to ask for permission before overwriting a file.
- Try the above with "cp" that stand for copy.
- Create a sub-directory in your home directory called "web".
- Inside the "web" directory create a file called "index.html" with some content.
- Find out where where is the default configuration file of nginx (hint: it was in the slides) and change it so that the default directory will be the "web" sub-directory of home directory. (how do you know the full path to the "web" directory?
- reload the configuration file of Nginx by running sudo service nginx reload.
- Reload your browser and check if the new page is from the "web" directory.
- If you managed to do this, you can now create additional files in this directory without root privileges.
Published on 2018-03-08