Home / Community / Blog

Sometimes it's useful to add some text in document which shouldn't be printed. Then you can mark some text or even paragraph as hidden.

To show hidden text while you are editing document you can check Hidden text checkbox. You can find it in menu Tools -> Option on OpenOffice Writer -> Formatting Aids.

To change power button behaviour in CentOS I've created file /etc/dconf/db/local.d/01-power:

[org/gnome/settings-daemon/plugins/power]
power-button-action='interactive'

and restart or update dconf:

dconf update

Sources: Changing Behavior when Pressing the Power Button in Graphical Target Mode

The easiest way to set up own Jitsi meet server is containerization (see Jitsi in docker).

When you would like to change logo watermark you can use this method. It will work only in this instance of docker. You can stop / start container, but when you destroy it (i.e.: docker-compose down) the changes will gone.

Copy new file (original dimensions are 612x272) to your docker server and place in directory:

~/.jitsi-meet-cfg/web/

check id / name of your web container, i.e.:

[docker@docker jitsi-meet]# docker-compose ps
         Name          Command   State                        Ports
------------------------------------------------------------------------------------------------
jitsi-meet_jicofo_1    /init     Up
jitsi-meet_jvb_1       /init     Up      0.0.0.0:10000->10000/udp, 0.0.0.0:4443->4443/tcp
jitsi-meet_prosody_1   /init     Up      5222/tcp, 5269/tcp, 5280/tcp, 5347/tcp
jitsi-meet_web_1       /init     Up      0.0.0.0:8443->443/tcp, 0.0.0.0:8000->80/tcp

as you can see in my case it is the jitsi-meet_web_1.

Execute bash inside container:

docker exec -it jitsi-meet_web_1 /bin/bash

replace original watermark

cd /usr/share/jitsi-meet/images/
mv watermark.png watermark.png-old
cp /config/new-logo.png watermark.png

it's not necessary, but I've saved Jitsi watermark as watermark.png-old.

That's all.

You can also check ~/.jitsi-meet-cfg/web/interface_config.js file for other parameters.

Nowadays everybody use some conferencing systems. If you would like to have your own, on controlled infrastructure, maybe only in LAN/VPN environment you can try Jitsi.

The "demo" installation in CentOS 7 based on docker containers is quite simple.

Install docker and docker-compose

If you already have docker installed skip this step. You can also read Docker in CentOS 7 in 5 steps.

curl -fsSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker
curl -L "https://github.com/docker/compose/releases/download/\
1.23.1/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

Prepare environment

Install GIT
yum install git
Download docker files
git clone https://github.com/jitsi/docker-jitsi-meet && cd docker-jitsi-meet
Prepare directories
mkdir -p ~/.jitsi-meet-cfg/{web/letsencrypt,transcripts,prosody,jicofo,jvb}
cp env.example .env
Needed modifications

If you want to use it in LAN/separated network you have to change

DOCKER_HOST_ADDRESS=192.168.1.89
JVB_STUN_SERVERS=

in .env file. Of course DOCKER_HOST_ADDRESS will be YOUR docker IP address.

If you not set JVB_STUN_SERVERS to null value you won't be able to join the conference. You can change it later in

~/.jitsi-meet-cfg/jvb/sip-communicator.properties file.

Configure firewall

cat <<EOF > /etc/firewalld/services/jitsi.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>Jitsi</short>
  <description>Multi-platform open-source video conferencing system</description>
  <port protocol="tcp" port="8000"/>
  <port protocol="tcp" port="8443"/>
  <port protocol="tcp" port="4443"/>
  <port protocol="udp" port="10000"/>
</service>
EOF

firewall-cmd --reload
firewall-cmd --add-service jitsi
firewall-cmd --permanent --add-service jitsi
Start all
docker-compose -f docker-compose.yml -f etherpad.yml up -d

As you can see I've also added etherpad - for document sharing.

Thin installation was tested on CentOS 7 nad CentOS 8

Prepare system

You will need java:

yum install java-1.8.0-openjdk-headless

Create dedicated user

useradd --system --create-home --user-group \
--home-dir /opt/minecraft --shell /bin/bash minecraft

or shorter

useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft

Configure firewall

Create new service mincecraft-server file:

cat << EOF > /etc/firewalld/services/minecraft-server.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>Minecraft server</short>
  <port port="25565" protocol="tcp"/>
  <port port="25575" protocol="tcp"/>
