|
| 1 | +# Software Distribution |
| 2 | + |
| 3 | +In this lab, you will explore software distribution strategies and best practices. You will gain insights into the different approaches used to distribute software and understand the importance of effective software distribution in the development lifecycle. Follow the tasks below to complete the lab assignment. |
| 4 | + |
| 5 | +## Task 1: Configure and Use a Local Package Repository |
| 6 | + |
| 7 | +**Objective**: Set up a local package repository and use it to install packages. |
| 8 | + |
| 9 | +1. **Create a Local Repository**: |
| 10 | + - Create a directory to hold your repository and place some `.deb` files in it. |
| 11 | + |
| 12 | + ```sh |
| 13 | + mkdir -p ~/local-apt-repo |
| 14 | + cp /path/to/package.deb ~/local-apt-repo/ |
| 15 | + ``` |
| 16 | + |
| 17 | +2. **Generate the Package Index**: |
| 18 | + - Use `dpkg-scanpackages` to create a `Packages` file. Compress this file into a `Packages.gz` archive. |
| 19 | + |
| 20 | + ```sh |
| 21 | + dpkg-scanpackages ~/local-apt-repo /dev/null | gzip -9c > ~/local-apt-repo/Packages.gz |
| 22 | + ``` |
| 23 | + |
| 24 | +3. **Add the Local Repository to Your Sources List**: |
| 25 | + - Add the repository to your `sources.list`. |
| 26 | + |
| 27 | + ```sh |
| 28 | + echo "deb [trusted=yes] file:/home/yourusername/local-apt-repo ./" | sudo tee /etc/apt/sources.list.d/local-apt-repo.list |
| 29 | + sudo apt update |
| 30 | + ``` |
| 31 | + |
| 32 | +4. **Verify the Contents of the Packages.gz File:**: |
| 33 | + - Check that the Packages.gz file contains the correct paths and metadata for your .deb files, **it must be relative path like `./your_package.deb`**. Also you can see the package name there. Then check the repository of your package, make sure it's local one. |
| 34 | +
|
| 35 | + ```sh |
| 36 | + zcat Packages.gz |
| 37 | + apt policy your-package-name |
| 38 | + ``` |
| 39 | +
|
| 40 | +5. **Install a Package from the Local Repository**: |
| 41 | + - Install a package using `apt` from your local repository. |
| 42 | +
|
| 43 | + ```sh |
| 44 | + sudo apt install your-package-name |
| 45 | + ``` |
| 46 | +
|
| 47 | +6. **Document the Process**: |
| 48 | + - Create a `submission4.md` file. |
| 49 | + - Provide step-by-step documentation of your setup and installation process in the `submission4.md` file. |
| 50 | +
|
| 51 | +## Task 2: Simulate Package Installation and Identify Dependencies |
| 52 | +
|
| 53 | +**Objective**: Use `apt` to simulate package installation and identify dependencies without actually installing the packages. |
| 54 | +
|
| 55 | +1. **Choose a Package to Simulate**: |
| 56 | + - Select a package to simulate its installation. |
| 57 | +
|
| 58 | + ```sh |
| 59 | + apt-cache showpkg your-package-name |
| 60 | + ``` |
| 61 | +
|
| 62 | +2. **Simulate the Installation**: |
| 63 | + - Use the `-s` flag to simulate the installation. |
| 64 | +
|
| 65 | + ```sh |
| 66 | + sudo apt-get install -s your-package-name |
| 67 | + ``` |
| 68 | +
|
| 69 | +3. **Analyze the Output**: |
| 70 | + - Identify the dependencies and the packages that would be installed. |
| 71 | + - Document the findings in the `submission4.md` file, including which dependencies are required and their versions. |
| 72 | +
|
| 73 | +## Task 3: Hold and Unhold Package Versions |
| 74 | +
|
| 75 | +**Objective**: Prevent a package from being upgraded and then allow it to be upgraded again. |
| 76 | +
|
| 77 | +1. **Install a Package**: |
| 78 | + - Install a package that is commonly updated. |
| 79 | +
|
| 80 | + ```sh |
| 81 | + sudo apt install your-package-name |
| 82 | + ``` |
| 83 | +
|
| 84 | +2. **Hold the Package**: |
| 85 | + - Use `apt-mark` to hold the package. |
| 86 | +
|
| 87 | + ```sh |
| 88 | + sudo apt-mark hold your-package-name |
| 89 | + ``` |
| 90 | +
|
| 91 | +3. **Verify the Hold Status**: |
| 92 | + - Check the status of held packages. |
| 93 | +
|
| 94 | + ```sh |
| 95 | + apt-mark showhold |
| 96 | + ``` |
| 97 | +
|
| 98 | +4. **Unhold the Package**: |
| 99 | + - Use `apt-mark` to unhold the package. |
| 100 | +
|
| 101 | + ```sh |
| 102 | + sudo apt-mark unhold your-package-name |
| 103 | + ``` |
| 104 | +
|
| 105 | +5. **Documentation**: |
| 106 | + - Document the steps taken to hold and unhold the package, including any verification commands in the `submission4.md` file. |
| 107 | +
|
| 108 | +## Additional Resources |
| 109 | +
|
| 110 | +- [Apt Documentation](https://manpages.debian.org/buster/apt/apt.8.en.html) |
| 111 | +- [Debian Package Management](https://www.debian.org/doc/manuals/debian-faq/pkg-basics.en.html) |
| 112 | +
|
| 113 | +### Guidelines |
| 114 | +
|
| 115 | +- Use proper Markdown formatting for documentation files. |
| 116 | +- Organize files with appropriate naming conventions. |
| 117 | +- Create a Pull Request to the main branch of the repository with your completed lab assignment. |
| 118 | +
|
| 119 | +> Note: Actively explore and document your findings to gain hands-on experience with `apt` and software distribution strategies. |
0 commit comments