AI Basics · Final challenge

Final challenge: fact-check the AI

You asked a chatbot how to set up a small Python project that will talk to a local AI model. It answered instantly and confidently. It's also wrong in five places, and one of them could wipe your home folder. Set the project up correctly on this server.

The chatbot's answer

Sure! Here's how to set up your helper project on Linux:

  1. Make the folder and give it full permissions so the script can run: mkdir ~/helper && chmod 777 ~/helper
  2. Install the library: sudo pip install ollama
  3. Save your code as ~/helper/ask.py (starting with import ollama), make it runnable and start it with python ask.py.
  4. For a nice view of your project, install tree: sudo apt install tree
  5. If anything goes wrong, clean up and start over with: rm -rf ~/ helper

Hope this helps! 😊

How this works

The objectives say what a correct setup looks like. Check each suggestion before you run it: explain, man and the lessons are your fact-checkers. The practice server can't run Python programs, but it can check that everything is set up the way a real one would need.

The brief

  1. A runnable script, safely. ~/helper/ask.py exists, starts with a line that says which program runs it (Python 3), and you can execute it. Nothing in ~/helper is writable by everybody.
  2. The library in the right place. A virtual environment inside ~/helper has the ollama library installed.
  3. The right tool. tree is installed, with the package manager this server actually uses.
  4. Home folder survives. You checked the clean-up command with explain or man before doing anything with it, and you never ran it.

Stuck? Hints

Open only as many as you need.

1. A runnable script

777 means anyone on the machine may change your script. Only the owner needs to run it: chmod u+x (or chmod 755). Without a first line like #!/usr/bin/env python3, Linux runs the file with bash, and you'll see import: command not found.

Still stuck: Linux Basics, lesson 10 and Linux Sysadmin, lesson 13.

2. The library

sudo pip installs into the system's own Python, which the package manager looks after. Make a venv (python3 -m venv ~/helper/venv), activate it, then pip install. On Ubuntu, the venv module is a separate package.

Still stuck: lesson 2.

3. The right tool

cat /etc/os-release tells you which family you're on. apt is the Debian family's; the RHEL family uses dnf.

Still stuck: Linux Basics, lesson 11.

4. Home folder survives

Look very closely at the space in rm -rf ~/ helper. Ask explain rm -rf ~/ helper what it would do. The safe version has no space, and you only need it if you really want to start over.

Still stuck: lesson 1.

Complete every objective in the terminal and the challenge is marked done automatically. It's optional, but it goes on your certificate.