</service>
EOF

Then reload to read new service, enable it and reload to apply changes.

firewall-cmd --reload
firewall-cmd --add-service=minecraft-server --permanent
firewall-cmd --reload

Prepare directories

su - minecraft
mkdir -p ~/{backups,tools}
mkdir server-1.12.2
mkdir server-1.15.2

Download JAR files

I'm preparing two versions: 1.12.2 and 1.15.2:

cd ~/server-1.15.2
wget "https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar" -O minecraft_server.1.15.2.jar
ln -s minecraft_server.1.15.2.jar server.jar
echo eula=true > eula.txt
cd ~/server-1.12.2
wget https://launcher.mojang.com/mc/game/1.12.2/server/886945bfb2b978778c3a0288fd7fab09d315b25f/server.jar -O minecraft_server-1.12.2.jar
ln -s minecraft_server-1.12.2.jar server.jar
echo eula=true > eula.txt

Now you have to chose one. In my example 1.12.2:

cd
ln -s server-1.12.2 server

later you can remove this link and create it to another version, ie:

cd
rm server
ln -s server-1.15.2 server

Configure RCON

Not necessary. Run all command as a "root" user.

Install packages
yum group install "Development Tools"
yum install kernel-debug
Download and compile
wget https://github.com/Tiiffi/mcrcon/archive/master.zip
cd /tmp/
unzip ~/master.zip
cd mcrcon-master/
gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c
cp ./mcrcon /opt/minecraft/tools/
chown minecraft.minecraft /opt/minecraft/tools/mcrcon

If you want to use RCON you have to adjust /opt/minecraft/server/server.properties file:

enable-rcon=true
rcon.password=strong-password

of course change strong-password to some strong password ;-)

Startup script

Create serivce file as root:

cat << EOF > /etc/systemd/system/minecraft.service
[Unit]
Description=Minecraft Server
After=network.target

[Service]
User=minecraft
Nice=1
KillMode=none
SuccessExitStatus=0 1
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
NoNewPrivileges=true
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xmx1024M -Xms512M -jar server.jar nogui
ExecStop=/opt/minecraft/tools/mcrcon -H 127.0.0.1 -P 25575 -p strong-password stop


[Install]
WantedBy=multi-user.target
EOF

Run

systemctl start minecraft

You can check /opt/minecraft/server/logs/latest.log to see what is happening.

You should see something like this:

[22:09:52] [Server thread/INFO]: Starting minecraft server version 1.12.2
[22:09:52] [Server thread/INFO]: Loading properties
[22:09:52] [Server thread/WARN]: server.properties does not exist
[22:09:52] [Server thread/INFO]: Generating new properties file
[22:09:52] [Server thread/INFO]: Default game type: SURVIVAL
[22:09:52] [Server thread/INFO]: Generating keypair
[22:09:53] [Server thread/INFO]: Starting Minecraft server on *:25565
[22:09:53] [Server thread/INFO]: Using epoll channel type
[22:09:53] [Server thread/INFO]: Preparing level "world"
[22:09:54] [Server thread/INFO]: Loaded 488 advancements
[22:09:55] [Server thread/INFO]: Preparing start region for level 0
[22:09:56] [Server thread/INFO]: Preparing spawn area: 5%
[22:09:57] [Server thread/INFO]: Preparing spawn area: 8%
[22:09:58] [Server thread/INFO]: Preparing spawn area: 13%
[22:09:59] [Server thread/INFO]: Preparing spawn area: 17%
[22:10:00] [Server thread/INFO]: Preparing spawn area: 22%
[22:10:01] [Server thread/INFO]: Preparing spawn area: 28%
[22:10:02] [Server thread/INFO]: Preparing spawn area: 32%
[22:10:03] [Server thread/INFO]: Preparing spawn area: 37%
[22:10:04] [Server thread/INFO]: Preparing spawn area: 42%
[22:10:05] [Server thread/INFO]: Preparing spawn area: 48%
[22:10:06] [Server thread/INFO]: Preparing spawn area: 53%
[22:10:07] [Server thread/INFO]: Preparing spawn area: 59%
[22:10:08] [Server thread/INFO]: Preparing spawn area: 65%
[22:10:09] [Server thread/INFO]: Preparing spawn area: 70%
[22:10:11] [Server thread/INFO]: Preparing spawn area: 75%
[22:10:12] [Server thread/INFO]: Preparing spawn area: 80%
[22:10:13] [Server thread/INFO]: Preparing spawn area: 86%
[22:10:14] [Server thread/INFO]: Preparing spawn area: 90%
[22:10:15] [Server thread/INFO]: Preparing spawn area: 96%
[22:10:15] [Server thread/INFO]: Done (22.459s)! For help, type "help" or "?"

