Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ji-podhead authored Jun 11, 2024
1 parent 119bed3 commit 0d6433f
Showing 1 changed file with 72 additions and 51 deletions.
123 changes: 72 additions & 51 deletions docs/installation (katello,discovery,dhcp,tftp)/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
> - we wont use ***Smartproxy DNS*** since its not required if using a local DHCP
>- we install Discovery Plugin before setting up TFTP because we have less work
> - Its demanded that you install Foreman with Katello on a ***freshly provisioned machine***
> - you cannot install katello plugin if you installed foreman without it before
> - ***you cannot install katello plugin if you installed foreman without it before***
> - make sure that you have a ***Backup*** before using the Installer
> - *especially if you have set up Foreman successfully before*
> - you can make backup by using:
Expand All @@ -27,16 +27,18 @@
- make sure you have a static hostname (we will use `my_hostname`)

***switch to root because its easier:***
``` Bash

``` bash
$ su root
```

***get your NIC's IP and Name:***
```Bash

```bash
# ifconfig
```

>```
>```yaml
> enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
> inet 192.168.2.100 netmask 255.255.255.0 broadcast 192.168.2.255
>```.
Expand All @@ -45,27 +47,28 @@ $ su root
***find your NIC's DNS-Server's IP and Domain***
- we need this for the hosts mapping
- The Domain of your Router should be printed on it, or it was given by your switch, vlan (vlan-routing), etc...
- , but we can also find it out via console:
- we find the connected DNS IP and ask the server for its Domain-name using `nslookup`
- you can also use `dig` instead of nslookup
```Bash
```bash
# nmcli device show enp2s0 | grep IP4.DNS
```
> ```
> ```yaml
> # DNS-Server-IP:
> IP4.DNS[1]: 192.168.2.1
> ```
```Bash
```bash
# nslookup 192.168.2.1
```
>```
>```yaml
> 1.2.168.192.in-addr.arpa name = speedport.ip.
> ```
- you can also check in the `/etc/resolv.conf`
- this is set by NetworkManager and the dhcp of your router
>```
>```yaml
> # Generated by NetworkManager
> search speedport.ip
> nameserver 192.168.2.1
Expand All @@ -76,23 +79,24 @@ $ su root
- edit `/etc/hosts`
- the Domain for the host mapping should be:
- <host name+routers domain>
```
```yaml
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.100 my_hostname.speedport.ip
```
***firewall settings:***
```Bash
```bash
# firewall-cmd --add-port="5646/tcp"
```
```Bash
```bash
# firewall-cmd \
--add-port="5647/tcp" \
--add-port="8000/tcp" \
--add-port="9090/tcp"
```
```Bash
```bash
# firewall-cmd \
--add-service=dns \
--add-service=dhcp \
Expand All @@ -101,24 +105,27 @@ $ su root
--add-service=https \
--add-service=puppetmaster
```
```Bash
```bash
# firewall-cmd --runtime-to-permanent
```
> ***>> check if it works <<***
> ```Bash
> # firewall-cmd --list-all
> ```
> ```markdown
>```bash
># firewall-cmd --list-all
>```
>```yaml
>...
> interfaces: enp2s0
> sources:
> services: cockpit dhcp dhcpv6-client dns http https mdns puppetmaster ssh tftp
> ports: 5646/tcp 5647/tcp 8000/tcp 9090/tcp
>...
> ```
>```
## Install
***get the repos***
```Bash
```bash
# dnf install https://yum.theforeman.org/releases/3.10/el9/x86_64/foreman-release.rpm
# dnf install https://yum.theforeman.org/katello/4.12/katello/el9/x86_64/katello-repos-latest.rpm
# dnf install https://yum.puppet.com/puppet7-release-el-9.noarch.rpm
Expand All @@ -129,12 +136,13 @@ $ su root
***install foreman 3.10 with katello plugin***
```Bash
```bash
# dnf update
# dnf install foreman-installer-katello
# foreman-installer --scenario katello
```
```
```yaml
...
Success!
* Foreman is running at https://my_hostname.speedport.ip
Expand All @@ -147,19 +155,20 @@ $ su root
The full log is at /var/log/foreman-installer/katello.log
```
---
> **we connect to foreman dashboard by using**
>```
>```yaml
> URL: https://my_hostname.speedport.ip
> user: admin
> pass: <pass>`
>```
---
***install the Discovery Plugin***
```Bash
```bash
# foreman-installer --enable-foreman-plugin-discovery
```
```
```yaml
...
Success!
* Foreman is running at https://my_hostname.speedport.ip
Expand All @@ -174,10 +183,10 @@ The full log is at /var/log/foreman-installer/katello.log
---
> ***>> check if it worked <<***
> ```Bash
> ```bash
> # dnf repolist enabled
>```
> ```
> ```yaml
> ...
> foreman Foreman 3.10
> foreman-plugins Foreman plugins 3.10
Expand All @@ -189,32 +198,33 @@ The full log is at /var/log/foreman-installer/katello.log
---
> ****(optional)* delete old/wrong repo:***
> - edit the foreman.repo file and remove the flawed ones:
> ```Bash
> ```bash
> # dnf clean all
> # dnf install nano
> # sudo nano /etc/yum.repos.d/foreman.repo
> # sudo dnf clean all
> # sudo dnf makecache
> ```
>
## DHCP
***Install:***
```Bash
```bash
# dnf install dhcp-server -y
```
***Config:***
- we add a Subnet
- we choose a Range of 100
- huge Networks can be unnecessary security Risk
- our subnetmask is `255.255.255.0`, hence our CIDR is `24`
```Bash
```bash
# sudo nano /etc/dhcp/dhcpd.conf
```


> ```Bash
> ```yaml
> ...
> # speedport.ip
>subnet 192.168.2.0 netmask 255.255.255.0 {
Expand All @@ -226,25 +236,26 @@ The full log is at /var/log/foreman-installer/katello.log
> option routers 192.168.2.100;
>}
> ```
- Now we can enable the dhcp service
- if this this fails you most likely have wrong subnet or firewall settings
> ```Bash
> ```bash
> # sudo systemctl enable --now dhcpd
>```
> ****(optional)* check if dhcp server is already installed and running***
>```Bash
>```bash
> # nmap -sU 127.0.0.1 -p 67
> ```
>
> ```markdown
> ```yaml
> # if its not installed or not running:
> ...
> PORT STATE SERVICE
> 67/udp closed dhcps
> ...
> ```
> ```markdown
> ```yaml
> # if up and running:
> ...
> PORT STATE SERVICE
Expand All @@ -255,40 +266,44 @@ The full log is at /var/log/foreman-installer/katello.log
> you can also use telnet, lsof, etc
## TFTP
***install***
```Bash
```bash
# sudo dnf install tftp-server -y
```
***check if Discovery-Plugin created the Boot-image Files:***
- there should be a `/var/lib/tftpboot/boot/fdi-image` dir that holds the `vmlinuz` and `initrd` files
- you also need to create a config file: `nano /var/lib/tftpboot/pxelinux.cfg/default`
- the **user has to be nobody** (system-user) and it should be **fully writable**
```Bash
```bash
# nano /var/lib/tftpboot/pxelinux.cfg/default
```
>```
>```yaml
> default menu.c32
> timeout 300
> #LABEL discovery
> MENU LABEL Foreman Discovery Image
> KERNEL boot/fdi-image/vmlinuz0
> APPEND initrd=boot/fdi-image/initrd0.img rootflags=loop root=live:/fdi.iso rootfstype=auto proxy.url=https://cc.speedport.ip proxy.type=foreman
IPAPPEND 2
> IPAPPEND 2
> ```
```Bash
```bash
# sudo chmod -R 777 /var/lib/tftpboot
# sudo chown -R nobody: /var/lib/tftpboot
```
- Change tftpboot dir if required:
```bash
$ nano /usr/lib/systemd/system/tftp.service
```
>```
>```yaml
> [Unit]
> Description=Tftp Server
> Requires=tftp.socket
Expand All @@ -302,11 +317,11 @@ $ nano /usr/lib/systemd/system/tftp.service
- not sure if this was required:
>```Bash
>```bash
> sudo nano /etc/xinetd.d/tftp
>```
>```
>```yaml
> service tftp
> {
> socket_type = dgram
Expand All @@ -325,22 +340,28 @@ $ nano /usr/lib/systemd/system/tftp.service
- tftp service can be activated by `using systemctl enable tftp` (not xintetd)!
>```Bash
>```bash
> # systemctl enable tftp
>```
- you can check the realtime-logs like this:
```Bash
```bash
# journalctl -u tftp -f
```
>```
>```yaml
> Mai 24 19:26:15 <user> in.tftpd[26138]: Client ::ffff:192.168.2.104 finished boot/rocky-linux-imLv796i67R9-initrd.img
> Mai 24 19:41:00 <user> systemd[1]: tftp.service: Deactivated successfully.
> Mai 26 10:16:08 <user> systemd[1]: Started Tftp Server.
> Mai 26 10:16:08 <user> in.tftpd[147746]: Client ::ffff:192.168.2.104 finished pxelinux.0
>```
## Update Foreman
- we set managed dns to false: `--foreman-proxy-dns-managed false \`
```Bash
```bash
# foreman-installer \
--foreman-proxy-dns true \
--foreman-proxy-dns-managed false \
Expand Down

0 comments on commit 0d6433f

Please sign in to comment.