<commit_before>![eReuselogo](./images/eReuse_logo_200.png)
![UPClogo](./images/UPC_logo_200.png)

# eReuse: How to use our (PXE) server

This server allow us to register easily and very fast by sending DeviceInventory to all PC 
connected on the LAN network.

#### To register we need the following

- A PC with:
  - [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
  - [eReusePXEserver-<VERSION>.ova](https://github.com/eReuse/device-inventory/releases/latest)
  - [eReuseOS-<VERSION>.iso](https://github.com/eReuse/device-inventory/releases/latest)
  - If you want to install a GNU/Linux OS into inventoried computers you will need an installation ISO, e.g. [lubuntu-<...>.iso](http://cdimage.ubuntu.com/lubuntu/releases/16.04.1/release/).
  - If you want to install FSArchiver system images into inventoried computers, you will need to create in your PC a folder called ``ereuse-data``, another one inside of it called ``images``, and copy the images in the latter.
- Switch
- Network cables
- PC to register

**Note on installation ISOs:** Only a small set of Debian/Ubuntu live distros based on Casper are supported by default. If you want to add more you will need to edit the server's ``pxelinux.cfg/default`` file (see PXELINUX [server configuration](PXE_maker.md)).

**Note on system installation images:** Currently the only kind of images supported and assumed are FSArchiver images corresponding to 32-bit ``i386`` or 64-bit ``amd64`` Debian/Ubuntu or derivative OS installations, where the whole system is contained in a single ext4 file system in BIOS partition ``sda1``, and GRUB2 is used as a bootloader.

**How to create a FSArchiver image:** To prepare an installation image you must perform in a different machine (either real or virtual) the complete installation that you want to replicate (taking into account the limitations from the previous note).  One possible way to capture this installation to a FSArchiver image is to reboot the already installed machine into the [SystemRescueCd](https://www.system-rescue-cd.org/SystemRescueCd_Homepage), then enter the keyboard language, plug an external USB drive of sufficient capacity (note that FAT file systems may cause file size limitation issues) and run the following commands:

```
# mount /dev/sdb1 /mnt  # ``sdb`` is the external USB drive
# fsarchiver savefs /mnt/IMAGE_NAME.fsa /dev/sda1  # ``sda`` is the main hard drive
# umount /mnt  # wait until the command is complete
```

Use some informative ``IMAGE_NAME`` like ``lubuntu-xenial-amd64-ca``.  Now you can plug the USB drive into your PC and copy the image to it.

####Steps to install and setup the server:
1. Disconnect any router (any DHCP provider in general) from the network. Just use the switch or hub.
2. Install VirtualBox on any Win/Linux/Mac computer. We will call this computer as the *host*.
2. Double click on `eReusePXEserver-<VERSION>.ova` to import the server on VirtualBox.
3. Check the network configuration on VirtualBox.
  1. Adapter 1 should be on Ethernet (cable) interface with others computer (to be registed): ![Virtualbox network](./images/virtualbox-network.png)
  2. Adapter 2 should be on NAT if you have a second ethernet slot or WiFi adapter.
4. Insert [DeviceInventory](https://github.com/eReuse/device-inventory/releases/latest) (download it from Downloads section, at the bottom) as primary CD media: ![Virtualbox disk](./images/virtualbox-disk.png)
5. If you have it, insert the installation ISO of your choice as secondary CD media: ![Virtualbox disk](./images/virtualbox-disk.png)
6. In the machine settings, select the *Shared Folders* tab, then the ``ereuse-data`` entry in the list and click on the edit button (orange) on the right. In the following dialog, click on the drop down list, then on *Other…* and choose the ``ereuse-data`` folder that you created at the beginning, then accept the new configuration: ![Virtualbox shared folder](./images/virtualbox-shared.png)
7. Run the virtual server and wait until it asks for *login*. There is no need for login. Now you [can start registering your computers](#register-a-computer), or [configure the server to automate tasks](#configure-iso-options)

####Register a computer
1. Connect a PC on the LAN network.
2. Configure the BIOS (the first few seconds when computer starts) to boot first from LAN:
  1. Maybe there is an option to automatically boot from the network. 
    - Watch for the BIOS Setup Message. 
    - Press F12, F8 or F9 to enter on boot menu selection.
  2. Enter to Setup and change the boot priority.<commit_msg>Suggest to enable hardware virtualization when running the PXE server<commit_after>![eReuselogo](./images/eReuse_logo_200.png)
![UPClogo](./images/UPC_logo_200.png)

# eReuse: How to use our (PXE) server

This server allow us to register easily and very fast by sending DeviceInventory to all PC 
connected on the LAN network.

#### To register we need the following

- A PC with:
  - [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
  - [eReusePXEserver-<VERSION>.ova](https://github.com/eReuse/device-inventory/releases/latest)
  - [eReuseOS-<VERSION>.iso](https://github.com/eReuse/device-inventory/releases/latest)
  - If you want to install a GNU/Linux OS into inventoried computers you will need an installation ISO, e.g. [lubuntu-<...>.iso](http://cdimage.ubuntu.com/lubuntu/releases/16.04.1/release/).
  - If you want to install FSArchiver system images into inventoried computers, you will need to create in your PC a folder called ``ereuse-data``, another one inside of it called ``images``, and copy the images in the latter.
- Switch
- Network cables
- PC to register

**Note on installation ISOs:** Only a small set of Debian/Ubuntu live distros based on Casper are supported by default. If you want to add more you will need to edit the server's ``pxelinux.cfg/default`` file (see PXELINUX [server configuration](PXE_maker.md)).

**Note on system installation images:** Currently the only kind of images supported and assumed are FSArchiver images corresponding to 32-bit ``i386`` or 64-bit ``amd64`` Debian/Ubuntu or derivative OS installations, where the whole system is contained in a single ext4 file system in BIOS partition ``sda1``, and GRUB2 is used as a bootloader.

**How to create a FSArchiver image:** To prepare an installation image you must perform in a different machine (either real or virtual) the complete installation that you want to replicate (taking into account the limitations from the previous note).  One possible way to capture this installation to a FSArchiver image is to reboot the already installed machine into the [SystemRescueCd](https://www.system-rescue-cd.org/SystemRescueCd_Homepage), then enter the keyboard language, plug an external USB drive of sufficient capacity (note that FAT file systems may cause file size limitation issues) and run the following commands:

```
# mount /dev/sdb1 /mnt  # ``sdb`` is the external USB drive
# fsarchiver savefs /mnt/IMAGE_NAME.fsa /dev/sda1  # ``sda`` is the main hard drive
# umount /mnt  # wait until the command is complete
```

Use some informative ``IMAGE_NAME`` like ``lubuntu-xenial-amd64-ca``.  Now you can plug the USB drive into your PC and copy the image to it.

####Steps to install and setup the server:
1. Disconnect any router (any DHCP provider in general) from the network. Just use the switch or hub.
2. Install VirtualBox on any Win/Linux/Mac computer. We will call this computer as the *host*.
2. Double click on `eReusePXEserver-<VERSION>.ova` to import the server on VirtualBox.
3. Check the network configuration on VirtualBox.
  1. Adapter 1 should be on Ethernet (cable) interface with others computer (to be registed): ![Virtualbox network](./images/virtualbox-network.png)
  2. Adapter 2 should be on NAT if you have a second ethernet slot or WiFi adapter.
4. Insert [DeviceInventory](https://github.com/eReuse/device-inventory/releases/latest) (download it from Downloads section, at the bottom) as primary CD media: ![Virtualbox disk](./images/virtualbox-disk.png)
5. If you have it, insert the installation ISO of your choice as secondary CD media: ![Virtualbox disk](./images/virtualbox-disk.png)
6. In the machine settings, select the *Shared Folders* tab, then the ``ereuse-data`` entry in the list and click on the edit button (orange) on the right. In the following dialog, click on the drop down list, then on *Other…* and choose the ``ereuse-data`` folder that you created at the beginning, then accept the new configuration: ![Virtualbox shared folder](./images/virtualbox-shared.png)
7. If your PC supports hardware virtualization (VT-x/AMD-V), enable it in the machine settings, under *System / Acceleration*.
8. Run the virtual server and wait until it asks for *login*. There is no need for login. Now you [can start registering your computers](#register-a-computer), or [configure the server to automate tasks](#configure-iso-options)

####Register a computer
1. Connect a PC on the LAN network.
2. Configure the BIOS (the first few seconds when computer starts) to boot first from LAN:
  1. Maybe there is an option to automatically boot from the network. 
    - Watch for the BIOS Setup Message. 
    - Press F12, F8 or F9 to enter on boot menu selection.
  2. Enter to Setup and change the boot priority.
{'fraction_non_alphanumeric': 0.08711511640381933, 'fraction_numerical': 0.01019203948074241, 'mean_word_length': 4.394675925925926, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 10, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5589956', 'n_tokens_mistral': 2704, 'n_tokens_neox': 2526, 'n_words': 1255}