As you can see first start took more than 22s (not to bad - it's Core 2 Duo and iSCSI disk on 1GB network card - CentOS 8 version of Diskless computer using PXE and iSCSI)

Configure autostart

If you want to start Minecraf server automatically when system starts, just enable this service:

systemctl enable minecraft

That's all.

When you want to use both of them to have to decide to which the clients will be connecting to. In my case packets goes to Dansguardian and then to Squid and finally to internet.

In standard configuration only Dansguardian knows clients IPs.

To provide user's IPs to Squid change Dansguardian configuration to forward them - change in dansguardian.conf (or dansguardianf1.conf, or whatever you have):

forwardedfor = on
usexforwardedfor = on

Be careful - if you don't use Squid (or some other secure proxy) you can publish you private IP addresses to whole world.

Then change Squid configuration (squid.conf) to allow to find the original source:

follow_x_forwarded_for allow localhost

Of course restart both services.

It's pretty simple, but I forgot about this.

Install chromaprint:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install libchromaprint

You have to use epel-release-latest (not epel-release) not to get:

Problem: package ffmpeg-4.2.1-3.el8.x86_64 requires libavdevice.so.58()(64bit), but none of the providers can be installed
  - package ffmpeg-4.2.1-3.el8.x86_64 requires libavdevice.so.58(LIBAVDEVICE_58)(64bit), but none of the providers can be installed
  - conflicting requests
  - nothing provides libjack.so.0()(64bit) needed by libavdevice-4.2.1-3.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Install beet

pip3 install beets
pip3 install pyacoustid

Enable plugins:

echo "plugins: duplicates chroma"  >> .config/beets/config.yaml

Install fpcalc

cd /tmp
wget "https://github.com/acoustid/chromaprint/releases/download/v1.4.3/chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz"
cd /usr/local/bin/
tar -xzf /tmp/chromaprint-fpcalc-1.4.3-linux-x86_64.tar.gz
ln -s chromaprint-fpcalc-1.4.3-linux-x86_64/fpcalc .

Install ffmpeg (RPM Fusion, How To Install FFmpeg on CentOS 8, How to turn CentOS 8 into a perfect desktop):

yum install --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
yum install --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
yum config-manager --enable PowerTools
yum config-manager --enable epel-testing
yum config-manager --enable rpmfusion-free-updates-testing
yum install ffmpeg

Now beet can fingerprint files:

beet fingerprint

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).

mount -o loop /tmp/CentOS-8-x86_64-1905-boot.iso /mnt/iso
scp -r * admin@192.168.1.28:/data/pub/CentOS-8.0.1905-boot
umount /mnt/iso

On my tftp/ftp server:

mkdir /data/tftpboot/networkboot/CentOS8-1905
cp /data/pub/CentOS-8.0.1905-boot/images/pxeboot/vmlinuz \
          /data/tftpboot/networkboot/CentOS8-1905/
cp /data/pub/CentOS-8.0.1905-boot/images/pxeboot/initrd.img \
          /data/tftpboot/networkboot/CentOS8-1905/

Add entry to PXE configuration (in my case /data/tftpboot/pxelinux.cfg/default):

LABEL InstallCentOS-8.0.1905
MENU LABEL Install CentOS 8 1905
kernel /networkboot/CentOS8-1905/vmlinuz
APPEND initrd=/networkboot/CentOS8-1905/initrd.img \
          ip=dhcp \
          inst.repo=ftp://192.168.1.28/CentOS-8.0.1905-boot

Source:
https://docs.centos.org/en-US/8-docs/advanced-install/assembly_preparing-for-a-network-install/

You will need BLED112 dongle and pylgbst library.

yum install python3
pip3 install pygatt
pip3 install pexpect
pip3 install https://github.com/undera/pylgbst/archive/1.0.tar.gz

now you can write your first program test.py:

from pylgbst.hub import MoveHub, COLOR_RED
from time import sleep

hub = MoveHub()
hub.led.set_color(COLOR_RED)
sleep(5)
hub.disconnect()

and test it:

python3 test.py

The LED has been changed to red for 5 seconds.

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:

