Download image and extract files into some directory. I had to use separate machine, so I copied files to my ftp server (192.168.1.28).
On my tftp/ftp server:
Add entry to PXE configuration (in my case /data/tftpboot/pxelinux.cfg/default):
Source:
https://docs.centos.org/en-US/8-docs/advanced-install/assembly_preparing-for-a-network-install/
Test iSCSI
The LUN is created on ReadyNAS (192.168.1.28) in group CentOS-PXE, target iqn.1994-11.com.netgear:nas:08303042:centos-pxe.
All commands are run from my laptop (T530), but it can be any Linux:
We are interested in the second one:
Now we can list disks:
as you can see, the new volume is linked as /dev/sdd usualy it will be sda or sdb.
Now we can "unmount" as it won't be needed.
Configure network install
You will need: tftp, dhcp and ftp server and CentOS installation ISO file. Unpack ISO content to ftp server to some (CentOS7-1908-minimal in my case) directory.
Add entry in /data/tftpboot/pxelinux.cfg/default file:
You have to create networkboot/CentOS7-1908 directory in your tftp root directory. In my (ReadtNAS) case /data/tftpboot/, so full path is /data/tftpboot/networkboot/CentOS7-1908.
Files vmlinux and initrd.img are from ISO from isolinux directory. Because my ftp root is /data/pub/ I typed:
Now you should be able to run CentOS installation from network.
Installation
Boot computer from network (PXE BOOT) choose Install CentOS 7 1908 from pxe menu.
Run standard installator. As Installation destination add disk in Specialized & Network Disks. In Add iSCSI Target... enter 192.168.1.28 as Target IP Address and click Start discovery. Choose desired node (if you have more than one you should know what do do) and click Log in and (after a while) OK.
Now you should have some drive (sda, sdb or similar) - select it and click Done. Probably there will be Error checking storage configuration message - click Full disk summary and boot loader ... and unselect your disk as a boot device by clicking Do not install boot loader. Click Done.
Now be sure the name of your network card. In my case it is enp0s3.
You can add more installation repositories, but it is not necessary now.
Click Begin installation. It will take a while - in the meantime you can set root password.
When installation is complete switch to console (Ctrl-Alt-F2) and copy vmlinuz and initramfs files to your tftp server:
and place this two files in tftp directory:
as you can see I use the same directory as in network install, but it is no necessary.
Now it is time to final PXE configuration on tftp server prepare entry similar to:
You can check "magic numbers" on freshly installed system by:
Now you can click Reboot.
After some time you have network booted system.
Configure iPXE
Instead of PXE I should be possible to use iPXE. For now I can only boot iPXE - then I return to PXE because it works.
Download binary (on ReadyNAS - TFTP server) and move to tftp directory:
Not to have to flash network card ROM I use PXE chainloading. Change (on Gargoyle - DHCP server):
It should be more convenient way to upgrade kernel in future.
For now, in menu.ipxe I've entry:
Sources:
Diskless iSCSI boot with PXE HOWTO
How to chainload ipxe using dnsmasq?
Centos 7 Diskless Environment – PXE booting OpenStack compute nodes from iSCSI SAN
Last time I've prepared Gargoyle as dhcp and tftp server.
Prepare tftp on ReadyNAS
To enable tftp on ReadyNAS I've installed Tftp Server for Readynas. All files have to be in tftpboot share, so I've created it.
I have to copy all syslinux files (can be copied from gargoyle) to this share, so it contains (full path):
Reconfigure DHCP
Now I have to change dhcp server configuration. On gargoyle, in file /etc/dnsmasq.conf:
as you can see, now it has address of my ReadyNAS (192.168.1.28).
You can comment out lines
tftp on gargoyle is not need any more.
Now you should be able to boot any PC using PXE from ReadyNAS.
Boot to CentOS 7 (or any Linux) Installer
Now you can try to run Cent OS installer from network. You have to prepare FTP share and copy there files from installation image (CD/DVD). I've copied it to ReadyNAS to pub/CentOS7-1708 share .
If you use proftpd you have to create /etc/frontview/proftpd/proftpd.conf.overrides file to allow anonymous access:
Create /data/tftpboot/networkboot/CentOS7-1708 directory and copy there files:
In /data/tftpboot/pxelinux.cfg/default file add lines:
notice that ftp path is relative to pub share.
Now you should be able to boot to Cent OS installer.
Prepare NFS share
I've done it on ReadtNAS. You have to set in Settings - Network Access - NFS - Advanced settings: No Root Squash.
Be careful because you have to provide full path when mount share. My share is pub/root, so I have to mount as /data/pub/root:
As you can see, I've mounted this share in /mnt/nfsroot directory.
Install Cent OS
when You want to install another packages you can see error:
you will have to
Now you can add some GUI packages:
Based on: CentOS 7: Install PXE Boot server for thin client with NFS.
On CentOS 7 you can log all commands to syslog an then to local file or even to remote server.
Send all commands to syslog
Create file /etc/sysconfig/bash-prompt-xterm:
and change, to be executable:
Configure syslog to send messages from local6 facility to separate file
Create file /etc/rsyslog.d/bash.conf:
finally:
Now you can monitor commands:
Log command using audit
Alternatively you can use audit - create /etc/audit/rules.d/bash_history.rules:
but logs are not very human friendly:
and you may also want to log execvp, execl, execveat etc.
Sources:
https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server
https://unix.stackexchange.com/questions/86000/how-can-you-log-every-command-typed
http://whmcr.com/2011/10/14/auditd-logging-all-commands/
Setting up PXE booting server.
Set up DHCP server:
On Gargoyle (my dhcp server) router I've add to /etc/dnsmasq.conf:
of course you can try to use uci instead, if you know how - I couldn't.
Set up files
Download newest syslinux from Linux kernel site (in my case: syslinux 6.03).
Copy
- bios/com32/libutil/libutil.c32
- bios/com32/elflink/ldlinux/ldlinux.c32
- bios/com32/menu/menu.c32
- bios/core/pxelinux.0
to /var/lib/misc/tftpboot directory.
Create pxelinux.cfg directory and default file inside:
The default file should have content like this:
now you should be able to test booting from any computer in local network.
Of course this is dummy example as it can only boot from local disk.
As you can see in logs (using logread command on Gargoule router):
My computer tried to find following configs files:
- his UUID (44454c4c-3400-1037-8034-b1c04f30354a)
- his MAC address (01-84-2b-2b-bd-47-59) with 01 prefix
- full IP address (C0A801A3) - C0.A8.01.A3 is equal to 192.168.1.163.
- 7 larger subnets (by 4 bits) - C0A801A to C.
- finally default file
You can use it later to per host configurations.
To backup running QEMU/KVM machine I use script made by Daniel Berteaud. I've installed it in this way:
as you can see current version is 0.2.17-1
There is also a fork of virt-backup: github.com/vazhnov/virt-backup.pl - it's based on some earlier version.
Example command to backup centos-test machine (name shown by virsh list) to /mnt/backups directory.
If you forgot to set-up power policy during container creation you can easy modify it:
you can check it:
If your proxy server (squid and/or dansguardian) is not on your gateway you can also set it up to be transparent.
In my examples gateway ha address 192.168.1.1, and squid server has address 192.168.1.28 and listen on 8080 port.
There is configuration using iptables directly:
and this is the same in Gargoyle /etc/config/firewall file (you can edit it or use uci add firewall commands):
after editing /etc/config/firewall file you have to restart firewall:
Today I wrote my firs application for ReadyNAS OS. It's very, very simple. It just for Proxy Auto Configuration (PAC) / Web Proxy Autodiscovery Protocol (WPAD) so I called it wpad ;-)
The whole "application" serve only one file wpad.dat. It fits in two files: /apps/wpad/http.conf and /apps/wpad/wpad.dat itself. The content of /apps/wpad/http.conf is:
Now when apache starts it creates link:
To more detailed info about applications for ReadyNAS OS see ReadyNAS Applications Specification.
To have WPAD worked I had to configure also my router:
To resolve wpad as 192.168.1.12 (this is address of my NAS) in /etc/dnsmasq.conf I added:
and to in /etc/config/dhcp file in section config dhcp 'lan':
Installation
add following lines to /etc/puppetlabs/puppet/puppet.conf, of course, change puppetmaster to your host name:
you can reduce memory usage - edit /etc/sysconfig/puppetserver file and change JAVA_ARGS to:
then run service:
First manifests
To communicate with agents puppet use 8140 port - we try to open it using puppet in three steps:
- Install module to manage firewalld
- Create new puppet service
- Enable this service for public zone
Module installation
First we need module to manage firewalld - to install it create manifest file, ie. puppet.test.firewalld-install.pp (as you can see I used /root directory, but it does'n matter):
and test (--noop) first manifest:
after this you can apply (without --noop):
of course you could just run:
but it would be too simple ;-)
Create service
Now we can create firewalld service. Create file puppet.test.firewalld-service.pp:
and apply this:
(I cut warnings about depreciated validate functions)
As you can see there is a new file:
Again we could create this file manually, but what for?
Enable service
It's time to use this service. Create file puppet.test.firewalld-apply.pp:
(because public id default parameter zone can be omitted) and apply this:
and check:
This way is more interesting than boring:
Summary
As you can see setting up a test puppet master (and use them) is not so difficult. Configuration files and manifests are easy to understand.
Next step is to manage agents on other hosts...
« Previous Next » 1 2 3
Add comment