---
# System prepended metadata

title: Lab 3. System and Network administartion

---

# Lab 3. System and Network administartion
## Mustafin Timur

# Creating repo and package
## Prepare source code

I'll publish small "Hello world" written in C++

    #include <iostream>
    int main() {
        using namespace std;
        cout << "Hello world\n";
    }
    Save

Compile it with: 

    g++ mustafin.cc -o mustafin
    
## Create the package

    mkdir -p mustafin/DEBIAN


Than create `mustafin/DEBIAN/control` with such a content:

    Package: mustafin
    Version: 1.0
    Section: custom
    Priority: optional
    Architecture: all
    Essential: no
    Installed-Size: 1024
    Maintainer: timur@mustafin.dev
    Description: Just a lab
    
Copy binary to the target folder

    mkdir -p mustafin/usr/bin/
    cp mustafin mustafin/usr/bin/
    
Build package

    dpkg-deb --build mustafin
    mv mustafin.deb mustafin-1.0_amd64.deb
    
## Setup repository

After apache installation

    cp mustafin-1.0_amd64.deb /var/www/html/debian/
    
Create list of packages

    dpkg-scanpackages . | gzip -c9  > Packages.gz
    

Add repo to the list of repos

    echo "deb [trusted=yes] http://10.0.2.15/debian ./" | tee -a /etc/apt/sources.list > /dev/null

Update list of the packages 

    sudo apt-get update
    
Install package

    sudo apt-get install mustafin

![](https://i.imgur.com/NQYGR2N.png)

![](https://i.imgur.com/dlhPGgX.png)

# Questions

## Task 1

Study that packaging system and answer the following questions:
• how does it work?

    Packaging systems contains indexes of packages available for installation. The list goes from list of repos (may be mirrors). 
    
• how does it deal with dependencies?

    For example, Debian have different level of dependecies as "Depends" — dependencies will be installed during installation or should be already installed, or "Conflicts" — this packages must be removed to install this package. Everything installed globally

• does it use the GNU build tools? How?

    Since it can build package from source using `apt-get source --compile` therefore it may use them during compilation of the target package.
    
• if not what does it use?

    build-dependecies of the package