[root@T530 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.28
192.168.1.28:3260,1 iqn.1994-11.com.netgear:nas:051ada19:group1
192.168.1.28:3260,1 iqn.1994-11.com.netgear:nas:08303042:centos-pxe

We are interested in the second one:

[root@T530 ~]# iscsiadm -m node -T 'iqn.1994-11.com.netgear:nas:08303042:centos-pxe' -p 192.168.1.28 -l
Logging in to [iface: default, target: iqn.1994-11.com.netgear:nas:08303042:centos-pxe, portal: 192.168.1.28,3260] (multiple)
Login to [iface: default, target: iqn.1994-11.com.netgear:nas:08303042:centos-pxe, portal: 192.168.1.28,3260] successful.

Now we can list disks:

[root@T530 ~]# ls -l /dev/disk/by-path
razem 0
lrwxrwxrwx. 1 root root  9 10-22 17:25 fc---lun-0 -> ../../sdd
iqn.1994-11.com.netgear:nas:08303042:centos-pxe-lun-0 -> ../../sdd
lrwxrwxrwx. 1 root root  9 10-22 16:29 pci-0000:00:0d.0-ata-1.0 -> ../../sda
lrwxrwxrwx. 1 root root 10 10-22 16:29 pci-0000:00:0d.0-ata-1.0-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 10-22 16:29 pci-0000:00:0d.0-ata-1.0-part2 -> ../../sda2
lrwxrwxrwx. 1 root root  9 10-22 16:29 pci-0000:00:0d.0-ata-2.0 -> ../../sr0

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.

iscsiadm -m node -T 'iqn.1994-11.com.netgear:nas:08303042:centos-pxe' -p 192.168.1.28 -u

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:

LABEL InstallCentOS7
MENU LABEL Install CentOS 7 1908
KERNEL /networkboot/CentOS7-1908/vmlinuz
APPEND initrd=/networkboot/CentOS7-1908/initrd.img inst.repo=ftp://192.168.1.28/CentOS7-1908-minimal

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:

cp /data/pub/CentOS-7-x86_64-Minimal-1908/isolinux/{vmlinuz,initrd.img} /data/tftpboot/networkboot/CentOS7-1908

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:

scp /mnt/sysimage/boot/vmlinuz-3.10.0-1062.el7.x86_64 /mnt/sysimage/boot/initramfs-3.10.0-1062.el7.x86_64.img user@192.168.1.28:

and place this two files in tftp directory:

mv /home/user/vmlinuz-3.10.0-1062.el7.x86_64 /home/user/initramfs-3.10.0-1062.el7.x86_64.img /data/tftpboot/networkboot/CentOS7-1908

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:

LABEL Centos7
MENU DEFAULT
MENU LABEL Cent OS 7
kernel /networkboot/CentOS7-1908/vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro netroot=iscsi:@192.168.1.28::::iqn.1994-11.com.netgear:nas:08303042:centos-pxe rd.iscsi.initiator=iqn.1994-05.com.redhat:2f3474eec735 vconsole.keymap=pl LANG=en_GB.UTF-8  console=tty0 ip=enp3s0:dhcp  rhgb quiet
append initrd=/networkboot/CentOS7-1908/initramfs-3.10.0-1062.el7.x86_64.img

You can check "magic numbers" on freshly installed system by:

[anaconda root@localhost /]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:2f3474eec735
[anaconda root@localhost /]# iscsiadm -m session
tcp: [1] 192.168.1.28:3260,1 iqn.1994-11.com.netgear:nas:08303042:centos-pxe
[anaconda root@localhost /]# grep root /mnt/sysimage/etc/fstab
/dev/mapper/centos-root /    xfs      defaults,_netdev,_netdev 0 0 

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:

cd /tmp/
wget http://boot.ipxe.org/undionly.kpxe
mv /tmp/undionly.kpxe /data/tftpboot/

Not to have to flash network card ROM I use PXE chainloading. Change (on Gargoyle - DHCP server):

dhcp-match=set:ipxe,175
dhcp-boot=tag:!ipxe,undionly.kpxe,,192.168.1.28
dhcp-boot=menu.ipxe,,192.168.1.28

It should be more convenient way to upgrade kernel in future.

For now, in menu.ipxe I've entry:

:pxelinux
set 210:string tftp://192.168.1.28/
chain ${210:string}pxelinux.0 || goto failed
goto start

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

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31